0

my host system is archlinux and i need an ubuntu enviornment ready to be used with the files in my home directory. Problem is: my home directory is encrypted using ecryptfs. So when i launch the schroot this is what i get:

 ~ $ schroot -c ubuntu-lts
(ubuntu-lts) ~ $ ls
Access-Your-Private-Data.desktop  README.txt

How can i automount my encrypted home directory (possibly without re-entering my password).

To setup my encrypted home on archlinux i have followed this:

My schroot setup is very simple:

~ $ cat /etc/schroot/chroot.d/ubuntu-lts.conf
[ubuntu-lts] 
type=directory 
description=Ubuntu 18.04 LTS
directory=/opt/schroot/ubuntu-lts 
users=<my username>
aliases=ubuntu-18.04,ubuntu-bionic,bionic
  • Can you log in (decrypting your home), and then run the schroot command? Doesn't it keep your home decrypted & usable? – Xen2050 Jan 23 at 11:43
  • Yes but it is mounted on host /home. What i would like to do is to have it mount on <chroot mount point>/home when i launch schroot command – wellsaid Jan 23 at 14:21
  • chroot can't move the mount itself? Or maybe just mount --bind before chroot – Xen2050 Jan 23 at 22:32
  • Can you be more specific? Should i put in in /etc/schroot/default/fstab /home/<username> with bind option? – wellsaid Jan 25 at 13:52
0

I found a solution after a while:

schroot setup:

[ubuntu-lts]
type=directory
description=Ubuntu 18.04 LTS
directory=/opt/schroot/ubuntu-lts
users=<your-username>
aliases=ubuntu-18.04,ubuntu-bionic,bionic
setup.fstab=ubuntu-lts/fstab

And the fstab file becomes:

# fstab: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/proc           /proc           none    rw,bind         0       0
/sys            /sys            none    rw,bind         0       0
/dev            /dev            none    rw,bind         0       0
/dev/pts        /dev/pts        none    rw,bind         0       0
/home           /home           none    rw,bind         0       0
/tmp            /tmp            none    rw,bind         0       0
/home/<your-username>   /home/<your-username>   none    rw,bind         0       0

# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot.  However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
#/run           /run            none    rw,bind         0       0
#/run/lock      /run/lock       none    rw,bind         0       0
#/dev/shm       /dev/shm        none    rw,bind         0       0

Which is simply the fstab file copied from /etc/schroot/default/fstab in /etc/schroot/ubuntu-lts/fstab where i added this line:

/home/<your-username>   /home/<your-username>   none    rw,bind         0       0

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.