English
Ask Your Question
3

How to reinstall or fix GRUB in Fedora without a recovery option on the Live CD?

asked 2014-02-02 12:18:49 +0000

Bucic gravatar image

updated 2017-01-13 21:08:16 +0000

mattdm gravatar image

The recovery entry seems to be no longer available in Fedora 20 livecd, so I had to do grub reinstallation. Normally you'd go grub2-install /dev/sda but it returns the following error:
Path ‘/boot/grub2’ is not readable by GRUB on boot. Installation is impossible. Aborting.

System details:
BIOS system (non-UEFI)
My /boot seems to be on sda2 (don't know how to verify that), my main system partition.
Microsoft basic data* means ext4 partition
no separate /boot partition
sda3 is another fedora install.

mount | grep -i boot returns nothing when I issue this command while booted into my main (sda2) system.

fdisk -l
...
Disk /dev/sda: 55.9 GiB, 60022480896 bytes, 117231408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: XXX

Device           Start          End   Size Type
/dev/sda1         2048       264191   128M BIOS boot partition
/dev/sda2       264192     52582399    25G Microsoft basic data
/dev/sda3     52582400    117229567  30.8G Linux LVM
...
edit retag flag offensive close merge delete

Comments

If your boot partition is on sda2, why would the "Type" be "Microsoft basic data"? Check to see where it's mounted with mount |grep -i boot. Also, make sure the same partition that has the /boot/ directory is listed in your /etc/fstab file.

ILMostro ( 2014-02-02 15:46:29 +0000 )edit

@Ahmad Samir I know. This is why let's forget about the "rescue" mode. If I could/wanted to run the live dvd I wouldn't bother asking this question.

Bucic ( 2014-02-02 20:43:33 +0000 )edit

25GBs for boot partition ? I doubt. Most likely the /dev/sda1/ (BIOS boot partition). Do you have a separate /boot partition (have you created one ? ) , or you mean /dev/sda2 is you Fedora root / (installation) and /boot is included there ?

NikTh ( 2014-02-03 06:59:39 +0000 )edit

OP has to be clarified; the ongoing comments are not helping much

ILMostro ( 2014-02-03 22:13:24 +0000 )edit

Please don't expect me to clarify confusion you yourself introduce. OP edited to explicitly state there is no separate /boot partition on my system. "Microsoft basic data" explained.

Bucic ( 2014-02-05 19:15:18 +0000 )edit

3 answers

Sort by » oldest newest most voted
8

answered 2014-02-02 16:29:23 +0000

Ahmad Samir gravatar image

updated 2014-02-03 17:50:09 +0000

AFAIK, the "rescue" boot option is available only with the Fedora installation DVD iso (4GB+), not the Live media.

EDIT: expanding the above.

First of all you have a GPT-labelled HDD, so I think /dev/sda1 is a BIOS Boot Parition which is needed to boot from a GTP HDD on non-UEFI systems. I've never had this setup but it seems that grub2-install should work c.f. https://wiki.archlinux.org/index.php/GRUB#GUID_Partition_Table_.28GPT.29_specific_instructions

IIUC, to re-install grub2 using a Live CD, you'd need to:

1- Boot into the Live session and create a directory to mount your installation filesystem e.g. /mnt/sysimage

2- Mount your / at /mnt/sysimage, since you have LVM you'll need to mount the logical volume for your /, note that I've never used LVM so you can't help you there...

3- If you have a separate /boot partition (which in case of using LVM you most likely do), mount it at /mnt/sysimage/boot, this is most likely /dev/sda1, you should check /etc/fstab of the installed system after you mount /. As was posted by others /dev/sda2 is has a windows filesystem (NTFS probably) so it's not /boot.

4- Mount bind these ones:

mount --bind /dev /mnt/sysimage/dev
mount --bind /proc /mnt/sysimage/proc
mount --bind /sys /mnt/sysimage/sys 

You do need the /dev mount bind, it seems to work without having to mount /proc or /sys.

5- Then chroot:

chroot /mnt/sysimage

6- Reinstall grub2:

grub2-install /dev/sda

Someone at fedoraforum.org posted about an alternative method, after step 3 above you can reinstall grub2 like this:

grub2-install --root-directory=/mnt/sysimage /dev/sda

I did test it on a non-LVM setup (in a VM) and it seems to work. Edit: I forgot to add that using the 'grub2-install --root-directory' method would work best if the grub2 version in the Live session is the same (or as near as possible) as the installed system, i.e. using an F20 Live CD to re-install a grub2 on an F20 installed system.

edit flag offensive delete link more

Comments

I'll test the method the next time I brake grub, which shouldn't take long ;) Any idea what made my case so special that it's not covered in the fedora Grub2 wiki?

