Skip to content

Archlinux presets

Trey Blancher requested to merge ectospasm/systemd:archlinux-presets into main

After issue#24 was closed, I opened the Arch and systemd presets topic on the forums. I think I tried to explain myself several times in this topic, but here is the summary:

  • in systemd 215, presets were added (systemctl preset-all was introduced)
  • Arch Linux does not currently use presets properly (the enablement of the three default systemd units in Arch appears to predate presets)
    • the three default units in Arch:
  • systemd ships with 90-systemd.preset, which indicates several units/services enabled by preset, but which do not get enabled by default in Arch
    • this leads to confusion, as there are several services (e.g., systemd-timesyncd.service) which are enabled by preset because of 90-systemd.preset, but which are still disabled by default in Arch
  • my proposal in this MR is simply to change the way the default units are enabled by adding a 80-archlinux.preset file; which will enable the default units by preset instead of explicit systemctl enable commands in systemd.install
    • it does this with systemctl preset-all in post_install() of systemd.install (80-archlinux.preset enables the default units, and disables everything else; it is generated in the package_systemd() function in the modified PKGBUILD)
  • this way, anything not enabled by preset will remain disabled by default
    • and will show preset: disabled if NOT enabled by default (in systemctl status <unit>)
  • system administrators are still free to set their own presets, and can override my proposed 80-archlinux.preset
  • this should also not break any existing installations, as systemctl preset-all only gets called in post_install(), which to my knowledge only gets called when systemd is installed for the first time (i.e., in pacstrap)
    • thus this would mostly only affect new installations
    • though the 80-archlinux.preset file will fix the problem of things enabled by preset but still disabled by default
    • anything explicitly enabled outside of presets will remain enabled (running systemctl preset-all should disable everything but the default units if an overriding preset file isn't created first)
  • I have tested this in a virtual machine, and it appears to work
    • I have not executed this with a systemd upgrade, as there isn't a newer version currently that I'm aware of

I do believe strongly that this is a good idea, as it reflects the intention of systemd upstream (see systemd.preset(5) for a complete discussion).

Merge request reports