Ubuntu – Can’t get out of grub terminal

18.04bootgrubrescue

After a boot-repair, ironically, my grub is broken. When I starty laptop, it boots into terminal, it's written 'grub>_'

I searched for solutions, like 'set prefix, set root and insmod normal' and 'linux /boot/….' . None of these 2 solutions are working. Can anyone help with that?

Note: Due to another boot issue, I am not able to boot via a live usb.

Best Answer

  • If your grub menu does not appear but the grub prompt with black screen shows, as long as your Linux system is still intact you can bypass the grub stage and boot directly into Ubuntu. Once you've done that you can easily fix grub from there. The steps to boot up are as follows:

    a) First remove all external drives. Determine where your root partition is. In this case we already know it's sda5. If you don't know and you have one disk you can find out by typing ls (hd0,x)/ trying different values for 'x' which is the number of the root partition on that disk. If you have more than one disk you may have to use hd1 or a higher number if you don't know which disk Ubuntu is installed on. Once you hit the right disk/partition numbers you'll see listed the basic system folders and the 2 files vmlinuz and initrd. Note these 2 files are symlinks to the kernel and initrd image respectively but they must be present.

    b) Now set the root with set root=(hd0,5) or whatever is the correct combination for disk/partition you found in (a). Press Enter.

    c) Now we need to map the linux kernel to root. Type linux /boot/vm. At this point press the Tab button. The command will partially complete by offering a choice of (usually) 2 kernel versions. Take the higher number by typing it and press Tab button again. The whole kernel version number should autocomplete. You should be seeing something like linux /boot/vmlinuz-4.15.0-55-generic depending on kernel version. You still need to add root=/dev/sda5 to this line. So the whole command is linux /boot/vmlinuz-4.15.0-55-generic root=/dev/sda5. Press Enter.

    d) Now we do similar for initrd. Type initrd /boot/in then press Tab button. Again it will offer 2 versions so choose the same version as in c) using Tab button again to autocomplete. You should see something like initrd /boot/initrd.img-4.15.0-55-generic as the complete command, depending on kernel version. Press Enter.

    e) Then type boot. Press Enter.

    After a a couple of minutes of splash screen activity you will eventually reach the user login screen, then proceed as normal. If during boot-up you reach the intrafms prompt and booting stops, you've probably mistyped something in the earlier stages and need to start again. Remember, this process boots you into Linux. Grub still needs a couple more commands to fix it once you're in.

  • Related Question