OpenWrt: which services still run replaced code after an opkg/apk upgrade, or none #51

Open
opened 2026-11-26 17:55:46 +00:00 by christianmanivong · 0 comments
Owner

NetOrk/netork#2750 decided the OpenWrt driver carries no get_services_need_restart for now, so netOrk shows the reading as not made rather than clean.

The generic reading (napalm-device-types' ServicesRestartMixin) would run on OpenWrt: busybox has grep -E and sed, /proc/<pid>/maps and /proc/<pid>/cgroup exist, and the cgroup names the procd service (/services/<name>/<instance>), as for the listening sockets. But its clean answer would not hold:

  • A package upgrade writes the new files to the overlay while the old ones stay in the read-only image (/rom, squashfs). The old library a daemon still maps is not deleted: it is still there in the lower layer.
  • Before Linux 6.8 (OpenWrt 23.05 runs 5.15, 24.10 runs 6.6) /proc/<pid>/maps names an overlay file by its real path: /rom/usr/lib/... for one from the image, /overlay/upper/usr/lib/... (deleted) for one an earlier upgrade wrote and the next one replaced. DELETED_CODE_PATTERN matches neither, so the scan would read clean exactly after an upgrade.
  • From 6.8 on the overlay path is shown, and a replaced file may show as (deleted); that has to be checked on a device.

An OpenWrt reading of its own could count a mapping of /rom/<path> whose /overlay/upper/<path> now exists, and a (deleted) mapping under /overlay/upper/, plus the generic pattern for 6.8 and later. It needs output recorded on a 23.05 and a 24.10 device before it may answer "nothing to restart". sysupgrade (start_firmware_upgrade) reboots, so this matters only for package upgrades between firmware upgrades.

NetOrk/netork#2750 decided the OpenWrt driver carries no `get_services_need_restart` for now, so netOrk shows the reading as not made rather than clean. The generic reading (napalm-device-types' `ServicesRestartMixin`) would run on OpenWrt: busybox has `grep -E` and `sed`, `/proc/<pid>/maps` and `/proc/<pid>/cgroup` exist, and the cgroup names the procd service (`/services/<name>/<instance>`), as for the listening sockets. But its clean answer would not hold: - A package upgrade writes the new files to the overlay while the old ones stay in the read-only image (`/rom`, squashfs). The old library a daemon still maps is not deleted: it is still there in the lower layer. - Before Linux 6.8 (OpenWrt 23.05 runs 5.15, 24.10 runs 6.6) `/proc/<pid>/maps` names an overlay file by its real path: `/rom/usr/lib/...` for one from the image, `/overlay/upper/usr/lib/... (deleted)` for one an earlier upgrade wrote and the next one replaced. `DELETED_CODE_PATTERN` matches neither, so the scan would read clean exactly after an upgrade. - From 6.8 on the overlay path is shown, and a replaced file may show as `(deleted)`; that has to be checked on a device. An OpenWrt reading of its own could count a mapping of `/rom/<path>` whose `/overlay/upper/<path>` now exists, and a `(deleted)` mapping under `/overlay/upper/`, plus the generic pattern for 6.8 and later. It needs output recorded on a 23.05 and a 24.10 device before it may answer "nothing to restart". `sysupgrade` (`start_firmware_upgrade`) reboots, so this matters only for package upgrades between firmware upgrades.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-openwrt#51