From: Yu Watanabe Date: Wed, 6 Feb 2019 18:34:13 +0000 (+0100) Subject: udev: check whether systemd is running, and do not use cg_kill() if not X-Git-Tag: archive/raspbian/240-6+rpi1^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8d6da655bc627b636e08e89cd7e3d24b522ce54c;p=systemd.git udev: check whether systemd is running, and do not use cg_kill() if not Fixes #11645. (cherry picked from commit 31cbd2025359e1e8435a2dc371e439591846d8c4) Gbp-Pq: Name udev-check-whether-systemd-is-running-and-do-not-use-cg_k.patch --- diff --git a/src/udev/udevd.c b/src/udev/udevd.c index a1050a75..7302b062 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1799,10 +1799,10 @@ static int run(int argc, char *argv[]) { dev_setup(NULL, UID_INVALID, GID_INVALID); - if (getppid() == 1) { - /* get our own cgroup, we regularly kill everything udev has left behind - we only do this on systemd systems, and only if we are directly spawned - by PID1. otherwise we are not guaranteed to have a dedicated cgroup */ + if (getppid() == 1 && sd_booted() > 0) { + /* Get our own cgroup, we regularly kill everything udev has left behind. + * We only do this on systemd systems, and only if we are directly spawned + * by PID1. Otherwise we are not guaranteed to have a dedicated cgroup. */ r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &cgroup); if (r < 0) { if (IN_SET(r, -ENOENT, -ENOMEDIUM))