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


Groups > linux.debian.kernel > #80472 > unrolled thread

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

Started by"Trent W. Buck" <trentbuck@gmail.com>
First post2023-09-18 10:00 +0200
Last post2023-09-18 10:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.debian.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

From"Trent W. Buck" <trentbuck@gmail.com>
Date2023-09-18 10:00 +0200
SubjectBug#778849: Support restoring initrd on shutdown and pivoting into it
Message-ID<HfhkJ-9M73-1@gated-at.bofh.it>

[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.)

[toc] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web