diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-03-30 12:59:49 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-03-30 15:36:05 -0400 |
commit | 197b8ad77bbcfd79fa76b38c5466373c165fc927 (patch) | |
tree | 659e28ae09c07f8acffda25675799bbf538d9990 /libpod | |
parent | c1d9851a4f290b641a092a0f46af898c75587f0f (diff) | |
download | podman-197b8ad77bbcfd79fa76b38c5466373c165fc927.tar.gz podman-197b8ad77bbcfd79fa76b38c5466373c165fc927.tar.bz2 podman-197b8ad77bbcfd79fa76b38c5466373c165fc927.zip |
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 <pholzing@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/networking_linux.go | 11 |
1 files changed, 7 insertions, 4 deletions
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 |