Chroot

From 太極
Revision as of 10:45, 27 November 2021 by Brb (talk | contribs) (Created page with "* https://help.ubuntu.com/community/BasicChroot * https://help.ubuntu.com/community/DebootstrapChroot * http://www.thegeekstuff.com/2010/01/debootstrap-minimal-debian-ubuntu-i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note that we have to change the conf file a little bit. The 'location' word needs to be changed to 'directory'. Also at the last step when we are ready to test a 32-bit GUI app, we need to issue DISPLAY in a separate line; such as

export DISPLAY=:0.0
su brb # brb is my root user in the host system that can invoke the schroot program
       # firefox does not allow to use root to start it
firefox

For a recap:

1. Install the packages
sudo apt-get install debootstrap schroot -y
2. Create a schroot configuration file
sudo nano /etc/schroot/chroot.d/precise_i386.conf
3. Install 32-bit ubuntu with debootstrap
sudo mkdir -p /srv/chroot/precise_i386
sudo debootstrap --variant=buildd --arch=i386 precise /srv/chroot/precise_i386 http://archive.ubuntu.com/ubuntu/
4. Test the chroot environment
schroot -l
schroot -c precise_i386 -u root
uname -a
cat /etc/issue
5. Additional configuration
apt-get install ubuntu-minimal
# That's all.

The article also mentioned the home directories (Documents, Downloads, ...) of the users within the chroot are shared with the host. How to access them from the host?