Merge ~xnox/ubuntu/+source/casper:clean-shutdown into ubuntu/+source/casper:ubuntu/devel

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: ~xnox/ubuntu/+source/casper:clean-shutdown
Merge into: ubuntu/+source/casper:ubuntu/devel
Diff against target: 90 lines (+44/-18)
4 files modified
debian/casper.install (+1/-0)
debian/changelog (+7/-0)
dev/null (+0/-18)
system/cdrom.mount (+36/-0)
Reviewer Review Type Date Requested Status
Ubuntu Server Dev import team Pending
Review via email: mp+373690@code.launchpad.net

Commit message

Pacify systemd about cdrom.mount on boot, and order it correctly to be the last one on shutdown.

# casper-stop, sometimes, does lazy unmount of /cdrom, and systemd
# doesn't like active, yet masked units. Instead of /dev/null'ing
# cdrom.mount let's define the behaviour we want.

# On boot, systemd complains that cdrom.mount exists, yet is bound to
# dev-sr0.device which udev didn't yet "plug". This trips up systemd
# to go into verbose mode with messages. All of which is a lie, given
# that initrd mounted /cdrom, which later after udev-coldplug systemd
# "catches up" with. Declate DefaultDependencies=no to prevent this
# nonesence (i.e. implicit cdrom.mount BindsTo=$What.device)

# Also, we lie about What=, as it could be anything, but systemd
# demands to specify something. Thank-fully systemd will not try
# mounting /dev/sr0 ontop of otherwise active cdrom.mount.

# Becuase of DefaultDependenices=no readd stanzas to say that /cdrom
# should be unmounted on shutdown, but only after / is unmounted.

# Given that things might be mounted from on-top of /cdrom, specify
# LazyUnmount=yes.

# Note, due https://github.com/systemd/systemd/issues/8587 we specify
# a full cdrom.mount unit, rather than a .d drop-in, as /cdrom is not
# declared in fstab or via a unit

To post a comment you must log in.
696164e... by Dimitri John Ledkov

typpo

Unmerged commits

696164e... by Dimitri John Ledkov

typpo

ba8cd06... by Dimitri John Ledkov

Pacify systemd about cdrom.mount on boot, and order it correctly to be the last one on shutdown.

9342ab5... by Dimitri John Ledkov

Better

aa51ff5... by Dimitri John Ledkov

wip

dc4d5ed... by Dimitri John Ledkov

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

Imported using git-ubuntu import.

Changelog parent: d19e2ccd6c2f2621c2d963d26cbf50bef3e6452f

