tokland / arch-bootstrap Goto Github PK
View Code? Open in Web Editor NEWBootstrap a base Arch Linux system
Bootstrap a base Arch Linux system
many distro's only come with curl initially, and wget is optional (this is because curl is also a library, and used almost everywhere, whereas wget is only a cli).
I used this patch to make it work:
diff --git a/arch-bootstrap.sh b/arch-bootstrap.sh
index 43c3d2f..b157f2b 100755
--- a/arch-bootstrap.sh
+++ b/arch-bootstrap.sh
@@ -44,7 +44,7 @@ extract_href() {
}
fetch() {
- wget -c --passive-ftp --quiet "$@"
+ curl -s "$@"
}
uncompress() {
@@ -119,7 +119,7 @@ fetch_packages_list() {
debug "fetch packages list: $REPO/"
# Force trailing '/' needed by FTP servers.
- fetch -O - "$REPO/" | extract_href | awk -F"/" '{print $NF}' | sort -rn ||
+ fetch "$REPO/" | extract_href | awk -F"/" '{print $NF}' | sort -rn ||
{ debug "Error: cannot fetch packages list: $REPO"; return 1; }
}
@@ -133,7 +133,7 @@ install_pacman_packages() {
local FILEPATH="$DOWNLOAD_DIR/$FILE"
debug "download package: $REPO/$FILE"
- fetch -O "$FILEPATH" "$REPO/$FILE"
+ fetch -o "$FILEPATH" "$REPO/$FILE"
debug "uncompress package: $FILEPATH"
uncompress "$FILEPATH" "$DEST"
done
It currently throws an error when trying to execute /usr/bin/pacman about libbrotli.so.1 not being found. To fix this you must add brotli to the pacman packages list at the beginning of the script.
I am interested in using this script on a system where some of the dependencies - such as bash and gawk - may not be available, but busybox is guaranteed to be available.
When I looked through your source code, it seems most things could be easily made more portable. The awk
you use, for example, does not seem dependent on any gawk
isms at all, and could be any major awk
implementation.
Some things would be harder to make POSIX, such as pipefail
. Busybox supports pipefail
and, for my needs, no additional work for that would have to be done. However, getting it to be fully POSIX would be a reachable and reasonable goal, I think.
I'll be happy make the changes necessary to do this and throw a pull request at you myself; however, before I do so, I figured I'd ask if such a patch would likely be accepted. I wasn't sure if there was a specific reason you were targeting GNU systems beyond it simply being a reasonable balance between portability and work to implement.
Thanks!
had this error while installing inside debian docker container
--- configure DNS and pacman
mknod: archroot/dev/null: Operation not permitted
have any idea what could be the cause?
Running this script from Linux Mint, I get this error:
/usr/bin/pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
So it seems this script is not downloading libxml2
, which is required by pacman.
I managed to work around the issue like so:
.tar.zst
file.rsync -av ~/Downloads/libxml2-2.13.0-4-x86_64.pkg/usr/ chroot/myarch/usr/
arch-bootstrap
command.Once that was done I chroot'd in like normal and everything worked fine.
Today I have this error while running bootstrap:
....
--- install packages: acl archlinux-keyring attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libssh2 lzo2 openssl pacman pacman-mirrorlist xz zlib filesystem coreutils bash grep gawk file tar systemd
/usr/bin/pacman: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory
It is odd that this wrapper does not rwatw the chroot in the structure that this page describes: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot
This then doesn't allow makechrootpkg to run, as it checks for dir/. arch-chroot under dir/root. Why doesn't this script house the root contents in root/ not the directory passed to it? Where is .arch-chroot?
Contents of . arch-chroot
v4
That is an old 85th chroot I have.
arch-nspawn where the check occurs: http://sprunge.us/KAZj
Is the wiki outdated for Arch and I should not be using makechrootpkg?
I tried this with
jonas@jonas-elementary:~$ sudo arch-bootstrap -a x86_64 /media/jonas/Arch\ Linux/
but it failed here:
--- download package: http://mirrors.kernel.org/archlinux/core/os/x86_64/filesystem-2017.03-2-x86_64.pkg.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10448 100 10448 0 0 22190 0 --:--:-- --:--:-- --:--:-- 22182
--- uncompress package: /tmp/tmp.n2vsN9Jh0K/filesystem-2017.03-2-x86_64.pkg.tar.xz
--- configure DNS and pacman
sed: kann /media/jonas/Arch nicht lesen: Datei oder Verzeichnis nicht gefunden
sed: kann Linux//etc/shadow nicht lesen: Datei oder Verzeichnis nicht gefunden
I followed this tutorial: https://www.reddit.com/r/linux_gaming/comments/c50vsb/howto_run_steam_in_a_container_without_32bit/
And besides other errors, the tutorial assumes arch-bootstrap would just let me cancel out the setup.
It doesn't.
I am stuck here:
Arch Linux 5.15.23-1 (pts/0)
bootstrap login:
I have a need to bootstrap for i686. It looks like this was moved off of the default repo about a year ago. Simply using -r with one of the arch32 mirrors doesn't seem to solve the issue.
I had to mount an EXTRA /dev sub-dir to be able to install anything via pacman.
Otherwise all packages gave:
error: GPGME error: Inappropriate ioctl for device
(from debian sid 2013-12)
sudo mount --bind /dev/pts /arch/dev/pts
Please add to readme.
Thx for super script!
I tried to use this on i686 alpine linux and ended up in a situation where /dev/null didn't exist. The install script for gnupg includes dirmngr </dev/null &>/dev/null
, which causes a hilarious infinite loop with it trying to interpret its own logs and error messages as input.
Got the following error:
# /usr/local/bin/arch-bootstrap -a x86_64 -r "http://mirror.aktkn.sg/archlinux/" /mnt/arch
--- destination directory: /mnt/arch
--- core repository: http://mirror.aktkn.sg/archlinux/core/os/x86_64
--- temporary directory: /tmp/tmp.sDYR1Glicf
--- fetch packages list: http://mirror.aktkn.sg/archlinux/core/os/x86_64/
--- pacman package and dependencies: acl archlinux-keyring attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libnghttp2 libssh2 lzo openssl pacman pacman-mirrorlist xz zlib krb5 e2fsprogs keyutils libidn2 libunistring gcc-libs lz4 libpsl icu libunistring zstd filesystem
--- download package: http://mirror.aktkn.sg/archlinux/core/os/x86_64/acl-2.2.53-2-x86_64.pkg.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 131k 100 131k 0 0 586k 0 --:--:-- --:--:-- --:--:-- 589k
--- uncompress package: /tmp/tmp.sDYR1Glicf/acl-2.2.53-2-x86_64.pkg.tar.xz
--- Error: cannot find package: archlinux-keyring
locale-gen depends on it
when using the '-d <download_dir>'
option, do not download the files which are already in the directory.
perhaps we should verify them with a hash or something.
improvement: let pacman also know about those packages.
Previously, arch-bootstrap saved packages and kept them between runs when a user-specified directory was passed through the -d
flag. It looks like 0a66940 removed this functionality resulting in user-specified directories being completely wiped out at exit.
Hi!
There seems to be no checking of GPG signatures and the URLs used internally start with http:// rather than https:// (while at least http://mirrors.kernel.org/archlinux could be replaced by https://mirrors.kernel.org/archlinux). That leaves quite some surface for man-in-the-middle attacks.
I propose to download GPG keys through HTTPs and check GPG signatures of packages downloaded.
Thanks and best, Sebastian
I tried to use it on the chromebook but it doesn't have zstd, is there an alternative that doesn't involve installing zstd?
I Cannot Use This On My Raspberry Pi !! So Please Fix The Problem Yourself Instead Waiting A Pull Request !!! ΓΉ$%!=
./arch-bootstrap.sh myarch
--- destination directory: myarch
--- core repository: http://mirrors.kernel.org/archlinux/core/os/x86_64
--- temporary directory: /tmp/tmp.4VkDWgRGIG
--- fetch packages list: http://mirrors.kernel.org/archlinux/core/os/x86_64/
./arch-bootstrap.sh: line 47: curl: command not found
--- Error: cannot fetch packages list: http://mirrors.kernel.org/archlinux/core/os/x86_64
--- pacman package and dependencies: acl archlinux-keyring attr brotli bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libnghttp2 libssh2 lzo openssl pacman pacman-mirrorlist xz zlib krb5 e2fsprogs keyutils libidn2 libunistring gcc-libs lz4 libpsl icu libunistring zstd filesystem
--- Error: cannot find package: acl
On http://mirrors.edge.kernel.org/archlinux/core/os/x86_64/ I see that the file is called acl-2.3.1-1-x86_64.pkg.tar.zst
which might not be matching the regex in line 145 anymore.
Hi!
While installation through the Rackspace mirror seems to work fine
# ./arch-bootstrap.sh -a x86_64 -r http://mirror.rackspace.com/archlinux/ arch_root
the default mirror at mirrors.kernel.org does not lead to a successful installation as of today, tried twice:
# ./arch-bootstrap.sh -a x86_64 arch_root
[..]
--- configure DNS and pacman
--- install packages: acl archlinux-keyring attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libssh2 lzo openssl pacman pacman-mirrorlist xz zlib krb5 e2fsprogs keyutils libidn gcc-libs filesystem coreutils bash grep gawk file tar systemd
:: Synchronizing package databases...
error: failed retrieving file 'core.db' from mirrors.kernel.org : error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
error: failed to update core (download library error)
error: failed retrieving file 'extra.db' from mirrors.kernel.org : error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
error: failed to update extra (download library error)
error: failed retrieving file 'community.db' from mirrors.kernel.org : error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
error: failed to update community (download library error)
error: failed to synchronize any databases
error: failed to init transaction (download library error)
# ls -l /etc/ssl/certs/ca-certificates.crt
-rw-r--r-- 1 root root 273790 Apr 25 11:46 /etc/ssl/certs/ca-certificates.crt
Maybe Rackspace would make a better default mirror? It's listed as worldwide at the very top in etc/pacman.d/mirrorlist
.
Best, Sebastian
arthur@arthur-K46CB:/$ ./arch-bootstrap.sh
Usage: arch-bootstrap.sh [-q] [-a i686|x86_64|arm] [-r REPO_URL] [-d DOWNLOAD_DIR] DESTDIR
-a x86_64
is working, but -a aarch64
or -a armv7h
get a ways into it but then give this error...
--- install packages: acl archlinux-keyring attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libnghttp2 libssh2 lzo openssl pacman pacman-mirrorlist xz zlib krb5 e2fsprogs keyutils libidn2 libunistring gcc-libs lz4 libpsl icu libunistring zstd filesystem coreutils bash grep gawk file tar systemd sed
chroot: failed to run command '/usr/bin/pacman': No such file or directory
Not sure what a GNU distro is since GNU is a toolset that tends to make up less that 5% of any system it's on, does it work with a Linux Distro?
The --force flag has been deprecated, hence it should be removed from the script otherwise pacman will simply fail.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.