Merge ~mwhudson/ubuntu/+source/casper:lp-1489855-harder into ubuntu/+source/casper:ubuntu/eoan-proposed

Proposed by Michael Hudson-Doyle
Status: Needs review
Proposed branch: ~mwhudson/ubuntu/+source/casper:lp-1489855-harder
Merge into: ubuntu/+source/casper:ubuntu/eoan-proposed
Diff against target: 146 lines (+53/-46)
2 files modified
debian/changelog (+8/-0)
scripts/casper-helpers (+45/-46)
Reviewer Review Type Date Requested Status
git-ubuntu developers Pending
Review via email: mp+370351@code.launchpad.net

Commit message

    * Use udev-created symlinks to find filesystems by label.
    * Fix find_cow_device and find_files to not unmount filesystems that were
      already mounted (LP: #1489855)

Description of the change

This "seems to work" in my testing so far.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I've now tested this in three scenarios as described in the bug report, with both the desktop and live-server ISO. I'm happy enough with it but I'll leave this here over my weekend in case someone wants to review it.

Unmerged commits

a452b0b... by Michael Hudson-Doyle

Use udev-created symlinks to find filesystems by label.

* Use udev-created symlinks to find filesystems by label.
* Fix find_cow_device and find_files to not unmount filesystems that were
  already mounted (LP: #1489855)

38f1ac5... by Michael Hudson-Doyle

Import patches-unapplied version 1.413 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 0e52b46ea2a0eff48e0e8b26cb6a7174989ceb27

New changelog entries:
  * Fix ftbfs by restoring empty conf.d missing from git import.

0e52b46... by Michael Hudson-Doyle

Import patches-unapplied version 1.412 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: ffbe569742513eeff619206775c15a842cc723d0

New changelog entries:
  * Try to mount partitions of a block device before mounting the block device
    itself (if both work, the former is preferable). (LP: #1489855)

ffbe569... by Dimitri John Ledkov

Import patches-unapplied version 1.411 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 21653d164262d107b3acf397836a72852b330401

New changelog entries:
  * 1.409 only added parsing for NFSROOT, also add parsing for NETBOOT as
    it was intended.

21653d1... by Dimitri John Ledkov

Import patches-unapplied version 1.410 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 9512917f738e5701175e146003a6652bec46008d

New changelog entries:
  * Drop casper-bottom/23networking and rely on stock configure_networking
    only. As that one knows netplan... However this drops ',' separated
    syntax for ip= command which is very weird. And baked-in networking
    config on the images should switch to netplan too.

9512917... by Dimitri John Ledkov

Import patches-unapplied version 1.409 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 78a580214c8bba7f3ef89ff70ad6e1d37f9ee40b

New changelog entries:
  * Reintroduce netboot= => export NETBOOT option parsing in casper, as it
    was dropped in initramfs-tools.

78a5802... by Sebastien Bacher

Import patches-unapplied version 1.408 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 43f12281f98ddefb74fb80ebf6a37342a8a66e1e

New changelog entries:
  * ubiquity-hooks/30accessibility:
    - enable accessibility for gdm as well as for lightdm which was still
      the only option being handled (lp: #1825112)

43f1228... by Dimitri John Ledkov

Import patches-unapplied version 1.407 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 41d58850dce25631976f69a1c0517f0fb33cd2f5

New changelog entries:
  * Upload 1.396 partially reverted 1.395, but it didn't restore the
    systemd job, thus the net effect is that password was not cleared at
    all for anyone. Restore 1.395 codepath, but do not clear the password
    when ssdm is present.
  * Add a 99casperboot hook, and make casper-stop sensitive to that, since
    boot=casper is gone from the default kernel cmdline.

41d5885... by Dimitri John Ledkov

Import patches-unapplied version 1.406 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: f4c05cc8c0d7bf5e7790bd3e166a9ec8260cfbdf

New changelog entries:
  * When generating casper inird with UUID, also default boot= arg to
    casper. This way, we can drop boot=casper from all the iso's default
    cmdline.

f4c05cc... by Alberto Milone

Import patches-unapplied version 1.405 to ubuntu/disco-proposed

Imported using git-ubuntu import.

Changelog parent: 762b2bb689974c4fecd95d9fd8797e8e25ae9b06

New changelog entries:
  [ Dimitri John Ledkov ]
  * scripts/casper-bottom/25adduser:
    - Make boot non-degraded, by clearing the lock. As otherwise
      systemd-sysusers fails and boots the system degraded on multi-lower
      subiquity images.
  [ Alberto Milone ]
  * scripts/casper-bottom/56override_nvidia_udev_rule:
    - Prevent udev from repeatedly trying to modprobe the nvidia modules
      and to start the relevant daemons on the live image (LP: #1824177).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 43a2f49..3d6784b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+casper (1.414) UNRELEASED; urgency=medium
7+
8+ * Use udev-created symlinks to find filesystems by label.
9+ * Fix find_cow_device and find_files to not unmount filesystems that were
10+ already mounted (LP: #1489855)
11+
12+ -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 19 Jul 2019 14:34:03 +1200
13+
14 casper (1.413) eoan; urgency=medium
15
16 * Fix ftbfs by restoring empty conf.d missing from git import.
17diff --git a/scripts/casper-helpers b/scripts/casper-helpers
18index 0127bb9..ad961ae 100644
19--- a/scripts/casper-helpers
20+++ b/scripts/casper-helpers
21@@ -169,35 +169,16 @@ setup_loop() {
22 fi
23 }
24
25-# Returns 0 on success
26-# panics if remount- or bind-mount fails
27-# returns 1 on failure otherwise
28-try_mount ()
29-{
30- dev="${1}"
31- mountp="${2}"
32- opts="${3}"
33+find_cow_device() {
34+ pers_label="${1}"
35
36- if where_is_mounted ${dev} > /dev/null; then
37- if [ "${opts}" != "ro" ]; then
38- mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"
39- return 0
40- fi
41- mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount"
42- return 0
43- else
44- mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}"
45- ret=$?
46- if [ $ret -ne 0 ]; then
47- log_warning_msg "Cannot mount ${dev} on ${mountp}"
48- return 1
49- fi
50+ udevadm settle
51+
52+ if [ -e "/dev/disk/by-label/${pers_label}" ]; then
53+ echo /dev/disk/by-label/${pers_label}
54 return 0
55 fi
56-}
57
58-find_cow_device() {
59- pers_label="${1}"
60 cow_backing="/${pers_label}-backing"
61
62 if [ -z "${PERSISTENT_PATH}" ]; then
63@@ -214,22 +195,30 @@ find_cow_device() {
64 fi
65 for dev in $(subdevices "${sysblock}"); do
66 devname=$(sys2dev "${dev}")
67- if [ "$(/sbin/blkid -s LABEL -o value $devname 2>/dev/null)" = "${pers_label}" ]; then
68- echo "$devname"
69- return
70 # Do not add any filesystem types here that might be able to
71 # mount a journalled filesystem and replay the journal. Doing so
72 # will cause data loss when a live CD is booted on a system
73 # where filesystems are in use by hibernated operating systems.
74- elif [ "$(get_fstype ${devname})" = "vfat" ]; then
75+ case "$(get_fstype ${devname})" in
76+ vfat)
77+ :;;
78+ *)
79+ continue;;
80+ esac
81+ where_mounted=$(where_is_mounted "${devname}")
82+ if [ $? -eq 0 ]; then
83+ if [ -e "${where_mounted}/${pers_fpath}" ]; then
84+ mount -o remount,rw ${devname} ${where_mounted} || continue
85+ echo $(setup_loop "${where_mounted}/${pers_fpath}" "loop" "/sys/block/loop*")
86+ fi
87+ else
88 mkdir -p "${cow_backing}"
89- try_mount "${devname}" "${cow_backing}" "rw" || continue
90- cow_backing_mp=$(where_is_mounted "${devname}")
91- if [ -e "${cow_backing_mp}/${pers_fpath}" ]; then
92- echo $(setup_loop "${cow_backing_mp}/${pers_fpath}" "loop" "/sys/block/loop*")
93+ mount "${devname}" "${cow_backing}" || continue
94+ if [ -e "${cow_backing}/${pers_fpath}" ]; then
95+ echo $(setup_loop "${cow_backing}/${pers_fpath}" "loop" "/sys/block/loop*")
96 return 0
97 else
98- umount ${cow_backing_mp}
99+ umount ${cow_backing}
100 fi
101 fi
102 done
103@@ -241,21 +230,31 @@ find_files()
104 # FIXME: merge with above function
105 {
106 filenames="${1}"
107- snap_backing="/snap-backing"
108 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop); do
109 for dev in $(subdevices "${sysblock}"); do
110 devname=$(sys2dev "${dev}")
111- devfstype="$(get_fstype ${devname})"
112- if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] ; then # FIXME: all supported block devices should be scanned
113- mkdir -p "${snap_backing}"
114- try_mount "${devname}" "${snap_backing}" "ro" || continue
115- for filename in ${filenames}; do
116- if [ -e "${snap_backing}/${filename}" ]; then
117- echo "${devname} ${snap_backing} ${filename}"
118- return 0
119- fi
120- done
121- umount ${snap_backing}
122+ case "$(get_fstype ${devname})" in
123+ vfat|ext2)
124+ :;;
125+ *)
126+ continue;;
127+ esac
128+ doumount=
129+ mntpoint=$(where_is_mounted "${devname}")
130+ if [ $? -ne 0 ]; then
131+ doumount=1
132+ mntpoint="/snap-backing"
133+ mkdir -p "${mntpoint}"
134+ mount -o ro "${devname}" "${mntpoint}"
135+ fi
136+ for filename in ${filenames}; do
137+ if [ -e "${mntpoint}/${filename}" ]; then
138+ echo "${devname} ${mntpoint} ${filename}"
139+ return 0
140+ fi
141+ done
142+ if [ -n "${doumount}" ]; then
143+ umount "${mntpoint}"
144 fi
145 done
146 done

Subscribers

People subscribed via source and target branches