bootupd icon indicating copy to clipboard operation
bootupd copied to clipboard

Support for adopt --with-static-configs

Open cgwalters opened this issue 2 years ago • 1 comments

It'd be nice to be able to convert Fedora ostree+Anaconda users to bootupd --with-static-configs.

cgwalters avatar Dec 06 '23 19:12 cgwalters

Until this is implemented, one can just reinstall the bootloader (tested on EL 9.5)

cat > /usr/lib/systemd/system/bootloader-adopt.service <<'EOF'
[Unit]
Description=bootloader adopt
ConditionPathExists=!/boot/bootupd-state.json
Before=bootloader-update.service

[Service]
Type=oneshot
ExecStart=/usr/libexec/bootloader-adopt
RemainAfterExit=yes
# Keep this stuff in sync with SYSTEMD_ARGS_BOOTUPD in general
PrivateNetwork=yes
ProtectHome=yes
KillMode=mixed
MountFlags=slave
# inhibit locks are ignored by reboot/poweroff (need to use systemctl)
# so delay being killed as much as possible
KillSignal=SIGCONT

[Install]
WantedBy=multi-user.target
EOF
cat > /usr/libexec/bootloader-adopt <<'EOF'
#!/usr/bin/bash
set -euo pipefail

# We reinstall the bootloader as we also want to "adopt" grub.cfg
# https://github.com/coreos/bootupd/issues/578

PART=$(findmnt --noheadings --nofsroot --output SOURCE /boot)
echo "/boot partition = ${PART}"
DISK=$(lsblk --paths --noheadings --output PKNAME "${PART}")
echo "/boot disk = ${DISK}"
echo "Reinstalling bootloader using bootupd"
bootupctl backend install --auto --write-uuid --update-firmware --device "${DISK}" /
sync -f /boot
if [ -e /boot/efi ]; then
    sync -f /boot/efi
fi
EOF

champtar avatar Jan 14 '25 15:01 champtar

I think this is implemented in https://github.com/coreos/bootupd/pull/945

travier avatar Jun 27 '25 14:06 travier