fix(pxe): report dnsmasq as running when it drops to nobody #201

Merged
kblack0610 merged 1 commit from fix/pxe-status-process-check into master 2026-08-24 18:39:05 +00:00
Owner

process_running() used kill -0, which returns EPERM for a process owned by another user. dnsmasq drops privileges to nobody after binding its sockets, so an unprivileged caller saw a live server as dead.

Found while recovering the thinkcentre: ./pxe-server.sh status reported dnsmasq (TFTP+DHCP): stopped while ports 67 and 69 were bound and TFTP was serving uefi/ipxe.efi correctly. That sent the debugging in the wrong direction.

Three call sites were affected:

  • pxe-server.sh status printed a healthy server as stopped
  • start_dnsmasqs already-running guard fell through, so a second start would launch a duplicate dnsmasq
  • collectors/pxe.sh reported status down to infra-dash

Tests /proc/<pid> instead, which needs no signal permission, and validates the PID file is non-empty and numeric. collectors/pxe.sh now sources the shared helper instead of carrying its own copy of the check.

Verification

Against the live server (dnsmasq PID 997301, nobody-owned):

  • pxe-server.sh status -> dnsmasq (TFTP+DHCP): running (PID: 997301)
  • collectors/pxe.sh -> "status": "up", "dnsmasq": true
  • TFTP fetch of uefi/ipxe.efi returns a byte-identical file (md5 ec084306769f659022fcbaa2e836751d)

Negative controls, so the check can still return false: dead PID, garbage PID, empty file, and missing file all report not-running; a live PID reports running.

`process_running()` used `kill -0`, which returns EPERM for a process owned by another user. dnsmasq drops privileges to `nobody` after binding its sockets, so an unprivileged caller saw a live server as dead. Found while recovering the thinkcentre: `./pxe-server.sh status` reported `dnsmasq (TFTP+DHCP): stopped` while ports 67 and 69 were bound and TFTP was serving `uefi/ipxe.efi` correctly. That sent the debugging in the wrong direction. Three call sites were affected: - `pxe-server.sh status` printed a healthy server as stopped - `start_dnsmasq`s already-running guard fell through, so a second `start` would launch a duplicate dnsmasq - `collectors/pxe.sh` reported status `down` to infra-dash Tests `/proc/<pid>` instead, which needs no signal permission, and validates the PID file is non-empty and numeric. `collectors/pxe.sh` now sources the shared helper instead of carrying its own copy of the check. ## Verification Against the live server (dnsmasq PID 997301, nobody-owned): - `pxe-server.sh status` -> `dnsmasq (TFTP+DHCP): running (PID: 997301)` - `collectors/pxe.sh` -> `"status": "up", "dnsmasq": true` - TFTP fetch of `uefi/ipxe.efi` returns a byte-identical file (md5 `ec084306769f659022fcbaa2e836751d`) Negative controls, so the check can still return false: dead PID, garbage PID, empty file, and missing file all report not-running; a live PID reports running.
fix(pxe): report dnsmasq as running when it drops to nobody
All checks were successful
checks / fleet-roster (pull_request) Successful in 6s
checks / kustomize-builds (pull_request) Successful in 6s
0b7d17595a
process_running() used `kill -0`, which returns EPERM for a process owned
by another user. dnsmasq drops privileges to `nobody` after binding its
sockets, so an unprivileged caller saw a live server as dead:

- `pxe-server.sh status` printed "dnsmasq (TFTP+DHCP): stopped" while
  ports 67 and 69 were bound and TFTP was serving uefi/ipxe.efi
- start_dnsmasq's already-running guard fell through, so a second
  `start` would launch a duplicate dnsmasq
- collectors/pxe.sh reported status "down" to infra-dash

Test /proc/<pid> instead, which needs no signal permission, and validate
the PID file is non-empty and numeric. collectors/pxe.sh now sources the
shared helper rather than carrying its own copy of the check.

Verified against the live server: status and the collector both report
running for PID 997301 (nobody-owned); dead, empty, garbage and missing
PID files all still report not-running.
kblack0610 deleted branch fix/pxe-status-process-check 2026-08-24 18:39:05 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kblack0610/home-config!201
No description provided.