host_status: Ubuntu hosts always read as busy, so an interrupted dpkg is never reported #26

Closed
opened 2026-10-08 14:52:41 +00:00 by christianmanivong · 0 comments
Owner

Prio: P1 (critical): it makes the main case of NetOrk/netork#738 undetectable.

What happens

On every Ubuntu host with unattended-upgrades installed, get_host_status() reports package_manager_interrupted: None ("a package manager is running") on every poll. Seen on 172.22.8.50 right after deploying 4.3.0: ansible-01, bw-01, db-01, db-02 and netork all read None, while pve-01 (no unattended-upgrades) reads False and pve-dual reads True.

Why

The busy check in HOST_STATUS_COMMAND (4.3.0) matched the process names dpkg|apt|apt-get|aptitude|unattended-upgr. Ubuntu keeps /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal running all the time. Its name is cut to 15 characters, unattended-upgr, the same as a real unattended-upgrade run's. So the host always looks busy, and an interrupted dpkg is never reported, on the very kind of host #738 was about (aris).

Fix

Match dpkg/apt/apt-get/aptitude by name and unattended-upgrade by its command line ((^|[ /])unattended-upgrade( |$)), as BUSY_CHECK. Tests run the fragment through sh with a stand-in ps (idle Ubuntu, a real run, dpkg/apt), and check that the command does not match itself: over an exec channel it is the command line of the shell that runs it.

Prio: P1 (critical): it makes the main case of NetOrk/netork#738 undetectable. ## What happens On every Ubuntu host with unattended-upgrades installed, `get_host_status()` reports `package_manager_interrupted: None` ("a package manager is running") on every poll. Seen on 172.22.8.50 right after deploying 4.3.0: ansible-01, bw-01, db-01, db-02 and netork all read None, while pve-01 (no unattended-upgrades) reads False and pve-dual reads True. ## Why The busy check in `HOST_STATUS_COMMAND` (4.3.0) matched the process names `dpkg|apt|apt-get|aptitude|unattended-upgr`. Ubuntu keeps `/usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal` running all the time. Its name is cut to 15 characters, `unattended-upgr`, the same as a real unattended-upgrade run's. So the host always looks busy, and an interrupted dpkg is never reported, on the very kind of host #738 was about (aris). ## Fix Match dpkg/apt/apt-get/aptitude by name and unattended-upgrade by its command line (`(^|[ /])unattended-upgrade( |$)`), as `BUSY_CHECK`. Tests run the fragment through `sh` with a stand-in `ps` (idle Ubuntu, a real run, dpkg/apt), and check that the command does not match itself: over an exec channel it is the command line of the shell that runs it.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-device-types#26