Skip to content

ci: postinstall service restart - #444

Draft
depate wants to merge 1 commit into
mainfrom
fix/postinstall_restart
Draft

depate wants to merge 1 commit into
mainfrom
fix/postinstall_restart

Conversation

@depate

@depate depate commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

AI disclosure

This patch and the last section of the commit/PR message were co-authored by Claude Code Opus 5.5, after human analysis of the cause and has been reviewed by me to the best of my knowledge.

I could not test the patch. If merged, we can check retrospectively, if the next release will trigger a service restart after package upgrade. Mitigating an (unexpected) version mismatch.

Restart dutagent on package upgrade

The postinstall script reloads systemd but does not restart a running dutagent.service. After an upgrade the old binary keeps running, and clients see a version mismatch (dutctl client 1.0.0-beta.1 is newer than dutagent 1.0.0-alpha.2) until someone restarts it by hand.

This change runs systemctl try-restart dutagent.service on upgrade, which matches what debhelper's dh_installsystemd does by default:

  • try-restart restarts the service only if it is running. A stopped or disabled dutagent service is unaffected.
  • A fresh install does not start the agent, so an install with no config yet is not affected.
  • The script skips this on systems without systemd, such as containers and chroots.

Note: an upgrade now drops active dutctl sessions on that agent.

@depate
depate requested a review from AtomicFS November 6, 2026 15:43

@AtomicFS AtomicFS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On upgrade, dpkg calls postinst with "configure "

Not sure if this is correct, but this LGTM

Comment thread packaging/postinstall.sh

if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload || true
if [ -d /run/systemd/system ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not completely sold on this IF statement change though.

@depate
depate marked this pull request as draft November 6, 2026 16:06
Restart dutagent on package upgrade

The postinstall script reloads systemd but does not restart a running dutagent.service. After an
upgrade the old binary keeps running, and clients see a version mismatch (dutctl client
1.0.0-beta.1 is newer than dutagent 1.0.0-alpha.2) until someone restarts it by hand.

This change runs systemctl try-restart dutagent.service on upgrade, which matches what debhelper's
dh_installsystemd does by default:
- try-restart restarts the service only if it is running. A stopped or disabled agent stays that
  way.
- A fresh install does not start the agent, so an install with no config yet is not affected.
- The script skips this on systems without systemd, such as containers and chroots.

Note: an upgrade now drops active dutctl sessions on that agent.

Signed-off-by: Patrik Tesarik <patrik.tesarik@9elements.com>
@depate
depate force-pushed the fix/postinstall_restart branch from c4434d4 to eb38b2c Compare November 6, 2026 16:07
@depate depate changed the title fix: postinstall service restart ci: postinstall service restart Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants