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).  LP: #1716465.
This commit is contained in:
Steve Langasek 2017-09-11 14:33:23 -07:00
parent 880d4f8b89
commit 314a6b95a3
3 changed files with 9 additions and 9 deletions

5
debian/changelog vendored
View File

@ -14,6 +14,11 @@ livecd-rootfs (2.408.15) UNRELEASED; urgency=medium
* live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary: call apt-get * live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary: call apt-get
update *before* installing packages, not after. update *before* installing packages, not after.
[ 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). LP: #1716465.
-- Steve Langasek <steve.langasek@ubuntu.com> Wed, 23 Aug 2017 17:35:40 -0700 -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 23 Aug 2017 17:35:40 -0700
livecd-rootfs (2.408.14) xenial; urgency=medium livecd-rootfs (2.408.14) xenial; urgency=medium

View File

@ -82,8 +82,7 @@ mount_image() {
setup_mountpoint() { setup_mountpoint() {
local mountpoint="$1" local mountpoint="$1"
mount --bind /dev "$mountpoint/dev" mount --rbind /dev "$mountpoint/dev"
mount devpts-live -t proc "$mountpoint/dev/pts"
mount proc-live -t proc "$mountpoint/proc" mount proc-live -t proc "$mountpoint/proc"
mount sysfs-live -t sysfs "$mountpoint/sys" mount sysfs-live -t sysfs "$mountpoint/sys"
mount -t tmpfs none "$mountpoint/tmp" mount -t tmpfs none "$mountpoint/tmp"
@ -136,11 +135,8 @@ umount_settle() {
umount_partition() { umount_partition() {
local mountpoint=${1} local mountpoint=${1}
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
for submnt in var/cache/apt var/lib/apt proc sys dev/pts dev tmp; umount -R $mountpoint
do udevadm settle
umount_settle $mountpoint/$submnt
done
umount_settle $mountpoint
if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then
# buildd's don't have /etc/mtab symlinked # buildd's don't have /etc/mtab symlinked

View File

@ -27,6 +27,5 @@ chroot binary/boot/filesystem.dir dpkg-divert --remove --local --rename /usr/sbi
mv resolv.conf.tmp "binary/boot/filesystem.dir/etc/resolv.conf" mv resolv.conf.tmp "binary/boot/filesystem.dir/etc/resolv.conf"
umount "binary/boot/filesystem.dir/proc" umount "binary/boot/filesystem.dir/proc"
umount "binary/boot/filesystem.dir/sys" umount "binary/boot/filesystem.dir/sys"
umount "binary/boot/filesystem.dir/dev/pts" umount -R "binary/boot/filesystem.dir/dev"
umount "binary/boot/filesystem.dir/dev"
umount "binary/boot/filesystem.dir/tmp" umount "binary/boot/filesystem.dir/tmp"