← Back to team overview

curtin-dev team mailing list archive

[Merge] ~mitchellaugustin/curtin:master into curtin:master

 

Mitchell Augustin has proposed merging ~mitchellaugustin/curtin:master into curtin:master.

Commit message:
Change default behavior of "curtin in-target" to use default PID namespace

Bug link: https://bugs.launchpad.net/curtin/+bug/2037682

Some programs that are installed by default in Ubuntu rely on checking /proc/$pid to determine
if certain processes are still alive. Curtin's current default behavior for "curtin in-target" is to run
children inside a separate PID namespace without also isolating /proc, meaning checks for /proc/$pid usually
wait on the wrong process entirely. One such example is in any DKMS package, as DKMS checks /proc/$pid.
(I have submitted a similar patch to them to address this as well: https://github.com/dell/dkms/pull/403).

I have attempted to mount an isolated /proc to resolve this issue, but this exposes a new issue in which
post-installation hooks that rely on systemd fail since they cannot communicate with it from within the
new namespace.

This patch changes "curtin in-target"'s default behavior so it uses the default namespace by omiting the unshare
steps unless specified. I tested this change and observed no regressions and was unable to find details justifying

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~mitchellaugustin/curtin/+git/curtin/+merge/460456

Change default behavior of "curtin in-target" to use default PID namespace
-- 
Your team curtin developers is requested to review the proposed merge of ~mitchellaugustin/curtin:master into curtin:master.
diff --git a/curtin/util.py b/curtin/util.py
index 9ab4829..1c390bb 100644
--- a/curtin/util.py
+++ b/curtin/util.py
@@ -73,7 +73,7 @@ class NotExclusiveError(OSError):
 def _subp(args, data=None, rcs=None, env=None, capture=False,
           combine_capture=False, shell=False, logstring=False,
           decode="replace", target=None, cwd=None, log_captured=False,
-          unshare_pid=None):
+          unshare_pid=False):
     if rcs is None:
         rcs = [0]
     devnull_fp = None
@@ -247,8 +247,7 @@ def subp(*args, **kwargs):
         run the command as 'chroot target <args>'
     :param unshare_pid:
         unshare the pid namespace.
-        default value (None) is to unshare pid namespace if possible
-        and target != /
+        default value (False) is to use default namespace
 
     :return
         if not capturing, return is (None, None)

Follow ups