[systemd-devel] Systemd failed to create /init.scope under systemd-nspawn

serenissi serenissi at inventati.org
Thu May 8 06:33:51 UTC 2025


It seems very strange. systemd-nspawn should have nothing to do with 
whether it is running in vm or what is the host of the vm. Try to see 
what systemd-detect-virt see's in each case anyway.

For debugging, you can enter the nspawn container --boot and see if 
cgroup fs is mounted the same in all cases. Also enter the failing 
container and attach debugger (with follow on exec) to the shell process 
(pid 1 inside container, attach from outside ofc) and exec systemd to 
see exactly where it is failing. Good that you have extremely similar 
systems with different results so you can do differential debigging here.

(in case --boot adds other magic like podman --systemd flag, you can 
drop a binary with sleep/shell at the systemd location in the debian 
rootfs. Sorry, I haven't seen nspawn code since ages so can't recall).

~ serene

On 5/7/25 19:09, An Liu wrote:
>
> Hi,
> I'm playing systemd-nspawn, and something interesting happens.
> Try 1: host CentOS 8 Stream, systemd-nspawn to Debian Trixie
> everything goes well.
>
> Try 2: host CentOS 8 Stream , kvm guest CentOS 8 Stream
> a: in guest systemd-nspawn to Debian Trixie , nspawn is OK to start 
> without —boot
> b: in guest systemd-nspawn to Debian Trixie with --boot, nspawn failed 
> nspawn failed due to failed to create /init.scope
>
> Try 3: host Debian bookworm, kvm guest CenOS 8 Stream, nspawn to Trixie
> nspawn OK for whatever --boot present or not
>
> Can someone explain what lead to the different behavior, Can we manage 
> to fix it to make
> if so, what should we do. say, at the host side or at the kvm guest side?
>
>
> Try 4: host centos 8 stream, kvm guest centos 8 stream, starts with 
> the same rootfs above but in pod man, this time systemd could start as
>  pid 1
>
>
> Thanks
>
> Liu An
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250508/b5d0114e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250508/b5d0114e/attachment-0001.sig>


More information about the systemd-devel mailing list