Recover grub after reinstall Windows

Hi,

I need to reinstall my windows. But Silverblue is different because of ostree, so it’s not as simple to load a liveCD and use grub-install. How I do that using silverblue? My notebook is not UEFI, it’s a simple Bios.

Thanks.

This may work. It does on UEFI systems so it may on BIOS systems. You’ll need to mount your silverblue root partition to /mnt on a live workstation CD/USB. Do not copy these commands in blindly, I don’t know your partition layout and this won’t match yours.

sudo -s
ls /mnt/ostree/deploy/fedora/deploy/
cd /mnt/ostree/deploy/fedora/deploy/{first directory listed above}
#Mount Boot Partition  /dev/sdX1 or /dev/sdX2 on boot
e.g. mount /dev/sda1 boot
mount --bind /dev dev
mount --bind /dev/pts dev/pts
mount --bind /proc proc
mount --bind /sys sys
chroot .
grub2-mkconfig -o /etc/grub2.cfg # /etc/grub2-efi.cfg for efi
grub2-install /dev/sda
exit
cd /
umount -R /mnt
1 Like

Thanks @pluto, it worked correctly!

1 Like

I’m actually surprised because I wrote those instructions off the top of my head :stuck_out_tongue:

1 Like

I am surprised how grub2-mkconfig works for you in a chroot. I always get the error that it cannot find the device for / (and tells me to check that /dev mounted). I’m not surprised that it cannot find that root device because inside the ostree, you are in a subfolder of the root device and mount does not show the root device.

My solution was to modify grub.cfg manually and when restarted in Fedora, redeploy the system using rpm-ostree. See: http://mildred.fr/quick-posts/2020-04-28-moving-fedora-silverblue-to-another-hdd/