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
diff --git a/scripts/casper-bottom/25disable_cdrom.mount b/scripts/casper-bottom/25disable_cdrom.mount
index c02f4cd..a3741df 100755
--- a/scripts/casper-bottom/25disable_cdrom.mount
+++ b/scripts/casper-bottom/25disable_cdrom.mount
@@ -15,4 +15,30 @@ prereqs)
15 ;;15 ;;
16esac16esac
1717
18ln -s /dev/null /root/lib/systemd/system/cdrom.mount18# Disable bounding mount points to sr0 device
19# As there is no way to make sr0 be active&plugged on cold boot
20# Thus systemd always tries to unmount cdrom.mount even before udev
21# coldplug got processed
22sed -i '/SYSTEMD_MOUNT_DEVICE_BOUND/d' /lib/udev/rules.d/60-cdrom_id.rules /root/lib/udev/rules.d/60-cdrom_id.rules
23
24# Correct udevadm settings
25udevadm trigger /dev/sr0 || :
26
27# Make cdrom.mount not have defaultdependencies, thus it should not be
28# unmounted on shutdown. And make sure that it is ordered after
29# casper.service, to not be unmounted before casper service shows the
30# RIM & Reboot message.
31
32# And we specify BindsTo= to nothing, again, despite udev rule, as it
33# is not enough on the server iso for some reason. Weird.
34cat <<EOF >/root/lib/systemd/system/cdrom.mount
35[Unit]
36DefaultDependencies=no
37After=casper.service
38BindsTo=
39
40[Mount]
41Where=/cdrom
42What=/dev/sr0
43LazyUnmount=yes
44EOF

Subscribers

People subscribed via source and target branches