fix: tell unattended-upgrade from Ubuntu's idle shutdown helper #27

Merged
christianmanivong merged 1 commits from fix/unattended-upgrade-shutdown into main 2026-10-08 15:33:26 +00:00
Owner

Closes #26. Follow-up to #25 (NetOrk/netork#738).

On every Ubuntu host with unattended-upgrades, get_host_status() read the package manager as busy, so an interrupted dpkg was never reported there. Seen on netOrk's test server right after 4.3.0 went live: five Ubuntu hosts read None, while the Proxmox hosts read False and True.

The cause is that Ubuntu keeps unattended-upgrade-shutdown --wait-for-signal running all the time. Its process name is cut to 15 characters, unattended-upgr, the same as a real run's.

BUSY_CHECK now matches dpkg, apt, apt-get and aptitude by name, and unattended-upgrade by its command line ((^|[ /])unattended-upgrade( |$)). Version 4.3.1.

Tests

  • The fragment runs through sh with a stand-in ps. The cases are an idle Ubuntu host, a real unattended-upgrade run, and dpkg/apt/apt-get/aptitude.
  • The command must not match itself. Over an exec channel (Proxmox, BSD), it is the command line of the shell that runs it.
  • 489 tests pass; napalm-linux and napalm-proxmox pass against this branch.
Closes #26. Follow-up to #25 (NetOrk/netork#738). On every Ubuntu host with unattended-upgrades, `get_host_status()` read the package manager as busy, so an interrupted dpkg was never reported there. Seen on netOrk's test server right after 4.3.0 went live: five Ubuntu hosts read None, while the Proxmox hosts read False and True. The cause is that Ubuntu keeps `unattended-upgrade-shutdown --wait-for-signal` running all the time. Its process name is cut to 15 characters, `unattended-upgr`, the same as a real run's. `BUSY_CHECK` now matches dpkg, apt, apt-get and aptitude by name, and unattended-upgrade by its command line (`(^|[ /])unattended-upgrade( |$)`). Version 4.3.1. ## Tests - The fragment runs through `sh` with a stand-in `ps`. The cases are an idle Ubuntu host, a real unattended-upgrade run, and dpkg/apt/apt-get/aptitude. - The command must not match itself. Over an exec channel (Proxmox, BSD), it is the command line of the shell that runs it. - 489 tests pass; napalm-linux and napalm-proxmox pass against this branch.
christianmanivong added 1 commit 2026-10-08 15:30:54 +00:00
fix: tell unattended-upgrade from Ubuntu's idle shutdown helper
CI / test (3.10) (push) Successful in 24s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 24s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 25s
7aa731ad34
On every Ubuntu host with unattended-upgrades, get_host_status() read the
package manager as busy, so an interrupted dpkg was never reported there.
Ubuntu keeps unattended-upgrade-shutdown --wait-for-signal running all the
time; its process name is cut to 15 characters, unattended-upgr, the same
as a real run's.

BUSY_CHECK now matches dpkg, apt, apt-get and aptitude by name and
unattended-upgrade by its command line. The tests run it through sh with a
stand-in ps, and check that the command does not match itself: over an exec
channel it is the command line of the shell that runs it.

Closes #26
christianmanivong merged commit ff6dbe0206 into main 2026-10-08 15:33:26 +00:00
christianmanivong deleted branch fix/unattended-upgrade-shutdown 2026-10-08 15:33:26 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-device-types#27