I have a machine currently running Ubuntu 16.04 amd64 that holds a lot of chroots used to do cross-platform embedded Linux builds. Rather than updating the host /etc/fstab as a lot of howtos suggest, I have start-up scripts that look like this:
Code:
sudo mount --bind /home /home/exskewsme/chroots/trusty_i386/home
sudo mount --bind /tmp /home/exskewsme/chroots/trusty_i386/tmp
sudo mount --bind /dev /home/exskewsme/chroots/trusty_i386/dev
sudo mount --bind /proc /home/exskewsme/chroots/trusty_i386/proc
sudo mount --bind /media /home/exskewsme/chroots/trusty_i386/media
sudo mount --bind /tftpboot /home/exskewsme/chroots/trusty_i386/tftpboot
dchroot -d -c trusty_i386
sudo umount /home/exskewsme/chroots/trusty_i386/home
sudo umount /home/exskewsme/chroots/trusty_i386/tmp
sudo umount /home/exskewsme/chroots/trusty_i386/dev
sudo umount /home/exskewsme/chroots/trusty_i386/proc
sudo umount /home/exskewsme/chroots/trusty_i386/media
sudo umount /home/exskewsme/chroots/trusty_i386/tftpboot
and the appropriate entry in /etc/schroot/schroot.conf
Code:
[trusty_i386]
description=Trusty i386
directory=/home/exskewsme/chroots/trusty_i386
type=directory
root-users=exskewsme
This lets me start the right chroot to modify / build embedded Linux board support package binaries as needed. This has worked great, until I recently needed to work with a device that needed me to download images from a tftpboot directory.
I created chroots/trusty_i386/tftpboot, and as seen in the sample above, had the script mount it. But unlike /tmp and /home/exskewsme, which see my host directories, it can't see the host /tftpboot directory. Instead, it keeps a local /tftpboot directory; everything I copy into it within the chroot is present, but it's not in the /tftpboot directory when I exit the chroot. Running mount in the chroot does not show the /tftpboot directory being mounted, so at least it's consistent.
I tried using a /xxx directory and saw the same result. I also tried using /chroots as my chroot root directory instead of /home/exskewsme/chroots, in case I had some cyclic definition problem. That didn't change things either. The mount command itself shows the contents of host /tftpboot being in .../trusty_i386/tftpboot prior to entering the chroot. The only thing that's clear for me right now is that I must be misunderstanding something.
My goal is to have the host provide tftpboot services with files that are added to it within the chroot... preferably without modifying host system files like /etc/fstab. I'd like to do that with a host directory instead of by running a tftp server in the chroot. If anyone can help me with that I'd appreciate it.
Thanks for reading.