Commit Graph

1 Commits

Author SHA1 Message Date
Martin Renvoize 606fc6bcd6
Bug 40901: (QA follow-up) Fix the koha-systemd migration, upgrade and removal paths
First install (migration from the SysV layout):

- The postinst ran daemon-reload before stopping koha-common.service, so
  the name already resolved to the new native unit and the stop was a
  no-op; the daemon(1)-supervised starman/zebrasrv/workers survived and
  kept plack.sock and the Zebra sockets. The init script itself is gone
  by then (koha-common's rm_conffile) and the koha-* helpers already
  dispatch to systemd, so neither can be used either. Kill the legacy
  koha-common.service cgroup (the generated unit has KillMode=process,
  a plain stop leaves the supervisors alive), sweep remaining pid files,
  and wait for them to exit, all before daemon-reload.
- Nothing ever started the new units, and koha-common.service was never
  enabled, so a migrated host came back with every instance stopped and
  "systemctl restart koha-common" doing nothing. Enable both koha.target
  and koha-common.service and start them through deb-systemd-invoke.
- koha-plack@ was enabled for every instance including CGI-only ones,
  and koha-indexer@ regardless of USE_INDEXER_DAEMON. Use
  "koha-list --enabled --plack" and /etc/default/koha-common like the
  init script did.
- Drop the "systemctl disable koha-common.service" that targeted our
  own compat unit.

Upgrade: deb-systemd-invoke takes unit names, not glob patterns, so
enumerate the active koha-*@*.service units before try-restarting them.

Removal: the prerm only did a daemon-reload, leaving every daemon
running with its unit file deleted, so swapping to koha-sysv started a
second copy of each. Stop koha-common.service and koha.target on
remove; a new postrm removes the enablement symlinks on purge and
reloads the manager.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:02:34 +00:00