#41871·systemd

cgroup corruption when Delegate=yes + MemoryMax on failing service

Author: IzgipCreated Apr 29, 2026Updated Sep 29, 2026
Labelsbug 🐛pid1needs-reporter-feedback ❓

systemd version the issue has been seen with

255.4-1ubuntu8.4

Used distribution

Ubuntu 24.04.4 LTS

Linux kernel version used

Kernel 6.8.0-55-generic

CPU architectures issue was seen on

x86_64

Component

systemd

Expected behaviour you didn't see

Expected behavior (what SHOULD have happened - but DID NOT)

1. Service failure should NOT break the system

Expected: $ systemctl start test-cgroup-bug.service Job for test-cgroup-bug.service failed. See "systemctl status test-cgroup-bug.service" for details.

Actual: $ systemctl start test-cgroup-bug.service Job for test-cgroup-bug.service failed with status=219/CGROUP. Entire system became unstable. SSH frozen. HTTP dead.

2. Cgroup should be cleaned up on failure

Expected: $ ls /sys/fs/cgroup/system.slice/test-cgroup-bug.service/ ls: cannot access '/sys/fs/cgroup/system.slice/test-cgroup-bug.service/': No such file or directory

Actual: $ ls /sys/fs/cgroup/system.slice/test-cgroup-bug.service/ cgroup.procs memory.max cpu.max memory.current cpu.weight

The cgroup directory PERSISTED with corrupted state

3. Reboot should clear ALL cgroup state

Expected: reboot[afterreboot] systemctl status ssh ● ssh.service - OpenBSD Secure Shell server Loaded: loaded Active: active (running)

Everything works normally

Actual: $ reboot [ after reboot - system never comes back ]

SSH: Connection freezes

Console: Black screen

Rescue mode: Also black screen

4. SSH should work after reboot

Expected: $ ssh root@server root@server:~#

Actual: $ ssh root@server [ connects but FREEZES immediately ] PTY allocation request failed on channel 0 [ no shell, no output, must kill SSH client ]

5. Rescue/emergency mode should always work

Expected: [ GRUB → Advanced options → Recovery mode → root ] root@rescue:~#

Actual: [ GRUB → Advanced options → Recovery mode ] [ Kernel loads, then system HANGS ] [ BLACK SCREEN - no rescue shell ]

6. HTTP services should continue running

Expected: $ curl http://server/

