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
diff --git a/debian/changelog b/debian/changelog
index 43a2f49..3d6784b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1casper (1.414) UNRELEASED; urgency=medium
2
3 * Use udev-created symlinks to find filesystems by label.
4 * Fix find_cow_device and find_files to not unmount filesystems that were
5 already mounted (LP: #1489855)
6
7 -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 19 Jul 2019 14:34:03 +1200
8
1casper (1.413) eoan; urgency=medium9casper (1.413) eoan; urgency=medium
210
3 * Fix ftbfs by restoring empty conf.d missing from git import. 11 * Fix ftbfs by restoring empty conf.d missing from git import.
diff --git a/scripts/casper-helpers b/scripts/casper-helpers
index 0127bb9..ad961ae 100644
--- a/scripts/casper-helpers
+++ b/scripts/casper-helpers
@@ -169,35 +169,16 @@ setup_loop() {
169 fi169 fi
170}170}
171171
172# Returns 0 on success172find_cow_device() {
173# panics if remount- or bind-mount fails173 pers_label="${1}"
174# returns 1 on failure otherwise
175try_mount ()
176{
177 dev="${1}"
178 mountp="${2}"
179 opts="${3}"
180174
181 if where_is_mounted ${dev} > /dev/null; then175 udevadm settle
182 if [ "${opts}" != "ro" ]; then176
183 mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"177 if [ -e "/dev/disk/by-label/${pers_label}" ]; then
184 return 0178 echo /dev/disk/by-label/${pers_label}
185 fi
186 mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount"
187 return 0
188 else
189 mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}"
190 ret=$?
191 if [ $ret -ne 0 ]; then
192 log_warning_msg "Cannot mount ${dev} on ${mountp}"
193 return 1
194 fi
195 return 0179 return 0
196 fi180 fi
197}
198181
199find_cow_device() {
200 pers_label="${1}"
201 cow_backing="/${pers_label}-backing"182 cow_backing="/${pers_label}-backing"
202183
203 if [ -z "${PERSISTENT_PATH}" ]; then184 if [ -z "${PERSISTENT_PATH}" ]; then
@@ -214,22 +195,30 @@ find_cow_device() {
214 fi195 fi
215 for dev in $(subdevices "${sysblock}"); do196 for dev in $(subdevices "${sysblock}"); do
216 devname=$(sys2dev "${dev}")197 devname=$(sys2dev "${dev}")
217 if [ "$(/sbin/blkid -s LABEL -o value $devname 2>/dev/null)" = "${pers_label}" ]; then
218 echo "$devname"
219 return
220 # Do not add any filesystem types here that might be able to198 # Do not add any filesystem types here that might be able to
221 # mount a journalled filesystem and replay the journal. Doing so199 # mount a journalled filesystem and replay the journal. Doing so
222 # will cause data loss when a live CD is booted on a system200 # will cause data loss when a live CD is booted on a system
223 # where filesystems are in use by hibernated operating systems.201 # where filesystems are in use by hibernated operating systems.
224 elif [ "$(get_fstype ${devname})" = "vfat" ]; then202 case "$(get_fstype ${devname})" in
203 vfat)
204 :;;
205 *)
206 continue;;
207 esac
208 where_mounted=$(where_is_mounted "${devname}")
209 if [ $? -eq 0 ]; then
210 if [ -e "${where_mounted}/${pers_fpath}" ]; then
211 mount -o remount,rw ${devname} ${where_mounted} || continue
212 echo $(setup_loop "${where_mounted}/${pers_fpath}" "loop" "/sys/block/loop*")
213 fi
214 else
225 mkdir -p "${cow_backing}"215 mkdir -p "${cow_backing}"
226 try_mount "${devname}" "${cow_backing}" "rw" || continue216 mount "${devname}" "${cow_backing}" || continue
227 cow_backing_mp=$(where_is_mounted "${devname}")217 if [ -e "${cow_backing}/${pers_fpath}" ]; then
228 if [ -e "${cow_backing_mp}/${pers_fpath}" ]; then218 echo $(setup_loop "${cow_backing}/${pers_fpath}" "loop" "/sys/block/loop*")
229 echo $(setup_loop "${cow_backing_mp}/${pers_fpath}" "loop" "/sys/block/loop*")
230 return 0219 return 0
231 else220 else
232 umount ${cow_backing_mp}221 umount ${cow_backing}
233 fi222 fi
234 fi223 fi
235 done224 done
@@ -241,21 +230,31 @@ find_files()
241# FIXME: merge with above function230# FIXME: merge with above function
242{231{
243 filenames="${1}"232 filenames="${1}"
244 snap_backing="/snap-backing"
245 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop); do233 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop); do
246 for dev in $(subdevices "${sysblock}"); do234 for dev in $(subdevices "${sysblock}"); do
247 devname=$(sys2dev "${dev}")235 devname=$(sys2dev "${dev}")
248 devfstype="$(get_fstype ${devname})"236 case "$(get_fstype ${devname})" in
249 if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] ; then # FIXME: all supported block devices should be scanned237 vfat|ext2)
250 mkdir -p "${snap_backing}"238 :;;
251 try_mount "${devname}" "${snap_backing}" "ro" || continue239 *)
252 for filename in ${filenames}; do240 continue;;
253 if [ -e "${snap_backing}/${filename}" ]; then241 esac
254 echo "${devname} ${snap_backing} ${filename}"242 doumount=
255 return 0243 mntpoint=$(where_is_mounted "${devname}")
256 fi244 if [ $? -ne 0 ]; then
257 done245 doumount=1
258 umount ${snap_backing}246 mntpoint="/snap-backing"
247 mkdir -p "${mntpoint}"
248 mount -o ro "${devname}" "${mntpoint}"
249 fi
250 for filename in ${filenames}; do
251 if [ -e "${mntpoint}/${filename}" ]; then
252 echo "${devname} ${mntpoint} ${filename}"
253 return 0
254 fi
255 done
256 if [ -n "${doumount}" ]; then
257 umount "${mntpoint}"
259 fi258 fi
260 done259 done
261 done260 done

Subscribers

People subscribed via source and target branches