enter_chroot: bind mount /dev recursively
If nodes under /dev are bind mounted themselves (e.g. how /dev is set
up under Crostini containers), then bind mounting just /dev won't work
to pass through the full /dev state.
This means we might pull in more references into the chroot namespace
than we were before, but it's not clear if that is a problem. We can
try it and see if anyone notices.
BUG=None
TEST=`cros_sdk` in Crostini works now
Change-Id: Ic48e50213f3425f98a95f22864d436852197b171
Reviewed-on: https://chromium-review.googlesource.com/1529147
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index b5d3568..9ff98f9 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -322,8 +322,7 @@
if grep -q configfs /proc/filesystems; then
setup_mount none "-t configfs" /sys/kernel/config
fi
- setup_mount /dev "--bind" /dev
- setup_mount /dev/pts "--bind" /dev/pts
+ setup_mount /dev "--rbind" /dev
if [[ -d /run ]]; then
setup_mount /run "--bind" /run
if [[ -d /run/shm && ! -L /run/shm ]]; then