OK ``` Actual:

$ curl http://server curl: (28) Connection timed out after 120000 ms 7. Resource limits should be released on service failure

Expected:

MemoryMax=512M and CPUQuota=50% are RELEASED Other services unaffected Actual:

MemoryMax=512M and CPUQuota=50% remain LOCKED in corrupted cgroup Affects ENTIRE SYSTEM resource management 8. System should be recoverable without provider intervention

Expected:

$ reboot $ ssh root@server root@server:# systemctl disable test-cgroup-bug.service root@server:# rm /etc/systemd/system/test-cgroup-bug.service

Fixed in 5 minutes

Actual:

$ reboot [ system dead ] [ SSH dead ] [ Rescue dead ] [ VNC dead ] Required hypervisor-level provider intervention VM effectively BRICKED 9. Systemd should not allow cgroup corruption from a user service

Expected:

User services cannot corrupt systemd's internal cgroup state. Systemd should validate and reject bad configurations safely. Actual:

A single failed user service corrupted the ENTIRE cgroup hierarchy. Systemd accepted Delegate=yes + MemoryMax on a service that exits immediately. No validation, no safety, no cleanup. 10. The failure should be contained

Expected:

Only the failed service is affected. Other services run normally. System remains stable. Actual:

Cgroup corruption spread system-wide. All process management affected. Complete system failure.

Unexpected behaviour you saw

Unexpected behavior (what ACTUALLY happened)

1. Service failed with cgroup error

bash
systemctl start test-cgroup-bug.service
# Job for test-cgroup-bug.service failed
# Status: 219/CGROUP
# This error indicates systemd couldn't apply cgroup settings
2. Cgroup state corrupted SYSTEM-WIDE


# Not just the failed service's cgroup
# The ENTIRE systemd cgroup hierarchy became corrupted
# Other services started failing
# New processes couldn't be created properly
3. SSH became completely unresponsive


ssh root@server
# Connection establishes but FREEZES immediately
# PTY allocation request failed on channel 0
# No shell output, no command execution
# Must kill SSH client with Ctrl+C or kill -9
4. HTTP/Web services died completely


curl http://server
# curl: (28) Connection timed out after 120000 ms
# Nginx/Apache processes stuck
# Cannot accept new connections
# Cannot spawn new worker threads
5. Hard reboot did NOT fix the issue

reboot --force
# System goes down and comes back up
# SSH still frozen after reboot
# HTTP still dead after reboot
# Cgroup state SURVIVED the reboot
6. Rescue/Emergency mode also failed


# Boot from GRUB → Advanced options → Recovery mode
# Kernel loads but then system HANGS completely
# No rescue shell appears
# BLACK SCREEN - no output, no recovery possible
7. Provider's VNC console showed black screen


# Logged into provider's web dashboard
# Launched VNC/Console for the VM
# Screen is completely BLACK
# No BIOS output, no kernel messages, nothing
8. Provider's rescue system also failed


# Provider offers rescue mode (boot from their infrastructure)
# Launched rescue system for this VM
# Same BLACK SCREEN
# Provider could not access the VM either
9. Required hypervisor-level intervention


# Provider had to hard-reset at hypervisor level
# VM was essentially BRICKED
# No standard recovery procedure worked
# Required manual intervention from provider's infrastructure team
10. Data loss risk was real


# Without recent backups, data could have been permanently lost
# Provider had to attach disk to another working VM
# Standard backup/restore procedures all failed
# Recovery took hours instead of minutes
11. Resource limits persisted in corrupted state


# MemoryMax=512M and CPUQuota=50% remained LOCKED
# These limits affected the ENTIRE system
# Even after reboot, limits were still active
# Could not be cleared without provider intervention
12. Other services became unstable


# systemctl status any-service
# Commands hang or timeout
# Cannot start new services
# Cannot stop existing services
# Systemd itself became partially unresponsive

### Steps to reproduce the problem

## Steps to Reproduce

### Prerequisites
- Ubuntu 24.04 LTS (Noble Numbat) or any systemd 255+ with cgroup v2
- Root or sudo access

### Step 1: Create the vulnerable service file

cat > /etc/systemd/system/test-cgroup-bug.service << 'EOF' [Unit] Description=Test cgroup delegation bug

[Service] Type=oneshot ExecStart=/bin/false Delegate=yes MemoryMax=512M CPUQuota=50%

[Install] WantedBy=multi-user.target EOF Step 2: Reload systemd

systemctl daemon-reload Step 3: Attempt to start the service

systemctl start test-cgroup-bug.service Step 4: Observe the failure

Expected output:

Job for test-cgroup-bug.service failed

Status: 219/CGROUP

Step 5: Check cgroup state (still present)

ls /sys/fs/cgroup/system.slice/test-cgroup-bug.service/

The cgroup directory still exists with corrupted state

Step 6: Attempt to reboot

reboot Step 7: After reboot, observe system is dead

ssh root@server

SSH connects but FREEZES

PTY allocation request failed

No shell access

Step 8: Try rescue mode

Boot from GRUB → Advanced options → Recovery mode

Kernel loads then HANGS

BLACK SCREEN - no rescue shell

Step 9: Provider intervention required

Even provider's rescue system fails

VNC console shows black screen

Requires hypervisor-level intervention

Additional Notes

The bug triggers with Delegate=yes + any resource limit (MemoryMax, CPUQuota, MemoryHigh, etc.) Type=oneshot with ExecStart=/bin/false (or any service that fails immediately) The service does NOT need to be enabled; a single start attempt is enough The corruption persists across reboots and affects rescue systems

Additional program output to the terminal or log subsystem illustrating the issue

bash