Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #80472

Bug#778849: Support restoring initrd on shutdown and pivoting into it

From "Trent W. Buck" <trentbuck@gmail.com>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#778849: Support restoring initrd on shutdown and pivoting into it
Date 2023-09-18 10:00 +0200
Message-ID <HfhkJ-9M73-1@gated-at.bofh.it> (permalink)
References <oVYjo-80O-3@gated-at.bofh.it> <ttc3v-6L0-3@gated-at.bofh.it> <ttz05-5HY-13@gated-at.bofh.it> <oVYjo-80O-3@gated-at.bofh.it> <ttz05-5HY-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri 07 Apr 2017 12:02:46 +0200, intrigeri wrote:
> /lib/systemd/system/initramfs-shutdown.service:
>     ⋯
> /usr/share/initramfs-tools/initramfs-restore:
>     ⋯
>     /usr/bin/unmkinitramfs /initrd.img "$WORKDIR"
>     ⋯
> /lib/systemd/system-shutdown/initramfs-tools:
>     ⋯
> /usr/share/initramfs-tools/hooks/shutdown:
>     ⋯
>     copy_exec /lib/systemd/systemd-shutdown /shutdown
>     touch $DESTDIR/etc/initrd-release

I am interested in this ticket for two use cases:

    a. netbooting Debian Live on diskless hosts.
    b. "zpool export -a" on servers.

I am only considering case (a), below.

I tried intrigeri's approach for Debian Live but I ran into a couple of problems:

    1. it assumes /initrd.img inside the rootfs exists and
       is consistent with the already-running system.
       This is not the case for me (I remove it to save space), and
       also not necessarily the case during upgrades.

    2. it tries to unpack /initrd.img after systemd-networkd stops.
       Without KeepConfiguration= (which is a pain to guarantee),
       that means no network access, which means no access to remote rootfs.

I instead tried just keeping the boot initrd around.
Using a simple bind-mount didn't work (I don't understand why) – SOME files are missing after switch_root.
Doing a full cp -a did work, though.

This method seems to work for my very simple test case of failed-to-unmount-rootfs error going away.
I'm really not happy with it overall, though.
I've run out of "time budget" to work on this in the short term.

    https://github.com/cyberitsolutions/bootstrap2020/tree/twb/doc/workaround-778849

PS: I looked at dracut, but it's simply unsupported for live-boot (Debian Live / Tails), and
    for servers, I found it unreliable (much worse than initramfs-tools).
    (e.g. if bash has a security update, dracut doesn't trigger and the embedded copy of bash in the initrd remains vulnerable.)
    (e.g. telling dracut to use only busybox/klibc and not bash breaks, because lots of dracut components need bash but don't declare a dependency on it.)
    (e.g. dracut is written in bash and regularly has errors but doesn't exit non-zero, so you do not notice until the server doesn't actually boot anymore.)

Back to linux.debian.kernel | Previous | Next | Find similar | Unroll thread


Thread

Bug#778849: Support restoring initrd on shutdown and pivoting into it "Trent W. Buck" <trentbuck@gmail.com> - 2023-09-18 10:00 +0200

csiph-web