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.
ubuntu/zesty
Steve Langasek 7 years ago
parent 0129af508b
commit af5510caf9

9
debian/changelog vendored

@ -1,3 +1,12 @@
livecd-rootfs (2.441.5) UNRELEASED; urgency=medium
[ 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> Mon, 11 Sep 2017 11:47:53 -0700
livecd-rootfs (2.441.4) zesty; urgency=medium livecd-rootfs (2.441.4) zesty; urgency=medium
[ Balint Reczey ] [ Balint Reczey ]

@ -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"
@ -144,11 +143,7 @@ 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 proc sys dev/pts dev tmp; umount -R $mountpoint
do
umount $mountpoint/$submnt
done
umount $mountpoint
udevadm settle udevadm settle
if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then

@ -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" mv resolv.conf.tmp "binary/boot/squashfs.dir/etc/resolv.conf"
umount "binary/boot/squashfs.dir/proc" umount "binary/boot/squashfs.dir/proc"
umount "binary/boot/squashfs.dir/sys" umount "binary/boot/squashfs.dir/sys"
umount "binary/boot/squashfs.dir/dev/pts" umount -R "binary/boot/squashfs.dir/dev"
umount "binary/boot/squashfs.dir/dev"
umount "binary/boot/squashfs.dir/tmp" umount "binary/boot/squashfs.dir/tmp"
apt-get -qqy install squashfs-tools apt-get -qqy install squashfs-tools

@ -155,8 +155,7 @@ umount "$SQUASH_ROOT"
# Then we can start unmounting the "real" root: # Then we can start unmounting the "real" root:
umount "binary/boot/squashfs.dir/proc" umount "binary/boot/squashfs.dir/proc"
umount "binary/boot/squashfs.dir/sys" umount "binary/boot/squashfs.dir/sys"
umount "binary/boot/squashfs.dir/dev/pts" umount -R "binary/boot/squashfs.dir/dev"
umount "binary/boot/squashfs.dir/dev"
umount "binary/boot/squashfs.dir/tmp" umount "binary/boot/squashfs.dir/tmp"
apt-get -qqy install squashfs-tools apt-get -qqy install squashfs-tools

Loading…
Cancel
Save