Conversation
| # Flatcar: Don't enable services in /etc, move to /usr. | ||
| systemd_enable_service multi-user.target systemd-networkd.service | ||
| systemd_enable_service multi-user.target systemd-resolved.service | ||
| systemd_enable_service multi-user.target remote-fs.target |
There was a problem hiding this comment.
Some other files are also missing, I guess we need something like this (unless upstream deprecated it):
multi-user.target machines.target
multi-user.target remote-cryptsetup.target
network-online.target systemd-networkd-wait-online.service
sockets.target systemd-networkd.socket
There was a problem hiding this comment.
I was wondering whether to basically translate all the preset stuff from systemd into system_enable_service. For now I did that only for remote-fs. Can update it here too.
There was a problem hiding this comment.
I added multi-user.target machines.target and multi-user.target remote-cryptsetup.target. I also added remount-fs.target systemd-pstore.service. I don't know where did you get the other two - they are not listed in upstream's preset file.
There was a problem hiding this comment.
They come from the 2512.5.0 Stable release. This commit here c07b410 has a list of CoreOS services.
There was a problem hiding this comment.
So network-online.target systemd-networkd-wait-online.service is not necessary I think, because there is a comment in systemd-networkd.service which we enable:
# We want to enable systemd-networkd-wait-online.service whenever this service
# is enabled. systemd-networkd-wait-online.service has
# WantedBy=network-online.target, so enabling it only has an effect if
# network-online.target itself is enabled or pulled in by some other unit.
Also=systemd-networkd-wait-online.service
Not sure about sockets.target systemd-networkd.socket - systemd-networkd.socket is pulled in by systemd-networkd.service also with the Also= option. So I guess it's not necessary anymore too.
There was a problem hiding this comment.
I checked and the Also= is not enough: after sudo systemctl status network-online.target I saw that systemd-networkd-wait-online.service is inactive while on 2512.2.0 it is active afterwards.
There was a problem hiding this comment.
Same situation for systemd-networkd.socket which gets activated on 2512.2.0 but not on 2605.5.0
There was a problem hiding this comment.
Added those, but I don't see any change, maybe it's something to investigate later:
systemd-networkd-wait-online.service:
core@localhost ~ $ systemctl status systemd-networkd-wait-online.service
● systemd-networkd-wait-online.service - Wait for Network to be Configured
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd-wait-online.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd-networkd-wait-online.service(8)
systemd-networkd.socket:
core@localhost ~ $ systemctl status systemd-networkd.socket
● systemd-networkd.socket - Network Service Netlink Socket
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.socket; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-09-26 13:57:07 UTC; 7min ago
Triggers: ● systemd-networkd.service
Docs: man:systemd-networkd.service(8)
man:rtnetlink(7)
Listen: route 1361 (Netlink)
CGroup: /system.slice/systemd-networkd.socket
systemd-networkd.service:
core@localhost ~ $ systemctl status systemd-networkd.service
● systemd-networkd.service - Network Service
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-09-26 13:57:09 UTC; 7min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 729 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 1119)
Memory: 2.4M
CGroup: /system.slice/systemd-networkd.service
└─729 /usr/lib/systemd/systemd-networkd
Sep 26 13:57:09 localhost systemd[1]: Starting Network Service...
Sep 26 13:57:09 localhost systemd-networkd[729]: Enumeration completed
Sep 26 13:57:09 localhost systemd[1]: Started Network Service.
Sep 26 13:57:09 localhost systemd-networkd[729]: eth0: IPv6 successfully enabled
Sep 26 13:57:09 localhost systemd-networkd[729]: eth0: Link UP
Sep 26 13:57:09 localhost systemd-networkd[729]: eth0: Gained carrier
Sep 26 13:57:09 localhost systemd-networkd[729]: eth0: DHCPv4 address 10.0.2.15/24 via 10.0.2.2
Sep 26 13:57:09 localhost systemd-networkd[729]: eth0: Unable to shorten overlong DHCP hostname 'flatcar_production_qemu-2632-0-0', ignoring: Numerical argum>
Sep 26 13:57:11 localhost systemd-networkd[729]: eth0: Gained IPv6LL
There was a problem hiding this comment.
Have you tried pulling the target in before with start network-online.target or sockets.target?
There was a problem hiding this comment.
Anyway thanks, also for making the situation much more clear now than it was before.
margamanterola
left a comment
There was a problem hiding this comment.
This looks good to me as is. We can re-iterate to make it better, but I'd like for this to land in Monday's patch release.
Since v242, this unit is not enabled by default. Currently the recommended way of initial enablement of the important units is through `systemctl preset-all` with the preset file from systemd. We don't want to do it, because this action creates symlinks in /etc, so we enable those services ourselves by putting the symlinks in /lib.
At installation time, we usually want to enable services through /lib. This change will stop making the installation to put symlinks for getty in /etc, since we already do it in /lib.
This more or less mimics systemctl preset-all, but with enabling the services in /usr, not in /etc, as /etc is not autoupdated.
We are installing systemd from scratch in the image, so there are no previously enabled units to enable or reenable after installation. Also, this code would enable the services in /etc, which we don't want, because /etc is not autoupdated, so the enabled services could end up still being disabled after the update.
6a6a569 to
6ed07ea
Compare
These normally would be pulled by systemdctl enable when enabling systemd-networkd.service, because they are used in Also= options. In such case, we need to pull them ourselves, so they can be enabled in /usr, not in /etc.
|
Tested the PR with following ignition config: status of remote-fs.target: status of my testing unit: contents of /etc/systemd/system: remote-fs in /usr/lib/systemd/system: Will merge and cherry-pick to other branches. |
Since v242 remote-fs.target was not enabled by default, so mounting NFS shares did not happen after the update from 2512 (which has systemd 241). The ebuild was enabling remote-fs though, by putting a symlink in
/etc/systemd/system/…. But this change in `/etc/ is apparently propagated during update, so remote-fs.target ended up being not a dependent target during boot. So the PR tries harder at not enabling services through /etc, but through /lib.How to use
[ describe what reviewers need to do in order to validate this PR ]
Testing done
The image is building for me at the moment, but:
(in comparison with current stable)
Fixes flatcar/Flatcar#191
To be propagated to flatcar-2605 and flatcar-2632.