From 18d796ff3eb18a0c1e74ff145041d416697b18a0 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 27 May 2014 19:26:34 -0700 Subject: [PATCH] fix(sdk-lib): Mount a fresh /run directory. There is no need to arbitrarily bind mount all of the host system's /run into the chroot. In fact this causes issues when the host system's /run isn't set up in a way this script anticipates. Namely the user runtime directory in /run/usr/$UID is another tmpfs mount on my system, leaving the underlying directory node that is bind-mounted in with the wrong ownership. Behave a little more like a responsible container and use a fresh /run but continue binding /run/shm for whatever versions of Ubuntu that depended on that behavior. Not strictly needed but go ahead and create the user runtime directory with the correct permissions. --- sdk_lib/enter_chroot.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 8c3ab0cb1c..3353b40939 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -223,12 +223,12 @@ setup_env() { setup_mount none "-t sysfs" /sys setup_mount /dev "--bind" /dev setup_mount /dev/pts "--bind" /dev/pts - if [[ -d /run ]]; then - setup_mount /run "--bind" /run - if [[ -d /run/shm && ! -L /run/shm ]]; then - setup_mount /run/shm "--bind" /run/shm - fi + setup_mount tmpfs "-t tmpfs -o nosuid,nodev,mode=755" /run + if [[ -d /run/shm && ! -L /run/shm ]]; then + setup_mount /run/shm "--bind" /run/shm fi + mkdir -p /run/user/${SUDO_UID} + chown ${SUDO_UID}:${SUDO_GID} /run/user/${SUDO_UID} # Do this early as it's slow and only needs basic mounts (above). generate_locales &