wikibackup/debian-chroot.md

2.5 KiB

title description published date tags editor dateCreated
Debian Chroot in Parch Linux A Guide to have debian under Parch Linux true 2024-04-05T10:42:59.452Z debian, parch markdown 2024-04-05T10:37:55.039Z

What is a Chroot?

The chroot Linux utility can modify the working root directory for a process, limiting access to the rest of the file system.

how to have a Debian chroot inside ParchLinux?

  1. Install Debootstrap
sudo pacman -Sy
sudo pacman -S debootstrap
  1. Make a Folder inside /opt for your debian new root
sudo mkdir /opt/debian
  1. Set Debootstrap location and start Debootstraping :D
DEBOOTSTRAP_DIR=/opt/debootstrap/usr/share/debootstrap /opt/debootstrap/usr/sbin/debootstrap --arch amd64 bookworm /opt/debian/ http://ftp.uk.debian.org/debian/
  • Note : You can change the debian version by changing the bookworm to your version codename. You can find debian codenames here.
  1. Mount the Directories
mount -t proc proc /opt/debian/proc/
mount -t sysfs sys /opt/debian/sys/
mount -o bind /dev /opt/debian/dev/
mount -o bind /dev/pts /opt/debian/dev/pts/
  1. Setup the repositories for your chrooted system
cat > /opt/debian/etc/apt/sources.list << 'EOF'
deb http://ftp.uk.debian.org/debian/ bookworm main non-free contrib
deb-src http://ftp.uk.debian.org/debian/ bookworm main non-free contrib

deb http://security.debian.org/ bookworm/updates main non-free contrib
deb-src http://security.debian.org/ bookworm/updates main non-free contrib

deb http://ftp.uk.debian.org/debian/ bookworm-updates main non-free contrib
deb-src http://ftp.uk.debian.org/debian/ bookworm-updates main non-free contrib
EOF
  • Note : Change the Codename to your installed Version
  1. Chroot to your debian
chroot /opt/debian /bin/bash
  1. Upgrade the Debian and regenerate the locales:
apt-get update && apt-get dist-upgrade
apt-get install locales
dpkg-reconfigure locales
  1. Add a name to /etc/hosts
echo mywonderfulldebian >> /etc/hosts

Optional

  1. Add a new user to the chroot
apt-get install curl sudo ncurses-term
groupadd sudo
useradd -m -G sudo -s /bin/bash parch
passwd parch
  • note : Replace parch with your username
  1. add new user to sudoers
cat > /etc/sudoers << 'EOF'
root  ALL=(ALL) ALL
%sudo ALL=(ALL) ALL
EOF
  1. connect to your user
sudo -iu parch

or

su parch