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

Andrei Borzenkov arvidjaar at gmail.com
Sat Jun 18 04:45:45 UTC 2022


On 16.06.2022 11:27, Colin Guthrie wrote:
> 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
> 

Yes, --bind=/dev/null:/etc/fstab

allows boot to complete. Of course next it refuses root login because
pts/0 is not secure :)

Thanks.


More information about the systemd-devel mailing list