Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for adopt --with-static-configs #578

Open
cgwalters opened this issue Dec 6, 2023 · 1 comment
Open

Support for adopt --with-static-configs #578

cgwalters opened this issue Dec 6, 2023 · 1 comment

Comments

@cgwalters
Copy link
Member

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

@champtar
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants