#1153356 checkrestart: index out of range for podman conmon cgroup under machine.slice

#1153356#5
Date:
2026-11-07 17:38:16 UTC
From:
To:
Dear Maintainer,

Running checkrestart as root fails with:

Traceback (most recent call last):
  File "/usr/sbin/checkrestart", line 1292, in <module>
    main()
  File "/usr/sbin/checkrestart", line 383, in main
    u=SystemdUnit(unit)
  File "/usr/sbin/checkrestart", line 1186, in __init__
    self.unit_slice=self.cgroup_path[4]
IndexError: list index out of range


The machine runs Podman containers. By instrumenting
SystemdUnit.__init__ in memory and rerunning checkrestart, I confirmed
that the failing cgroup is of the following form (IDs redacted):

0::/machine.slice/machine-libpod_pod_PODID.slice/libpod-conmon-CONTAINERID.scope

This belongs to a Podman conmon process.

SystemdUnit splits this string on "/", producing four elements.
The machine.slice branch then unconditionally accesses element [4],
apparently assuming a deeper hierarchy such as:

0::/machine.slice/machine-NAME.scope/payload/system.slice/example.service

A minimal reproduction using the installed script is:

python3 - <<'EOF'
import runpy
m = runpy.run_path("/usr/sbin/checkrestart", run_name="checkrestart_test")
m["SystemdUnit"](
    "0::/machine.slice/machine-libpod_pod_TEST.slice/"
    "libpod-conmon-TEST.scope"
)
EOF

Expected result:
checkrestart handles this cgroup layout without crashing, or reports
that it cannot determine a restart command and continues checking
other processes.

Actual result:
An uncaught IndexError aborts the check.

The same indexing logic was also present in upstream master when
checked.

Best regards,
Kai