Fedora25 boot into grub prompt

On starting my PC after it powered off due to low battery, I was met with a grub prompt  as shown below

grub prompt

I didn’t have explanation for what had happened cause my PC hadn’t failed or given warning prior to this, but I made an update earlier which I suspected could be buggy or didn’t complete before I lost internet connectivity but nonetheless I had to fix this.

My working knowledge of grub2 was minimal since grub2 config is automatically installed and configured. Being a Fedoraproject user I found  this  good  wiki resource on fedoraproject. I followed the wiki page and was able to fix the problem though not immediately, I hope my solution would help someone using lvm and device mapper device types, below is a sample of my df -h before the issue

lvm partition details

Lets start working on fixing the issue, on the grub prompt run the command ls

Note: Below is how it appeared on my grub terminal, yours could be a little different especially if you aren’t using lvm
grub> ls
(hd0) (hd0,gpt1) (hd0,gpt2) (hd0,gpt3) (lvm/fedora-swap) (lvm/fedora-root) (lvm/fedora-home)

 

from the listed entries above you would need to find where your root file system in installed and also where your kernel (vmlinuz and initramfs) entries was installed, below are my own entry

Note if you don’t add the “/” at the back of the filesystem it would only give you the type of filesystem you are trying to access e.g ext2 or fat.
grub> ls (hd0,gpt2)/

kernel entries

 

grub> ls (lvm/fedora-root)/

Os root treeOnce you got the above previous entries you are good to go, just do the following

Note: first value passed to root is from ls result where our os tree reside, yours could be different based on device type
*linuxefi and initrdefi are for efi type, linux and initrd works for non efi.
*the root value is the device type for lvm, check the fedora wiki page for other scenario

grub> set root=(lvm/fedora-root)
grub> linuxefi (hd0,gpt2)/vmlinuz-4.9.4-201.fc25.x86_64 root=/dev/mapper/fedora-root rhgb quiet selinux=0
grub>initrdefi (hd0,gpt2)/initramfs-4.9.4-201.fc25.x86_64.img
grub>boot

Once it has finish booting you can open a terminal and

grub2-mkconfig -o /boot/grub2/grub.cfg

Issue the grub2-install command to install grub2 to your hard drive and make use of your config:

grub2-install –boot-directory=/boot /dev/sda # Note: your drive may have another device name. Check for it with mount command output.

The command above is likely to fail for efi system, try the below if that happens

# dnf install grub2-efi-modules
# grub2-install –boot-directory=/boot /dev/sda.

7 thoughts on “Fedora25 boot into grub prompt

  1. Gretta says:

    This really answered my problem, thank you!

  2. Janice says:

    This is a matter close to my heart cheers. Thanks

  3. Chong says:

    Greetings! Quite helpful guidance on this article! It really is the
    small changes that make the largest changes. Thanks a lot for sharing!

  4. Alex says:

    Really great post, I certainly adore this website, keep on it.

  5. Darren says:

    Hi there! This post couldn’t be written any better!
    Reading through this post reminds me of my previous room mate!
    He consistently kept talking about this. I ‘ll forward this article to him.

    Quite confident he’ll have a great read. Thank you for sharing!

  6. Amie says:

    I adore it when folks come together and share views,
    great blog, keep it up.

  7. Valeria says:

    This really replied my problem, thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *