Skip to content

Instantly share code, notes, and snippets.

@nateheat
Last active June 16, 2024 17:02
Show Gist options
  • Save nateheat/67a7aa41d7ebbd0796f15aa24f8f744c to your computer and use it in GitHub Desktop.
Save nateheat/67a7aa41d7ebbd0796f15aa24f8f744c to your computer and use it in GitHub Desktop.
re-install grub using Fedora Live CD. Fedora was installed with LVM. The system dual boots Ubuntu and Fedora.
su
mkdir /mnt/root
# You may use fdisk -l to list the devices
mount /dev/mapper/fedora-root /mnt/root
# Mount the boot partition, maybe /dev/sda1
# As the system has both Ubuntu and Fedora installed,
# so sda3 in my case
mount /dev/sda<3> /mnt/root/boot
mount -t proc none /mnt/root/proc
mount -o bind /dev /mnt/root/dev
# change root directory
chroot /mnt/root /bin/bash
# [Re]install grub
grub2-install /dev/sda
# References:
# http://thecreationist.expertscolumn.com/article/recover-grub-using-fedora-live-cd
# https://ask.fedoraproject.org/en/question/40578/how-to-reinstall-or-fix-grub-in-fedora-without-a-recovery-option-on-the-live-cd/?answer=40593#post-id-40593
@albfan
Copy link

albfan commented Nov 5, 2023

If you wonder where is your fedora-root you might need to enable first:

$ sudo vgscan
Found volume group "fedora_localhost-live" using metadata type lvm2
$ sudo vgchange -ay fedora_localhost-live
3 logical volume(s) in volume group "fedora_localhost-live" now active

those should be typically root, home and swap, available now on /dev/mapper/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment