Side effects of /etc/machine-id deletion
This certainly caught me by surprise.. but maybe it's expected? If so, feel free to ignore
I just happened to notice that systemd-homed.service was enabled by default for instances running arch-boxes images. This was slightly unexpected because the service is not enabled by default when installing Arch "by hand" from an installation ISO or when utilizing archinstall.
It turns out the root cause is due to our handling of /etc/machine-id. Essentially, deleting this file causes systemd-firstboot.service to run on first boot. This service does not run on "normal" installations because /etc/machine-id is initialized by systemd-machine-id-setup in the post_install() of systemd. But no problem, right?
Well, according to the docs (emphasis mine):
"The systemd(1) manager itself will initialize machine-id(5) and preset all units, enabling or disabling them according to the systemd.preset(5) settings."
The upshot of all this is - the enabled units in /usr/lib/systemd/system-preset/90-systemd.preset which are not normally enabled, are now all enabled in arch-boxes images. Here's a diff of systemctl list-unit-files --state=enabled output from 2 systems installed with archinstall, the 1st "normal", the 2nd with /etc/machine-id rm'd before first boot:
@@ -1,13 +1,25 @@
UNIT FILE STATE PRESET
getty@.service enabled enabled
+systemd-boot-update.service enabled enabled
+systemd-confext.service enabled enabled
+systemd-homed-activate.service enabled enabled
+systemd-homed.service enabled enabled
systemd-network-generator.service enabled enabled
systemd-networkd-wait-online.service enabled enabled
systemd-networkd.service enabled enabled
+systemd-pstore.service enabled enabled
systemd-resolved.service enabled enabled
+systemd-sysext.service enabled enabled
systemd-timesyncd.service enabled enabled
+systemd-journald-audit.socket enabled enabled
+systemd-mountfsd.socket enabled enabled
systemd-networkd.socket enabled disabled
+systemd-nsresourced.socket enabled enabled
systemd-userdbd.socket enabled enabled
+machines.target enabled enabled
+reboot.target enabled enabled
+remote-cryptsetup.target enabled enabled
remote-fs.target enabled enabled
fstrim.timer enabled disabled
-10 unit files listed.
+22 unit files listed.
Probably no big deal.. but I just found it surprising that we end up with slightly different behavior between the images. Any thoughts?