6

The recent linux distributions such as Fedora and Ubuntu all use chroot environment to make the build. Because when making the build often it needs to install some special tools, and to install to the existing system. Using chroot avoids making any changes to the host system.

To set up such a build environment, the first step is to make a chroot. I'm following the setup guide at https://wiki.debian.org/Schroot

[wheezy-test]
description=Contains the SPICE program
aliases=test
type=directory
directory=/srv/chroot/test
users=jsmith
root-groups=root
script-config=desktop/config
personality=linux
preserve-environment=true

In the host on my setup the /home is on /dev/mapper. When schroot is entered, the same home is bind-mounted. Is there a way to avoid this? I prefer to use a different /home inside chroot.

When changing the type from directory to plain, the binding is not performed. However that also loses /proc, /sys, etc. You'd have to manually bind-mount them. That does not seem to be a good solution.

If a simple configuration change is unavailable, any idea where the script is for type=directory? Probably I'll manually modify the script.

Thanks in advance for any answers or hints!

2
  • I originally intended to use it for build-systems. Now have moved away from chroot to docker containers. Much easier, faster, and more flexible.
    – minghua
    May 5, 2017 at 17:01
  • 4
    Possible duplicate of schroot Don't Share Home Directory Nov 8, 2017 at 21:54

2 Answers 2

10

The solution is to edit the schroot configuration file at /etc/schroot/default/fstab. Just comment out the line of /home /home none rw,bind 0 0. If you run X you also need to uncomment the line for /run. All other configuration files are also at the same location.

5

I recommend a different solution (my previous answer). You can use different fstab for different jails.

You could specify filesystem table file by editing schroot conf file. For example, if you add setup.fstab=minimal/fstab to the end of /etc/schroot/chrood.d/[your chroot's].conf, schroot would filesystem according to /etc/schroot/minimal/fstab.

1
  • If you want to change the mount for all jails, modify the default as in my answer. If you want to setup a different mounting map, use the jail-specific config as this answer suggests.
    – minghua
    May 5, 2017 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.