From 6a42148b22febf9247b8c7b297d607d43c303566 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 8 Sep 2017 11:48:06 +0100 Subject: [PATCH] Mount and unmount /dev recursively, to cope with setups where there are interesting bind-mounts under /dev (e.g. loop devices bind-mounted by LXD). --- debian/changelog | 5 +++++ live-build/functions | 9 ++------- live-build/ubuntu-cpc/hooks/032-root-squashfs.binary | 3 +-- .../ubuntu-server/hooks/032-installer-squashfs.binary | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index ac72aac5..94a3e6c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,11 @@ livecd-rootfs (2.453) UNRELEASED; urgency=medium [ Chris Glass ] * Create vagrant user for vagrant image, per upstream requirements. + [ Colin Watson ] + * Mount and unmount /dev recursively, to cope with setups where there are + interesting bind-mounts under /dev (e.g. loop devices bind-mounted by + LXD). + -- Adam Conrad Fri, 01 Sep 2017 10:53:46 -0600 livecd-rootfs (2.452) artful; urgency=medium diff --git a/live-build/functions b/live-build/functions index 7d645b9e..d0bda550 100644 --- a/live-build/functions +++ b/live-build/functions @@ -79,8 +79,7 @@ mount_image() { setup_mountpoint() { local mountpoint="$1" - mount --bind /dev "$mountpoint/dev" - mount devpts-live -t proc "$mountpoint/dev/pts" + mount --rbind /dev "$mountpoint/dev" mount proc-live -t proc "$mountpoint/proc" mount sysfs-live -t sysfs "$mountpoint/sys" mount -t tmpfs none "$mountpoint/tmp" @@ -141,11 +140,7 @@ umount_settle() { umount_partition() { local mountpoint=${1} mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" - for submnt in proc sys dev/pts dev tmp; - do - umount $mountpoint/$submnt - done - umount $mountpoint + umount -R $mountpoint udevadm settle if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then diff --git a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary index 84c19920..8c1580ea 100755 --- a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary +++ b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary @@ -39,8 +39,7 @@ chroot binary/boot/squashfs.dir dpkg-divert --remove --local --rename /usr/sbin/ mv resolv.conf.tmp "binary/boot/squashfs.dir/etc/resolv.conf" umount "binary/boot/squashfs.dir/proc" umount "binary/boot/squashfs.dir/sys" -umount "binary/boot/squashfs.dir/dev/pts" -umount "binary/boot/squashfs.dir/dev" +umount -R "binary/boot/squashfs.dir/dev" umount "binary/boot/squashfs.dir/tmp" squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs" diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index 943eb2ab..63fd972e 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -155,8 +155,7 @@ umount "$SQUASH_ROOT" # Then we can start unmounting the "real" root: umount "binary/boot/squashfs.dir/proc" umount "binary/boot/squashfs.dir/sys" -umount "binary/boot/squashfs.dir/dev/pts" -umount "binary/boot/squashfs.dir/dev" +umount -R "binary/boot/squashfs.dir/dev" umount "binary/boot/squashfs.dir/tmp" squashfs_f="${PWD}/livecd.${PROJECT}.installer.squashfs"