New changelog entries:
  * Add support for url=protocol://path/to/installer.iso netboot
    option. Using this, one can netboot and complete installations using
    kernel and initrd from the new Ubuntu Server Installer using `ip=dhcp
    url=http://..../ubuntu-19.10-live-server-arch.iso' cmdline paratemers.
    This is not specific to Server installer, and should work for Ubuntu
    Desktop images too. Using this patch, successfully completed netboot
    installation with dhcp networking over vlan on a POWER9 machine.

d19e2cc... by Dimitri John Ledkov

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

Imported using git-ubuntu import.

Changelog parent: f6c5b91cca39fae2cf936f65b9c22c4ddd24a47a

New changelog entries:
  * Drop empty directory (doesn't track well in git)
  * Use debian/casper.dirs to install conf.d

f6c5b91... by Dimitri John Ledkov

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

Imported using git-ubuntu import.

Changelog parent: 00adb03acba4e67ace46ff2e4dad9e02474eb617

New changelog entries:
  * Add dependency on finalrd for reliable live-session shutdown. Casper
    setup live systems do have layering violations (/ actually depends on
    /cdrom) and it appears that (although masked) the system manages to
    rip it out, resulting in filesystem errors preventing completing the
    shutdown. That's where pivot to finalrd comes in, to save the day and
    blast the running system into oblivion and complete the shutdown. LP:
    #1840122

00adb03... by Adam Conrad

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

Imported using git-ubuntu import.

Changelog parent: a95d97936ec7b066b56092c1ced6212e3e7e001d

New changelog entries:
  * scripts/casper: Fix shell syntax error introduced in the 1.417 upload.

a95d979... by Adam Conrad

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

Imported using git-ubuntu import.

Changelog parent: 06c1c7e89602361c3e825addd91de1707b209b5f

New changelog entries:
  * scripts/casper-helpers: Reintroduce try_mount() function, which was in
    use by (at least) VMWare in a custom installer scenario (LP: #1845535)
  * Persist crash reports as well as logs by default.

06c1c7e... by Michael Hudson-Doyle

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

Imported using git-ubuntu import.

Changelog parent: 2979afca5541784096098cef72db9ea732e4d2b9

New changelog entries:
  * Change the automatic log persistence to store the logs in the 'log'
    directory of the casper-rw filesystem.
  * When using full live session persistence, ignore a 'log' directory in the
    casper-rw filesystem, otherwise booting without and then with full
    persistence breaks.
    - Possibly the whole block of code scanning the casper-rw filesystem
      before using it should be deleted, but one thing at a time.
  * Add autopkgtests for various persistence scenarios, including the above.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/casper.install b/debian/casper.install
2index 30256d2..858cf41 100644
3--- a/debian/casper.install
4+++ b/debian/casper.install
5@@ -12,3 +12,4 @@ scripts usr/share/initramfs-tools
6 conf-hooks.d usr/share/initramfs-tools
7 casper-md5check/casper-md5check usr/lib/casper
8 casper.conf etc
9+systemd/*.service usr/lib/systemd/system
10diff --git a/debian/changelog b/debian/changelog
11index 3db1d94..673359a 100644
12--- a/debian/changelog
13+++ b/debian/changelog
14@@ -1,3 +1,10 @@
15+casper (1.423) UNRELEASED; urgency=medium
16+
17+ * Pacify systemd about cdrom.mount on boot, and order it correctly to be
18+ the last one on shutdown.
19+
20+ -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 04 Oct 2019 22:28:55 +0100
21+
22 casper (1.422) eoan; urgency=medium
23
24 * Add support for url=protocol://path/to/installer.iso netboot
25diff --git a/scripts/casper-bottom/25disable_cdrom.mount b/scripts/casper-bottom/25disable_cdrom.mount
26deleted file mode 100755
27index c02f4cd..0000000
28--- a/scripts/casper-bottom/25disable_cdrom.mount
29+++ /dev/null
30@@ -1,18 +0,0 @@
31-#!/bin/sh
32-
33-PREREQ=""
34-
35-prereqs()
36-{
37- echo "$PREREQ"
38-}
39-
40-case $1 in
41-# get pre-requisites
42-prereqs)
43- prereqs
44- exit 0
45- ;;
46-esac
47-
48-ln -s /dev/null /root/lib/systemd/system/cdrom.mount
49diff --git a/system/cdrom.mount b/system/cdrom.mount
50new file mode 100644
51index 0000000..236c6cc
52--- /dev/null
53+++ b/system/cdrom.mount
54@@ -0,0 +1,36 @@
55+# casper-stop, sometimes, does lazy unmount of /cdrom, and systemd
56+# doesn't like active, yet masked units. Instead of /dev/null'ing
57+# cdrom.mount let's define the behaviour we want.
58+
59+# On boot, systemd complains that cdrom.mount exists, yet is bound to
60+# dev-sr0.device which udev didn't yet "plug". This trips up systemd
61+# to go into verbose mode with messages. All of which is a lie, given
62+# that initrd mounted /cdrom, which later after udev-coldplug systemd
63+# "catches up" with. Declate DefaultDependencies=no to prevent this
64+# nonesence (i.e. implicit cdrom.mount BindsTo=$What.device)
65+
66+# Also, we lie about What=, as it could be anything, but systemd
67+# demands to specify something. Thank-fully systemd will not try
68+# mounting /dev/sr0 ontop of otherwise active cdrom.mount.
69+
70+# Because of DefaultDependenices=no readd stanzas to say that /cdrom
71+# should be unmounted on shutdown, but only after / is unmounted.
72+
73+# Given that things might be mounted from on-top of /cdrom, specify
74+# LazyUnmount=yes.
75+
76+# Note, due https://github.com/systemd/systemd/issues/8587 we specify
77+# a full cdrom.mount unit, rather than a .d drop-in, as /cdrom is not
78+# declared in fstab or via a unit
79+
80+[Unit]
81+DefaultDependencies=no
82+After=casper.service
83+Before=-.mount
84+Before=umount.target
85+Conflicts=umount.target
86+
87+[Mount]
88+Where=/cdrom
89+What=/dev/sr0
90+LazyUnmount=yes

Subscribers

People subscribed via source and target branches