[systemd-devel] Running actual systemd-based distribution image in systemd-nspawn

Colin Guthrie gmane at colin.guthr.ie
Thu Jun 16 08:27:31 UTC 2022


Andrei Borzenkov wrote on 15/06/2022 16:56:
> I tried it (loop mounting qemu image):
> 
> systemd-nspawn -D ./hd0 -b
> 
> and it failed miserably with "Timeout waiting for device
> dev-disk-by...". Which is not surprising as there are no device units
> inside of container (it stops in single user allowing me to use sysctl
> -t device).
> 
> Is it supposed to work at all? Even if I bind mount /dev/disk it does
> not help as systemd does not care whether device is actually present or not.

I've not tried "booting" a real install inside nspawn before (just 
images installed by mkosi mostly), but could this just be a by-product 
of it trying to do what /etc/fstab (or other mount units) say to do?

Can you try something like:

touch blank
systemd-nspawn --bind-ro=./blank:/etc/fstab -D ./hd0 -b

to override the /etc/fstab (there may be other more elegant ways to 
disable fstab processing!) and see if that helps?

If you have specific .mount units you may have to add specific 
workarounds to block them too.

HTHs

Col





More information about the systemd-devel mailing list