[lxc-devel] [distrobuilder/master] shared/chroot: Recursively bind /dev

monstermunchkin on Github lxc-bot at linuxcontainers.org
Thu Feb 20 19:39:54 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 431 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200220/340e4873/attachment.bin>
-------------- next part --------------
From fc6320546dd78aa021a5bd97ff12b5b95f3bf85b Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 20 Feb 2020 20:39:09 +0100
Subject: [PATCH] shared/chroot: Recursively bind /dev

This rbinds /dev in order for it to work in containers as well.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 shared/chroot.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/chroot.go b/shared/chroot.go
index c176f51..e44703e 100644
--- a/shared/chroot.go
+++ b/shared/chroot.go
@@ -164,7 +164,7 @@ func SetupChroot(rootfs string, envs DefinitionEnv, m []ChrootMount) (func() err
 	mounts := []ChrootMount{
 		{"none", "/proc", "proc", 0, "", true},
 		{"none", "/sys", "sysfs", 0, "", true},
-		{"/dev", "/dev", "", unix.MS_BIND, "", true},
+		{"/dev", "/dev", "", unix.MS_BIND | unix.MS_REC, "", true},
 		{"none", "/run", "tmpfs", 0, "", true},
 		{"none", "/tmp", "tmpfs", 0, "", true},
 		{"/etc/resolv.conf", "/etc/resolv.conf", "", unix.MS_BIND, "", false},


More information about the lxc-devel mailing list