Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up a build environment using chroot, but instead of downloading ubuntu base files, I want to use my live / as base files for the chroot and use c-o-w to redirect any changes made in the chroot to other folder. So I come up with these

sudo mkdir /var/chroot/build/{root,cow,ubuntu}
sudo mount --bind / /var/chroot/build/root
sudo mount --bind /proc /var/chroot/build/root/proc
sudo mount --bind /dev/pts /var/chroot/build/root/dev/pts

sudo mount -t overlayfs -o upperdir=/var/chroot/build/cow,lowerdir=/var/chroot/build/root overlayfs /var/chroot/build/ubuntu
sudo chroot /var/chroot/build/ubuntu

It works almost perfectly except that contents of both /proc and /dev/pts are not visible inside the chroot although they are visible outside the chroot. Im guessing that's the limition of overlayfs when you set up chroot this way

So I want to know is there a proper way to do this? I found a nice sandbox app called arkose which does almost what I want to do here but it doesn't let you keep the changes, once you exit the chroot, all files in c-o-w dir will be wiped out, which is not what I want

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.