Fix: Unit “containerd.service” has failed

Posted by clsung on Sunday, December 9, 2018

When I upgraded yum packages, docker service had stopped. So I check the system status try to figure out the root cause….

Nov 20 08:54:25 li1683-199 systemd[1]: Starting containerd container runtime...
-- Subject: Unit containerd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit containerd.service has begun starting up.
Nov 20 08:54:25 li1683-199 systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
Nov 20 08:54:25 li1683-199 systemd[1]: containerd.service: control process exited, code=exited status=1
Nov 20 08:54:25 li1683-199 systemd[1]: Failed to start containerd container runtime.
-- Subject: Unit containerd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit containerd.service has failed.
--
-- The result is failed.
Nov 20 08:54:25 li1683-199 systemd[1]: Dependency failed for Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is dependency.
Nov 20 08:54:25 li1683-199 systemd[1]: Job docker.service/start failed with result 'dependency'.
Nov 20 08:54:25 li1683-199 systemd[1]: Unit containerd.service entered failed state.
Nov 20 08:54:25 li1683-199 systemd[1]: containerd.service failed.
Nov 20 08:54:25 li1683-199 systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has finished shutting down.

After google ‘Subject: Unit “containerd.service” has failed’, we can find a related github issue. It seems to be a containerd problem than a docker problem, and here’s the fix: (the following shows the before and after)

% cat /lib/systemd/system/containerd.service|grep ExecStartPre
ExecStartPre=/sbin/modprobe overlay
% sudo systemctl show containerd.service | grep ExecStartPre
ExecStartPre=/sbin/modprobe overlay
% cat /etc/systemd/system/containerd.service.d/override.conf
[Service]
ExecStartPre=
% sudo systemctl daemon-reload
% sudo systemctl show containerd.service | grep ExecStartPre
% # no-output