From 197b8ad77bbcfd79fa76b38c5466373c165fc927 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 30 Mar 2022 12:59:49 +0200 Subject: rootless netns: move process to scope only with systemd When you run podman on a non systemd system we should not try to move the process under a new systemd scope. [NO NEW TESTS NEEDED] Ref #13703 Signed-off-by: Paul Holzinger --- libpod/networking_linux.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libpod/networking_linux.go') diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 29b9941fe..eb264379f 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -496,10 +496,13 @@ func (r *Runtime) GetRootlessNetNs(new bool) (*RootlessNetNS, error) { return nil, err } - // move to systemd scope to prevent systemd from killing it - err = utils.MoveRootlessNetnsSlirpProcessToUserSlice(cmd.Process.Pid) - if err != nil { - logrus.Errorf("failed to move the rootless netns slirp4netns process to the systemd user.slice: %v", err) + if utils.RunsOnSystemd() { + // move to systemd scope to prevent systemd from killing it + err = utils.MoveRootlessNetnsSlirpProcessToUserSlice(cmd.Process.Pid) + if err != nil { + // only log this, it is not fatal but can lead to issues when running podman inside systemd units + logrus.Errorf("failed to move the rootless netns slirp4netns process to the systemd user.slice: %v", err) + } } // build a new resolv.conf file which uses the slirp4netns dns server address -- cgit v1.2.3-54-g00ecf