From 42c659f30f8d13bc5b6bcbe9203e83a9efa2b2a8 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 16 Jun 2024 16:46:43 +0200 Subject: populate_dev: also provide /dev/shm This is needed e.g. for Python's multiprocessing.SemLock. --- linuxnamespaces/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'linuxnamespaces') diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 43c1bc8..1b4ca07 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -407,7 +407,7 @@ def populate_dev( """ origdev = AtLocation(origroot) / "dev" newdev = AtLocation(newroot) / "dev" - directories = {"pts"} + directories = {"pts", "shm"} files = set() symlinks = { "fd": "/proc/self/fd", @@ -456,6 +456,12 @@ def populate_dev( for fn in directories: (newdev / fn).mkdir() (newdev / fn).chmod(0o755) + mount( + "tmpfs", + newdev / "shm", + "tmpfs", + MountFlags.NOSUID | MountFlags.NODEV, + ) for fn in files: (newdev / fn).mknod(stat.S_IFREG) for fn, target in symlinks.items(): -- cgit v1.2.3