From 435f52a7d1506b87d6b650adcdde35a36c242157 Mon Sep 17 00:00:00 2001 From: Markos Chandras <mchandras@suse.de> Date: Wed, 2 Nov 2016 22:05:05 +0000 Subject: [PATCH] elements: zypper-minimal: Mount common pseudo filesystems Mount all the usual /dev /sys /proc pseudo filesystems during the root.d phase in order to make sure they are available for the rpm post-installation phases. Change-Id: I28221debf1036d9eb5137161757eb30811eafab1 --- elements/zypper-minimal/root.d/08-zypper-chroot | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/elements/zypper-minimal/root.d/08-zypper-chroot b/elements/zypper-minimal/root.d/08-zypper-chroot index 413970d0b..7e4b22d08 100755 --- a/elements/zypper-minimal/root.d/08-zypper-chroot +++ b/elements/zypper-minimal/root.d/08-zypper-chroot @@ -27,6 +27,10 @@ set -o pipefail [ -n "${ZYPPER_REPOS}" ] function cleanup() { + sudo umount $TARGET_ROOT/proc + sudo umount $TARGET_ROOT/dev/pts + sudo umount $TARGET_ROOT/dev + sudo umount $TARGET_ROOT/sys sudo umount $TMP_MOUNT_PATH/var/cache/zypp } @@ -54,6 +58,16 @@ sudo mount --bind $ZYPPER_CACHE_DIR $TMP_MOUNT_PATH/var/cache/zypp # since last run. sudo zypper ${ZYPPER_TARGET_OPTS} refresh +# Note this is not usually done for root.d elements (see +# lib/common-functions:mount_proc_dev_sys) but it's important that +# we have things like /dev/urandom around inside the chroot for +# the rpm [pre|post]inst scripts within the packages. +sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys +sudo mount -t proc none $TARGET_ROOT/proc +sudo mount --bind /dev $TARGET_ROOT/dev +sudo mount --bind /dev/pts $TARGET_ROOT/dev/pts +sudo mount -t sysfs none $TARGET_ROOT/sys + # Install filesystem, base and useful tools sudo zypper ${ZYPPER_TARGET_OPTS} install ${ZYPPER_INSTALL_OPTS} filesystem # Install basic components in order @@ -84,5 +98,5 @@ for newfile in $(sudo find $TARGET_ROOT -type f -name '*rpmnew') ; do sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//') done -# Unmounting of the /var/cache/zypp is handled by the cleanup EXIT +# Unmounting of all the mount points is handled by the cleanup EXIT # handler so there is nothing else to do here