Containerd Service Crash on Ubuntu 22.04 — Fix in 3 Steps
Containerd keeps dying on you. Start by checking memory limits, then reset the config, then reinstall. No fluff.
30-Second Fix: Check if Memory Killed It
What's actually happening here is the Linux kernel is killing containerd because it's eating too much memory. The error code status=9/SIGKILL means the OOM killer stepped in.
Run this command to see if containerd got killed by OOM:
sudo dmesg | grep -i oom | tail -5
If you see oom-kill with containerd in the line, that's your problem. The quick fix is to give containerd more swap or reduce its memory hunger.
Check your current memory usage:
free -h
systemctl status containerd
If the system has less than 1GB free RAM, that's often the trigger. You can temporarily add swap to buy time:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Then restart containerd:
sudo systemctl restart containerd
If it stays up, you're done. If it crashes again within minutes, move to the next step.
5-Minute Fix: Reset Config and Clear State
The reason step 3 works is that containerd can corrupt its own state files when it gets killed mid-write. It then reads garbage on restart and crashes again.
First, stop the service:
sudo systemctl stop containerd
Now move the config and state files out of the way:
sudo mv /etc/containerd/config.toml /etc/containerd/config.toml.bak
sudo rm -rf /var/lib/containerd/*
Do not delete the socket file — it's at /run/containerd/containerd.sock and gets recreated on start. Deleting it is fine too, but not necessary.
Regenerate a fresh config:
sudo containerd config default | sudo tee /etc/containerd/config.toml
Start the service:
sudo systemctl start containerd
sudo systemctl status containerd
Check the logs for errors:
sudo journalctl -u containerd --no-pager -n 30
If you see failed to load cri image store or no such file or directory, you missed the state cleanup. Go back and delete everything under /var/lib/containerd again.
If it still crashes, move to the next section.
15-Minute Fix: Reinstall Containerd from Scratch
This is the nuclear option, but it works when the package itself is broken — which happens if you upgraded from an older Ubuntu or mixed Docker repos.
First, purge containerd completely:
sudo systemctl stop containerd
sudo apt-get purge -y containerd.io
sudo rm -rf /etc/containerd /var/lib/containerd /run/containerd
Now reinstall from the official Docker repo (not Ubuntu's default — their version is often outdated and buggy):
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y containerd.io
Then generate a fresh config:
sudo containerd config default | sudo tee /etc/containerd/config.toml
Make sure CRI plugin is enabled — that's the part Kubernetes and Docker use. Open /etc/containerd/config.toml and check that disabled_plugins does not contain cri. If it does, remove it:
sudo sed -i '/disabled_plugins/s/\[\"cri\"\]//' /etc/containerd/config.toml
Start the service and verify:
sudo systemctl enable containerd
sudo systemctl start containerd
sudo ctr version
If ctr version returns clean output, you're good. If it hangs or errors, check the logs with journalctl -u containerd -f — the real problem will be in the last 10 lines.
Still Crashing? Check These Two Things
If none of the above worked, the issue is probably not containerd itself.
1. Cgroup version mismatch
Ubuntu 22.04 defaults to cgroup v2, but containerd might expect v1. Check:
stat -fc %T /sys/fs/cgroup/
If it says cgroup2fs, you're on v2. That's fine for containerd 1.7+. If you're on an older version, upgrade containerd or force cgroup v1 in kernel boot parameters (systemd.unified_cgroup_hierarchy=0).
2. Docker socket conflicts
If Docker is installed, it might have its own containerd. Check what's actually running:
ps aux | grep containerd
If you see two containerd processes, you have a conflict. Stop and mask the Docker one (sudo systemctl mask docker) or uninstall Docker if you don't need it.
That's it. One of these will get you back up. The key is understanding the SIGKILL isn't random — it's always a resource or config issue.
Was this solution helpful?