Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save albertlincoln/61431e4a2f35efe9d5d21b409811fc2e to your computer and use it in GitHub Desktop.
Save albertlincoln/61431e4a2f35efe9d5d21b409811fc2e to your computer and use it in GitHub Desktop.
Debian chroot inside Arch
pacman -S wget arch-install-scripts debootstrap
CHROOTBASE=/mnt/DEBCHROOT
CHROOTSTRAP=$CHROOTBASE/strap
CHROOT=$CHROOTBASE/root
mkdir -p $CHROOTSTRAP
cd $CHROOTSTRAP
mkdir -p $CHROOT
debootstrap --arch amd64 bullseye $CHROOT http://ftp.uk.debian.org/debian/
mount -t proc proc $CHROOT/proc/
mount -t sysfs sys $CHROOT/sys/
mount -o bind /dev $CHROOT/dev/
mount -o bind /dev/pts $CHROOT/dev/pts/
cat > $CHROOT/etc/apt/sources.list << 'EOF'
deb http://ftp.uk.debian.org/debian/ bullseye main non-free contrib
deb-src http://ftp.uk.debian.org/debian/ bullseye main non-free contrib
deb http://security.debian.org/ bullseye/updates main non-free contrib
deb-src http://security.debian.org/ bullseye/updates main non-free contrib
deb http://ftp.uk.debian.org/debian/ bullseye-updates main non-free contrib
deb-src http://ftp.uk.debian.org/debian/ bullseye-updates main non-free contrib
EOF
chroot $CHROOT /bin/bash
# inside chroot
apt-get update && apt-get dist-upgrade
apt-get install locales
dpkg-reconfigure locales
# add name to /etc/hosts
# optional
apt-get install curl sudo ncurses-term
groupadd sudo
useradd -m -G sudo -s /bin/bash all
passwd all
cat > /etc/sudoers << 'EOF'
root ALL=(ALL) ALL
%sudo ALL=(ALL) ALL
EOF
sudo -iu all
apt-get install git
mkdir ~/src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment