[systemd-devel] Antw: Re: Antw: Re: Antw: [EXT] Re: Q: Start network in chroot?

Michał Zegan webczat at outlook.com
Tue Jun 14 08:29:11 UTC 2022


W dniu 14.06.2022 o 10:19, Ulrich Windl pisze:
>>>> Michal Zegan <webczat at outlook.com> schrieb am 14.06.2022 um 09:25 in Nachricht
> <DM4PR12MB66388D04DB6D7A76138DC8A8A0AA9 at DM4PR12MB6638.namprd12.prod.outlook.com>
>
> ...
>>>> Sure when "init" was just a bundle of scripts, you could run one of the
>>>> scripts it runs and hope for the best. You can generally still do that,
>>>> but just don't expect asking a non-running program to do it for you to work!
>>> Still I don't understand: systemd is running.
>> on the host. daemons usually read configuration, including service
>> files, from the place they run from. systemd is not running from chroot
>> so it will read services from outside of chroot, doing othervise would
>> be extremely weird behavior.
> Thank you for this explanation; it makes sense. However (as written a moment ago) the original error messgae is not really helpful trying to understand the root cause of the issue.
> But still I guess I cannot have a second systemd in chroot.
>
>> note contrary to sysvinit you are not running service scripts, but you
>> communicate with an already running systemd instance to start a service,
>> so because systemd runs from outside of chroot it cannot start a service
>> as if it was in a chroot, nor can this service read config files from
>> chroot.
> OK, the problem seems to be that systemctl does not "pass" the units to systemd, but systemd "ate" (and digested) them all before.
passing them wouldn't help as it would still be systemd running the 
service, so it would have to run it from chroot, it would be a separate 
feature which wouldn't be something you'd expect out of the box.
>
>> You would literally need running systemd copy related to the chroot
>> which you cannot do without namespacing, and you would need network
>> interface in that ns.
> namespaces are quite new to me. I have no experience with those.

this would be quite complex but doable. I am crazy enough to play with 
stuff like this when I am bored.

I imagine you would need to be careful so that trying to run your guest 
os this way won't try to do things like loading modules into the host.

another method I saw being used is running guest os in a vm if a rescue 
system allows installing software, but at this point you could install 
nspawn too and use it.


>
> Regards,
> Ulrich
>
>> would be an interesting experiment to do without container software tbh.
>>
>>> Regards,
>>> Ulrich
>>>
>>>> Col
>>>
>>>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE6516A8A8E25955D.asc
Type: application/pgp-keys
Size: 10971 bytes
Desc: OpenPGP public key
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220614/f8a8a76e/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220614/f8a8a76e/attachment-0001.sig>


More information about the systemd-devel mailing list