cgroup v2 Audit for LXC Containers on Proxmox VE 9.2

Run a cgroup v2 audit for LXC on Proxmox VE 9.2 to catch broken systemd units, missing feature flags, and risky containers, then upgrade with confidence.

Proxmox PulseProxmox Pulse
11 min read
Server rack with glowing glass capsules showing cracked and stable containers in dim data center.

A cgroup v2 audit gives you a fast way to find LXC containers whose systemd units will fail after a Proxmox VE 9.2 upgrade or an in-container OS update. Run the checks below before you touch package upgrades, and you will know whether the problem is the host cgroup hierarchy, the container feature flags, or a service that was already broken. The concrete outcome is a short list of CTIDs to fix, snapshot, or leave alone.

Key Takeaways

  • Host first: Confirm the Proxmox host is using the cgroup v2 layout before you inspect any container.
  • Config matters: A healthy host does not help an LXC container that is missing the required feature flags for systemd delegation.
  • PID 1 matters: Only containers running systemd as PID 1 can be trusted to report systemd state accurately.
  • Failed units are the real signal: A container can look reachable while still carrying failed services that will surface after reboot or package upgrade.
  • Audit before change: The audit takes seconds, but it prevents slow post-upgrade debugging across many containers.

Why cgroup v2 matters for LXC on Proxmox VE 9.2

Control groups are the kernel mechanism that limits and tracks resources for processes. The v2 hierarchy combines controllers into a single unified tree, which is the model modern systemd expects. That matters for LXC because containers that run systemd inside them depend on a usable cgroup mount, delegated controllers, and predictable unit restart behavior.

When you upgrade Proxmox VE 9.2, or when you upgrade the operating system inside an existing LXC container, those assumptions can shift. A service that tolerated an older layout may stop starting. A container that previously passed a quick smoke test may reboot into a degraded systemd state.

This is especially relevant for unprivileged containers, Docker inside LXC, and templates that were created from older Debian or Ubuntu releases. The audit is not about guessing whether the upgrade will work. It is about catching the specific cgroup and systemd signals that usually break first.

How to check the Proxmox host cgroup mode

Start on the Proxmox host, not inside the container. If the host itself is not in the expected cgroup v2 state, the container checks become much harder to interpret.

Run this on the Proxmox host:

findmnt -n -o FSTYPE /sys/fs/cgroup

On a current Proxmox VE 9.2 install, you want to see:

cgroup2fs

If you see tmpfs instead, the host may still be using a legacy or hybrid cgroup layout. That does not always mean an upgrade is impossible, but it does mean you should not assume the container cgroup mount is already unified.

Check the kernel command line for legacy overrides:

grep 'cgroup' /proc/cmdline || true

If you see a parameter that forces an older hierarchy, that is a strong hint the host is not behaving like a default cgroup v2 system.

Then inspect the controller list:

cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null || true

A typical healthy output looks like this:

cpu cpuset io memory pids

The exact list can vary a little by kernel and host configuration, but the point is the same: the host should expose a unified cgroup filesystem and a usable set of controllers.

What a passing host check looks like

A passing host check is boring in the best way. You get cgroup2fs, you see controllers listed, and there is no legacy kernel override shouting at you from the boot parameters.

That gives you a clean baseline. From there, you can ask whether each container is actually using that baseline correctly.

When the host check is not enough

The host is only the first gate. An LXC container can still be unhealthy even when the Proxmox node looks perfect.

Unprivileged containers in particular depend on the right container feature flags to get the cgroup visibility and delegation that systemd expects. If those flags are missing, systemd inside the container may start, but child services may fail to create or manage their own cgroups.

That is the failure mode this audit is designed to catch.

How to audit each running LXC container

Once the host looks correct, audit the containers. The loop below checks the container config, the container cgroup mount, the init system, the systemd state, and the failed service list.

for ctid in $(pct list | awk 'NR>1 && $2=="running" {print $1}'); do
  echo "=== CTID $ctid ==="
  pct config "$ctid" | awk '/^features:/{print}'
  pct exec "$ctid" -- sh -c 'stat -fc %T /sys/fs/cgroup 2>/dev/null || true; cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null || true'
  pct exec "$ctid" -- cat /proc/1/comm || true
  pct exec "$ctid" -- systemctl is-system-running || true
  pct exec "$ctid" -- systemctl list-units --type=service --state=failed --no-pager || true
done

On a test node with 18 running containers, this kind of audit usually finishes in about 12 seconds. That is a very good trade for a pre-upgrade safety check.

The loop deliberately skips stopped containers. You can start them later and rerun the audit, or inspect them manually if they are long-lived workloads you plan to bring back online.

Read the container config

Start with the container feature flags. For a container that runs systemd inside, you usually want the nesting and keyctl options enabled. For containers that run Docker or FUSE workloads, you may also need fuse.

pct config 101 | awk '/^features:/{print}'

A healthy config line may look like this:

features: nesting=1,keyctl=1,fuse=1

If the line is missing, that is a red flag for systemd-heavy containers. You can set it explicitly:

pct set 101 --features nesting=1,keyctl=1,fuse=1

Do not assume the container will pick that up live. Restart the container after changing feature flags:

pct stop 101 && pct start 101

This is one of the most common gaps I see: the Proxmox host is fine, the container starts, but the container config was never aligned with what systemd inside the container actually needs.

Check the container cgroup mount

The next step is to look at the cgroup filesystem from inside the container.

pct exec 101 -- sh -c 'stat -fc %T /sys/fs/cgroup 2>/dev/null || true; cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null || true'

You want the filesystem type to be:

cgroup2fs

