Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: I recently got dhcpcd package ownership. I tested it inside systemd-nspawn container with systemd. It failed to start there, because not active net device exists there. I have to BindsTo=sys-subsystem-net-devices-%i.device After=sys-subsystem-net-devices-%i.device Version-Release number of selected component (if applicable): systemd-248~rc3-2.fc35.x86_64 systemd-container-245.9-1.fc32.1.x86_64 How reproducible: reliable Steps to Reproduce: 1. have a rawhide nspawn chroot prepared and also libvirt network 2. ip a show dev virbr0 3. systemd-nspawn -bD <chroot-path> --network-bridge virbr0 4. ip a show dev host0 # inside container 5. systemctl status sys-subsystem-net-devices-%i.device # inside container Actual results: # ip a show dev host0 2: host0@if66: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 3e:cb:e4:52:ca:a8 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 192.168.122.82/24 brd 192.168.122.255 scope global dynamic host0 valid_lft 2895sec preferred_lft 2895sec inet6 fc30:e1c:64cf:2b0a:3ccb:e4ff:fe52:caa8/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 7000sec preferred_lft 3400sec inet6 fe80::3ccb:e4ff:fe52:caa8/64 scope link valid_lft forever preferred_lft forever # systemctl status sys-subsystem-net-devices-host0.device ○ sys-subsystem-net-devices-host0.device - /sys/subsystem/net/devices/host0 Loaded: loaded Active: inactive (dead) Expected results: # systemctl status sys-subsystem-net-devices-host0.device ○ sys-subsystem-net-devices-host0.device - /sys/subsystem/net/devices/host0 Loaded: loaded Active: active (plugged) Additional info: I have to disable BindTo=, because the net-device is never activated, even when it is configured and working. Not sure problem is on the host (fedora 32) or container (fedora 35).
It prevents starting on such rawhide container: # systemctl restart dhcpcd@host0 # journalctl -xe Mar 22 09:06:50 srawhide systemd[1]: Unnecessary job for /sys/subsystem/net/devices/host0 was removed. ░░ Subject: A start job for unit sys-subsystem-net-devices-host0.device has failed ░░ Defined-By: systemd ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A start job for unit sys-subsystem-net-devices-host0.device has finished with a failure. ░░ ░░ The job identifier is 773 and the job result is collected. Mar 22 09:06:50 srawhide systemd[1]: Created slice system-dhcpcd.slice. ░░ Subject: A start job for unit system-dhcpcd.slice has finished successfully ░░ Defined-By: systemd ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A start job for unit system-dhcpcd.slice has finished successfully. ░░ ░░ The job identifier is 772. Mar 22 09:06:50 srawhide systemd[1]: dhcpcd: Bound to unit sys-subsystem-net-devices-host0.device, but unit isn't active. Mar 22 09:06:50 srawhide systemd[1]: Dependency failed for dhcpcd on host0. ░░ Subject: A start job for unit dhcpcd has failed ░░ Defined-By: systemd ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A start job for unit dhcpcd has finished with a failure. ░░ ░░ The job identifier is 717 and the job result is dependency. Mar 22 09:06:50 srawhide systemd[1]: dhcpcd: Job dhcpcd/start failed with result 'dependency'. It seems systemctl edit dhcpcd@ [Unit] Description=dhcpcd on %I # sys-class-net-%i.device is inactive ( BindsTo= #BindsTo=sys-class-net-%i.device After= #After=sys-class-net-%i.device Does not help, I have to comment BindsTo in main /usr/lib/systemd/system/dhcpcd@.service. It it possible somehow inside override? It would allow at least simple workaround.
There is no udev in the container, hence no device units.
https://github.com/systemd/systemd/pull/19081
The patch to documentation was merged upstream. While I see how having device units in a container could be desirable, this would require a major rework. If you want, maybe open up discussion upstream. Either way, let's close this here as the docs have been improved and this isn't a bug.