diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index 027a58425..069805180 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -223,7 +223,13 @@ function _install_pkg_manager { 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 -t devpts /dev/pts $TARGET_ROOT/dev/pts +# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 +# introduced in v4.7 allows multiple instances of devpts. However, +# some distributions are running older kernels so we need to take +# care on what options we use to mount a new instance of devpts +# filesystem since it's not completely independent. The best thing +# to do is to simply use the existing mount options. +sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts sudo mount -t sysfs none $TARGET_ROOT/sys # initalize rpmdb diff --git a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot index c2c8a9009..d9a0d7260 100755 --- a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot +++ b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot @@ -87,7 +87,13 @@ sudo zypper ${ZYPPER_TARGET_OPTS} refresh 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 -t devpts /dev/pts $TARGET_ROOT/dev/pts +# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 +# introduced in v4.7 allows multiple instances of devpts. However, +# some distributions are running older kernels so we need to take +# care on what options we use to mount a new instance of devpts +# filesystem since it's not completely independent. The best thing +# to do is to simply use the existing mount options. +sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts sudo mount -t sysfs none $TARGET_ROOT/sys # Install filesystem, base and useful tools diff --git a/diskimage_builder/lib/common-functions b/diskimage_builder/lib/common-functions index a71fee9b3..981e9c742 100644 --- a/diskimage_builder/lib/common-functions +++ b/diskimage_builder/lib/common-functions @@ -316,6 +316,12 @@ function mount_proc_dev_sys () { # supporting kernel file systems sudo mount -t proc none $TMP_MOUNT_PATH/proc sudo mount --bind /dev $TMP_MOUNT_PATH/dev + # Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 + # introduced in v4.7 allows multiple instances of devpts. However, + # some distributions are running older kernels so we need to take + # care on what options we use to mount a new instance of devpts + # filesystem since it's not completely independent. The best thing + # to do is to simply use the existing mount options. sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TMP_MOUNT_PATH/dev/pts sudo mount -t sysfs none $TMP_MOUNT_PATH/sys }