Minimal BASH like line editing is supported. Boot error on Fedora

18,740

You can get back fedora.

I encountered this issue on my laptop computer each time when the grub2-efi package updated/reinstalled (including system upgraded to next release). It will caused grub2 boot into some kinds of rescue mode like yours.

The grub2-efi package from Fedora seems can't install correctly on my laptop (ASUS TX300, Fedora x86_64, version 18 to 23).

Manual boot

You can boot Fedora manually from this grub2 rescue mode, then fix this issue by reinstalling grub2 to disk. To do it:

  1. Use ls command to list all partitions

  2. Use linuxefi (for EFI) or linux16 (for BIOS) command to specify the linux kernel file, and then specify the root patition using root= parameter, like:

    • root=/dev/sdXN if your root partition is a simple partition
    • or root=/dev/mapper/THE_ROOT_LOGICAL_VOLUME if your root partition is a LVM logical volume
    • or root=/dev/mdN if your root partition is a RAID array
    • or root=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - though this is a universal form, since the UUID string is long, it's the easiest to mistype.

    Example one: linuxefi (hd2,gpt6)/vmlinuz-4.4.2-300.fc23.x86_64 root=/dev/sda8 .
    Example two: linux16 (hd0,msdos1)/vmlinuz-4.4.2-300.fc23.x86_64 root=/dev/mapper/fedora-root

    You can use TAB to auto-complete the vmlinuz part.

  3. Use initrdefi (for EFI) or initrd16 (for BIOS) command to specify the initial ramdisk file.

    Example one: initrdefi (hd2,gpt6)/initramfs-4.4.2-300.fc23.x86_64.img
    Example two: initrd16 (hd0,msdos1)/initramfs-4.4.2-300.fc23.x86_64.img

  4. Type boot to boot Fedora, this will bring your Fedora alive.

  5. Finally, fix grub2-install issue by specifying --target x86_64-efi parameter in grub2-install command
    Example: grub2-install --target x86_64-efi

Then, reboot to see if this issue is fixed.

Don't forget to repeat step 5 when grub2-efi package updated/reinstalled next time


Other information

I still can't figure out why this happened on my laptop, while it works fine on my desktop machine (EFI, x86_64). Maybe it's related to the MicroSD/TF card, but I'm not sure. When TF card is in the internal card reader, it often caused the block device name not fixed: sometimes it's /dev/sdb (HDD is /dev/sdc, SSD is /de/sda), sometimes it's /dev/sdc (HDD is /dev/sdb, SSD is /de/sda).

A little deeper analysis shows that /boot/efi/EFI/fedora/grubx64.efi file does not contain root (partition) information. In the following hexdump (copied from hexedit actually) of /boot/efi/EFI/fedora/grubx64.efi file, "(,gpt6)/grub2" string in 0001D2B0 line does not exists when grub2-efi package updated/reinstalled.

0001D290   00 00 00 00  00 00 00 00  01 00 00 00  00 00 00 00  ................
0001D2A0   00 00 00 00  00 00 00 00  03 00 00 00  18 00 00 00  ................
0001D2B0   28 2C 67 70  74 36 29 2F  67 72 75 62  32 00 00 00  (,gpt6)/grub2...
0001D2C0   01 00 00 00  00 00 5A 5B  5D C3 41 56  41 55 41 54  ......Z[].AVAUAT
0001D2D0   55 48 89 F5  53 49 89 FC  48 8B 76 08  FF 55 00 85  UH..SI..H.v..U..
0001D2E0   C0 BB 01 00  00 00 0F 85  BC 00 00 00  4C 89 E7 89  ........L...L...
Share:
18,740

Related videos on Youtube

mayautobot
Author by

mayautobot

Updated on September 18, 2022

Comments

  • mayautobot
    mayautobot over 1 year

    I am using fedora 22 and windows 8 on my laptop. Recently I updated fedora using yum update command. When I restarted fedora, boot menu is not coming. Instead a black screen is coming with following message:

    Minimal BASH like line editing is supported. For the first word, TAB lists 
    possible command completions. anywhere else TAB lists possible device or file 
    completions.
    

    Can I get back fedora or I have to reinstall it.

    • Admin
      Admin over 8 years
      Does your machine use EFI?
    • Admin
      Admin over 8 years
      Yes, my system uses UEFI.
    • Admin
      Admin over 8 years
      I encountered same issue each time I updated/reinstalled grub2-efi package or reinstalled grub2-efi via grub2-install command
  • mattdm
    mattdm over 8 years
    Ouch. Thanks for the analysis. Have you filed a bug for this?
  • mayautobot
    mayautobot over 8 years
    I followed your @LiuYan instructions, but I am stuck on step2. I ran following commands: grub> ls (lvm/fedora-root) (lvm/fedora-home) (lvm/fedora-swap) (hd0) (hd0, gpt12) (hd0, gpt12) (hd0, gpt11) (hd0, gpt10) (hd0, gpt9) (hd0, gpt8) (hd0, gpt7) (hd0, gpt6) (hd0, gpt5) (hd0, gpt4) (hd0, gpt3) (hd0, gpt2) (hd0, gpt1) (cd0) error: failure reading sector 0x0 from 'cd0' grub> ls (hd0,gpt1) (hd0,gpt1): Filesystem is unknown grub> echo $root hd0, gpt2
  • LiuYan εˆ˜η ”
    LiuYan εˆ˜η ” over 8 years
    @mayautobot, you're listing (hd0,gpt1)/, but your $root said it's (hd0,gpt2)/, you need to check which partition is your /boot partition, if there's no dedicated /boot partition, it may be just a directory in (lvm/fedora-root).
  • LiuYan εˆ˜η ”
    LiuYan εˆ˜η ” over 8 years
    @mattdm, I haven't file a bug yet, I'll file it now. One reason I haven't file it is I can't 100% reproduce this issue -- it works ok on my another PC machine, another reason is I'm focusing on other bugs now (can't suspend laptop in 1 shot, i must suspend twice to actually suspend it. this issue started from kernel 4.0 to kernel 4.1.3, kernel 4.1.4-200.fc22 fixed this, but after upgraded to fedora 23, it occurs again).
  • LiuYan εˆ˜η ”
    LiuYan εˆ˜η ” over 8 years
  • Shadab Faiz
    Shadab Faiz almost 6 years
    what worked for was set root=(hd0,gpt2), set prefix=(hd0,gpt8)/grub2, insmod normal, normal. But everytime i reboot i have to do this task.