Bucic ( 2014-02-05 19:30:48 +0000 )edit
3

That rescue mode should also be available on the network install .iso file - so if you're getting it from somewhere on the Internet, it's a much smaller download+cook time. Also the rescue mode can automatically search for and mount your fedora system (i.e. steps 2, 3 and 4 of your detailed solution).

Cobra ( 2014-02-06 10:41:41 +0000 )edit

Two notes:

  1. On my system, the boot drive is /dev/sdc1. I got a lot of errors until I realized I had to leave out the drive number in the grub2-install command (sdc instead of sdc1). Following advice on other websites, I also added a "recheck" switch: grub2-install --recheck /dev/sdc
  2. After running grub2-install I had to remake the grub menu using grub2-mkconfig -o /boot/grub2/grub.cfg
MichaelClerx ( 2014-08-05 17:22:26 +0000 )edit

This worked for me on Fedora 19. After restoring a Clonezilla image, my PC would boot to the GRUB prompt and get stuck there. The GRUB menu of available linux kernels never displayed. It turns out I needed to reinstall grub.

I have an out-of-the-box fedora installation (using LVM). This is what I mounted in steps 2 and 3:

mount /dev/fedora/root /mnt/sysimage

mount /dev/sda1 /mnt/sysimage/boot

Thank you Ahmad for a great answer.

ann b ( 2014-09-09 22:18:06 +0000 )edit

This solved my grub2 boot! now I am up and running, thank you!

imbagwapito ( 2014-12-26 20:19:32 +0000 )edit
2

answered 2015-03-12 10:52:52 +0000

Install grub2-efi-modules, if grub2-install complains about missing /usr/lib/grub/x86_64-efi

edit flag offensive delete link more

Comments

exact error (for those doing a web search)

grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

i also got "grub2-install: error: cannot find EFI directory." until i separately mounted the efi partition to /mnt/sysimage/boot/efi

kxra ( 2016-05-20 16:35:41 +0000 )edit

I encountered '/usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist.' on Step 6, but because I am using standard BIOS PC, so I had to add --target=i386-pc at the end of the grub2-install command

MazterGee ( 2017-05-03 21:56:55 +0000 )edit
0

answered 2014-02-02 16:26:11 +0000

Marc van der Wijst gravatar image

updated 2014-02-02 16:26:41 +0000

Have you tried restoring Grub by booting from the live-DVD?

Please see my answer on this question on howto do this: https://ask.fedoraproject.org/en/question/34772/can-not-find-fedora-19-after-reinstalling-windows-7/

edit flag offensive delete link more

Comments

Could you copy-paste the relevant part of the linked answer here? There's a lot of 'non-standard' commands there and I'm afraid some of them may be not valid for my case.

Bucic ( 2014-02-02 20:41:36 +0000 )edit

@Bucic this is the chroot method. You will use the second set of commands, but you have to boot from a Live Fedora media.

NikTh ( 2014-02-03 07:03:27 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools

Follow
3 followers

Stats

Asked: 2014-02-02 12:18:49 +0000

Seen: 123,289 times

Last updated: Jan 13