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.
This commit is contained in:
Michael Marineau 2014-05-27 19:26:34 -07:00
parent f2f74b3423
commit 18d796ff3e

View File

@ -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 &