Giter Club home page Giter Club logo

arch-bootstrap's Introduction

arch-bootstrap

Bootstrap a base Arch Linux system from any GNU distro.

Install

# install -m 755 arch-bootstrap.sh /usr/local/bin/arch-bootstrap

Examples

Create a base arch distribution in directory 'myarch' (currently running arch by default):

# arch-bootstrap myarch

The same but use arch x86_64 and a given repository source:

# arch-bootstrap -a x86_64 -r "ftp://ftp.archlinux.org" myarch 

Usage

Once the process has finished, chroot to the destination directory (default user: root/root):

# chroot destination

Note that some packages require some system directories to be mounted. Some of the commands you can try:

# mount --bind /proc myarch/proc
# mount --bind /sys myarch/sys
# mount --bind /dev myarch/dev
# mount --bind /dev/pts myarch/dev/pts

License

This project is licensed under the terms of the MIT license

arch-bootstrap's People

Contributors

attilabogar avatar bpow avatar cengique avatar e00e avatar fierelier avatar gevans avatar gt945 avatar ighea avatar kiskoza avatar konradybcio avatar masami256 avatar seansummers avatar tiredofit avatar tokland avatar yannayl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arch-bootstrap's Issues

zstd: command not found

I tried to use it on the chromebook but it doesn't have zstd, is there an alternative that doesn't involve installing zstd?

missing libgssapi_krb5.so.2

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

Fails with "cannot find package"

./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.

Process does not create .arch-chroot in root dir

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?

Reduce dependencies to closest POSIX or busybox set available

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 gawkisms 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!

extra mount now required before chroot

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!

use the download directory as cache

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.

libxml2.so missing

The bug

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.

The work-around for others encountering this

I managed to work around the issue like so:

Once that was done I chroot'd in like normal and everything worked fine.

Error: cannot find package: archlinux-keyring

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

Doesn't work with -a i686 anymore

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.

Errors when bootstrapping aarch64 or armv7h

-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

Does it work with a Linux distro?

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?

Infinite loop with i686 on alpine linux

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.

Fails, when the path has a blank.

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

libbrotli.so.1 error

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.

Default mirror broken?

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

Missing Curl support

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

NO ARM POSSIBLE !!!

I Cannot Use This On My Raspberry Pi !! So Please Fix The Problem Yourself Instead Waiting A Pull Request !!! ΓΉ$%!=

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.