get_services: enabled is always False — list-unit-files prints a PRESET column #6

Closed
opened 2026-10-04 22:39:08 +00:00 by christianmanivong · 0 comments
Owner

What happens

On every Proxmox host netOrk polls, get_services() reports enabled: false for every service. On the test server (172.22.8.50) that is all four PVE hosts (pve-01, pve-02, pve-dual, pve-garden), about 280 services each, enabled true for none of them.

Why

get_services() in napalm_proxmox/system_mixin.py (at the pinned ccb9585, lines 365–374) splits each systemctl list-unit-files --type=service --no-legend line with line.strip().split(None, 1) and compares the remainder with ("enabled", "enabled-runtime", "static").

Since systemd 245 the command prints two columns after the unit name, STATE and PRESET:

ssh.service            enabled  enabled
pveproxy.service       enabled  enabled

The remainder is therefore "enabled enabled", which never equals "enabled".

Fix

Take the first token of the remainder (line.split()[1]) instead of all of it. A test with real list-unit-files output that includes the PRESET column would have caught this.

Effect in netOrk

  • The device Services tab shows every Proxmox service as Disabled.
  • Since netork#49, a system service becomes a ServiceInstance if it runs or starts at boot. On Proxmox only running services qualify for now, so an enabled service that has crashed is missed.

pid is also always 0 (hard-coded); netOrk copes with that.

## What happens On every Proxmox host netOrk polls, `get_services()` reports `enabled: false` for every service. On the test server (172.22.8.50) that is all four PVE hosts (pve-01, pve-02, pve-dual, pve-garden), about 280 services each, `enabled` true for none of them. ## Why `get_services()` in `napalm_proxmox/system_mixin.py` (at the pinned `ccb9585`, lines 365–374) splits each `systemctl list-unit-files --type=service --no-legend` line with `line.strip().split(None, 1)` and compares the remainder with `("enabled", "enabled-runtime", "static")`. Since systemd 245 the command prints two columns after the unit name, STATE and PRESET: ``` ssh.service enabled enabled pveproxy.service enabled enabled ``` The remainder is therefore `"enabled enabled"`, which never equals `"enabled"`. ## Fix Take the first token of the remainder (`line.split()[1]`) instead of all of it. A test with real `list-unit-files` output that includes the PRESET column would have caught this. ## Effect in netOrk - The device Services tab shows every Proxmox service as *Disabled*. - Since netork#49, a system service becomes a ServiceInstance if it runs or starts at boot. On Proxmox only running services qualify for now, so an enabled service that has crashed is missed. `pid` is also always `0` (hard-coded); netOrk copes with that.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-proxmox#6