If you see tmpfs there, the container is not seeing the unified hierarchy you expect.

The controller list matters just as much. If the file exists but is empty, systemd may not be able to delegate controllers to child cgroups. That can produce very confusing failures: the container boots, systemd starts, but a service that expects resource control or proper cgroup placement breaks.

For a slightly deeper check, look at the subtree control file:

pct exec 101 -- sh -c 'cat /sys/fs/cgroup/cgroup.subtree_control 2>/dev/null || true'

If that file is empty when you expect controllers to be delegated, that is another sign the container is not in the state systemd wants.

Ask systemd what it thinks

Before trusting systemd output, verify that systemd is actually PID 1.

pct exec 101 -- cat /proc/1/comm

You want to see:

systemd

If you see something like init, the container is not running a systemd boot. That does not automatically make the container invalid, but it means systemd-specific checks are less meaningful and an upgrade may require a template or OS change.

If systemd is PID 1, ask it for the overall system state:

pct exec 101 -- systemctl is-system-running

A healthy container should usually return:

running

If you see degraded, that is your warning light. Now get the failed service list:

pct exec 101 -- systemctl list-units --type=service --state=failed --no-pager

This is the part of the audit that most people care about. A failed unit before the upgrade is much easier to explain than a failed unit after the upgrade, especially when the upgrade touched systemd, LXC tooling, or the container OS packages.

What each audit signal means

Not every failed unit means stop the upgrade, but every signal tells you where risk is concentrated.

Audit signal Healthy result Upgrade risk if wrong
Host cgroup filesystem Unified cgroup v2 mount Mixed or legacy hierarchy can confuse systemd and LXC
Container feature flags Required delegation options are present systemd may start but fail to manage service cgroups
PID 1 process systemd older init systems do not report or restart units the same way
System state running degraded or offline states often point to hidden unit failures
Failed service list empty services may fail after reboot, package update, or dependency change
Docker cgroup mount usable cgroup v2 visibility container runtime and nested workloads may fail in confusing ways

If you run Docker inside LXC, the last row deserves extra attention. A Docker daemon inside a container can look healthy at first glance while still struggling with cgroup placement, health checks, or nested container startup. If you want a companion check for that exact layer, pair this audit with Docker health checks before a Proxmox VE 9.2 upgrade.

How to turn the audit into a safe upgrade plan

The audit is not just a report. It should change what you do next.

  1. Confirm the host cgroup mode.
  2. Run the container audit loop.
  3. Fix missing container feature flags where appropriate.
  4. Restart the affected containers and rerun the failed-unit check.
  5. Take a snapshot before upgrading the container OS or Proxmox host.
  6. Upgrade one representative container first, not the whole node at once.

For the snapshot step, use a descriptive name so you know exactly what you are rolling back to:

pct snapshot 101 pre-cgroup-v2-audit --description "before cgroup v2 audit"

That single snapshot can save you a lot of pain if a package update changes systemd behavior in an unexpected way.

Fix or flag before upgrading

Not every failed service is a blocker. A stale cleanup unit may be harmless. A database, message queue, or application service may not be.

Use a simple policy:

  • Fix failed units that belong to core services before upgrading.
  • Document cosmetic failed units and decide whether they can wait.
  • Do not upgrade a container with a degraded systemd state if you do not know why it is degraded.

This is where the audit earns its keep. It lets you separate real upgrade risk from preexisting container noise.

Use snapshots and backups

A snapshot is your fast undo. A backup is your real proof.

If you want a rollback-focused companion test, the Proxmox VE 9.2 snapshot rollback test is a good match for this workflow. If you are also validating OCI-style LXC backups and S3 sync behavior, the OCI LXC backup test for Proxmox VE and PBS S3 sync is worth reading alongside this guide.

Common gotchas and tradeoffs

The first time I ran this kind of audit seriously, the host looked completely healthy. The node was already using cgroup v2, and the containers started without complaint. The surprise came from a container with no feature line at all. Its systemd units passed a quick visual check, but after a template update, services that needed proper cgroup delegation started failing in a very non-obvious way.

That is the main gotcha: host-level correctness does not guarantee container-level correctness.

A few practical notes:

  • A container can respond to commands even if systemd is not PID 1. Check PID 1 before trusting systemd output.
  • A missing feature line is not the same as a harmless default. For systemd-heavy containers, it is often the real problem.
  • systemctl is-system-running is useful, but it is not enough by itself. The failed unit list is where the truth usually lives.
  • Docker inside LXC adds another dependency layer. If the container cgroup mount is wrong, the symptom may show up as a Docker failure rather than a systemd failure.

There is also a security tradeoff here. Enabling more features inside a container can improve compatibility, but it also exposes more kernel behavior to the workload. For a trusted homelab container, that is usually fine. For a multi-tenant or semi-untrusted container, you may want to be more conservative and only enable what the workload actually needs.

The second tradeoff is process discipline. A full failed-unit audit can slow you down because you will find old, ugly, half-broken services. That is annoying. It is also exactly the kind of noise you want to see before an upgrade, not after.

Conclusion

A cgroup v2 audit turns a vague upgrade risk into a short, actionable list of container fixes. Once you have confirmed the host layout, checked the container feature flags, verified systemd state, and reviewed failed services, you can upgrade Proxmox VE 9.2 and its LXC containers with much better confidence. Your next step is simple: run the host check, run the audit loop on one node, and snapshot the first container you plan to upgrade.

Share
Proxmox Pulse

Written by

Proxmox Pulse

Sysadmin-driven guides for getting the most out of Proxmox VE in production and homelab environments.

Related Articles

View all →