[systemd-devel] systemd-nspawn - invisble directories ?

Joel GUITTET jguittet.opensource at witekio.com
Thu Oct 17 11:48:34 UTC 2024


Hello community,

I face a strange behavior of my containers running using systemd-nspawn : some directories initially in the volume are not visible inside the container. It seems this is always the qame "kind" of directories e.g. maybe they are reserved for specific use ?

Example:

root at target:~# ls -l /var/lib/machines/hello-world/
total 0
lrwxrwxrwx  1 root root   7 Apr  5  2011 bin -> usr/bin
drwxr-xr-x  2 root root   3 Apr  5  2011 boot
drwxr-xr-x  2 root root   3 Apr  5  2011 dev
drwxr-xr-x 18 root root 747 Apr  5  2011 etc
drwxr-xr-x  3 root root  27 Apr  5  2011 home
lrwxrwxrwx  1 root root   7 Apr  5  2011 lib -> usr/lib
drwxr-xr-x  2 root root   3 Apr  5  2011 media
drwxr-xr-x  2 root root   3 Apr  5  2011 mnt
dr-xr-xr-x  2 root root   3 Apr  5  2011 proc
drwxr-xr-x  2 root root   3 Apr  5  2011 run
lrwxrwxrwx  1 root root   8 Apr  5  2011 sbin -> usr/sbin
drwxr-xr-x  2 root root   3 Apr  5  2011 srv
dr-xr-xr-x  2 root root   3 Apr  5  2011 sys
drwxrwxrwt  2 root root   3 Apr  5  2011 tmp
drwxr-xr-x  8 root root 116 Apr  5  2011 usr
drwxr-xr-x  9 root root 157 Apr  5  2011 var

root at target:~# machinectl shell hello-world
Connected to machine hello-world. Press ^] three times within 1s to exit session.
~ # ls -l /
lrwxrwxrwx    1 root     root             7 Apr 28 17:43 bin -> usr/bin
drwxr-xr-x    8 root     root           420 Apr 28 17:43 dev
drwxr-xr-x    3 root     root           320 Apr 28 17:43 etc
drwxr-xr-x    2 root     root            40 Apr 28 17:43 home
lrwxrwxrwx    1 root     root             7 Apr 28 17:43 lib -> usr/lib
dr-xr-xr-x  124 root     root             0 Apr 28 17:43 proc
drwxr-xr-x    2 root     root            60 Apr 28 17:49 root
drwxr-xr-x   10 root     root           260 Apr 28 17:43 run
lrwxrwxrwx    1 root     root             8 Apr 28 17:43 sbin -> usr/sbin
drwxr-xr-x    2 root     root            40 Apr 28 17:43 srv
dr-xr-xr-x    9 root     root           180 Apr 28 17:43 sys
drwxrwxrwt    2 root     root            40 Apr 28 17:43 tmp
drwxr-xr-x    8 root     root           116 Apr  5  2011 usr
drwxr-xr-x    7 root     root           200 Apr 28 17:43 var

So the following are missing inside the container: /boot, /media, /mnt and /opt.

Any reason for this ???

My container is started using the following command:

systemd-nspawn --quiet --boot --network-bridge=br0 --read-only --volatile=yes --notify-ready=yes --settings=override --slice=${SLICE} --machine=%i

Maybe an option of systemd-nspawn has this effect ?

Thanks!
Joel


More information about the systemd-devel mailing list