mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 06:31:18 +02:00
Bind-mount /run if it exists
Ubuntu 11.10, for whatever reason, moved /dev/shm to /run/shm. Since /run is not mounted in the chroot, /dev/shm is a dangling symlink and various things that require shared memory start failing. If /run and /run/shm exist, bind-mount them in the chroot. Because /run doesn't yet exist in the SDK tarballs, try to create it (and /run/shm if necessary) as root if it and can't be created as a normal user. BUG=chromium-os:19871 TEST=Run cros_sdk, verify that /dev/shm has the expected contents Change-Id: I61583c1c0d409c1234fa8d8930a9b64544c9a8e7 Reviewed-on: https://gerrit.chromium.org/gerrit/10222 Tested-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: David James <davidjames@chromium.org> Commit-Ready: David James <davidjames@chromium.org>
This commit is contained in:
parent
e7c2d1c82b
commit
130d363aaa
@ -104,8 +104,12 @@ function ensure_mounted {
|
||||
*)
|
||||
# Attempt to make the mountpoint as the user. This depends on the
|
||||
# fact that all mountpoints that should be owned by root are
|
||||
# already present.
|
||||
mkdir -p "${mounted_path}"
|
||||
# already present. However, when distributions add new paths (such as
|
||||
# Ubuntu 11.10's /run), it might not yet exist in the chroot. If that
|
||||
# happens, just create it as root.
|
||||
if ! mkdir -p "${mounted_path}" 2>/dev/null; then
|
||||
sudo mkdir -p "${mounted_path}"
|
||||
fi
|
||||
|
||||
# NB: mount_args deliberately left unquoted
|
||||
debug mount ${mount_args} "${source}" "${mounted_path}"
|
||||
@ -238,6 +242,12 @@ function setup_env {
|
||||
ensure_mounted none "-t sysfs" /sys
|
||||
ensure_mounted /dev "--bind" /dev
|
||||
ensure_mounted none "-t devpts" /dev/pts
|
||||
if [ -d /run ]; then
|
||||
ensure_mounted /run "--bind" /run
|
||||
if [ -d /run/shm ]; then
|
||||
ensure_mounted /run/shm "--bind" /run/shm
|
||||
fi
|
||||
fi
|
||||
ensure_mounted "${FLAGS_trunk}" "--bind" "${CHROOT_TRUNK_DIR}"
|
||||
|
||||
if [ $FLAGS_ssh_agent -eq $FLAGS_TRUE ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user