From b341c81ff3f3f800a2638a669eae9d4711f8d249 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 29 Jul 2021 11:57:04 +1200 Subject: [PATCH] do the mounting in an initrd script rather than systemd units --- .../hooks/03-kernel-metapkg.chroot_early | 13 +++++++++++++ .../usr/lib/systemd/system/media-filesystem.mount | 9 --------- .../usr/lib/systemd/system/media-full.mount | 5 ----- .../usr/lib/systemd/system/media-minimal.mount | 5 ----- 4 files changed, 13 insertions(+), 19 deletions(-) delete mode 100644 live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-filesystem.mount delete mode 100644 live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-full.mount delete mode 100644 live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-minimal.mount diff --git a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early index dda5a149..864d4c4c 100755 --- a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early +++ b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early @@ -18,6 +18,14 @@ case $PASS in ;; esac +# Add a script to record which kernel meta-package to use and to set +# up the /media/filesystem mount that subiquity currently depends +# on. It would be cleaner to do this mount in a systemd mount unit but +# that doesn't work because we mask the cdrom mount to avoid strange +# issues with the handover from the initrd to systemd in the live +# session. In any case, subiquity will sooner or later not require +# this mount to be here at all and then we can delete these mount commands. + cat < /etc/initramfs-tools/scripts/init-bottom/live-server #!/bin/sh case \$1 in @@ -25,6 +33,11 @@ prereqs) exit 0;; esac echo ${kernel_metapkg} > /run/kernel-meta-package + +mkdir -p \${rootmnt}/media/filesystem \${rootmnt}/media/full \${rootmnt}/media/minimal +mount -o ro -t squashfs \${rootmnt}/cdrom/casper/ubuntu-server-minimal.squashfs \${rootmnt}/media/minimal +mount -o ro -t squashfs \${rootmnt}/cdrom/casper/ubuntu-server-minimal.ubuntu-server.squashfs \${rootmnt}/media/full +mount -o ro,lowerdir=\${rootmnt}/media/full:\${rootmnt}/media/minimal -t overlay overlay \${rootmnt}/media/filesystem EOF chmod +x /etc/initramfs-tools/scripts/init-bottom/live-server diff --git a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-filesystem.mount b/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-filesystem.mount deleted file mode 100644 index 2570aaf2..00000000 --- a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-filesystem.mount +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Requires=media-full.mount media-minimal.mount -After=media-full.mount media-minimal.mount - -[Mount] -What=/cdrom/casper/ubuntu-server-minimal.ubuntu-server.squashfs -Where=/media/filesystem -Type=overlay -Options=ro,lowerdir=/media/full:/media/minimal diff --git a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-full.mount b/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-full.mount deleted file mode 100644 index 7c96a46e..00000000 --- a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-full.mount +++ /dev/null @@ -1,5 +0,0 @@ -[Mount] -What=/cdrom/casper/ubuntu-server-minimal.ubuntu-server.squashfs -Where=/media/full -Type=squashfs -Options=ro diff --git a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-minimal.mount b/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-minimal.mount deleted file mode 100644 index 0d606898..00000000 --- a/live-build/ubuntu-server/includes.chroot.ubuntu-server-minimal.ubuntu-server.installer/usr/lib/systemd/system/media-minimal.mount +++ /dev/null @@ -1,5 +0,0 @@ -[Mount] -What=/cdrom/casper/ubuntu-server-minimal.squashfs -Where=/media/minimal -Type=squashfs -Options=ro