Merge ~xnox/casper:try-fix-unmount-cdrom into casper:main

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 7412669aff3efa6aa9911c3d1000a7b8cbfc3e66
Proposed branch: ~xnox/casper:try-fix-unmount-cdrom
Merge into: casper:main
Diff against target: 36 lines (+27/-1)
1 file modified
scripts/casper-bottom/25disable_cdrom.mount (+27/-1)
Reviewer Review Type Date Requested Status
Iain Lane Pending
Sebastien Bacher Pending
Michael Hudson-Doyle Pending
Review via email: mp+397944@code.launchpad.net

Commit message

your welcome

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

adding desktop people for visibility to ensure that if this lands and explodes again, at least everyone is bracing for impact =)

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Well this does seem to help, despite all the hackery. I haven't tested a desktop image but /cdrom is mounted as expected for a server image and there are no complaints about trying to unmount it in the journal. Is there anything else I should be looking for?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hmm I still get the unmount failures on reboot, did you expect/hope that this would fix those?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I built this into an ISO (properly, unlike my last comment) and it helps on boot but casper-stop now runs after /cdrom is unmounted and so doesn't prompt to remove media when it should. xnox thinks this can be fixed by correcting dependencies but I wonder if we should instead fix this by having the code that mounts /cdrom record in /run whether casper-stop should prompt and then deleting 90% of casper-stop. Possibly do the first for SRU and then the second for new releases?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

My ISO is here if anyone wants to test https://people.canonical.com/~mwh/casper-cdrom.iso

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/casper-bottom/25disable_cdrom.mount b/scripts/casper-bottom/25disable_cdrom.mount
2index c02f4cd..a3741df 100755
3--- a/scripts/casper-bottom/25disable_cdrom.mount
4+++ b/scripts/casper-bottom/25disable_cdrom.mount
5@@ -15,4 +15,30 @@ prereqs)
6 ;;
7 esac
8
9-ln -s /dev/null /root/lib/systemd/system/cdrom.mount
10+# Disable bounding mount points to sr0 device
11+# As there is no way to make sr0 be active&plugged on cold boot
12+# Thus systemd always tries to unmount cdrom.mount even before udev
13+# coldplug got processed
14+sed -i '/SYSTEMD_MOUNT_DEVICE_BOUND/d' /lib/udev/rules.d/60-cdrom_id.rules /root/lib/udev/rules.d/60-cdrom_id.rules
15+
16+# Correct udevadm settings
17+udevadm trigger /dev/sr0 || :
18+
19+# Make cdrom.mount not have defaultdependencies, thus it should not be
20+# unmounted on shutdown. And make sure that it is ordered after
21+# casper.service, to not be unmounted before casper service shows the
22+# RIM & Reboot message.
23+
24+# And we specify BindsTo= to nothing, again, despite udev rule, as it
25+# is not enough on the server iso for some reason. Weird.
26+cat <<EOF >/root/lib/systemd/system/cdrom.mount
27+[Unit]
28+DefaultDependencies=no
29+After=casper.service
30+BindsTo=
31+
32+[Mount]
33+Where=/cdrom
34+What=/dev/sr0
35+LazyUnmount=yes
36+EOF

Subscribers

People subscribed via source and target branches