What to do if you see GNU GRUB version and no login screen in Linux

Written by Administrator on Thursday April 2, 2020

Sometimes an error can happen and you will see following message on startup:
 

GNU GRUP Version 2.02

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.

So, something went wrong, but its not a problem. Let's repair it:

Don't be afraid, every situation has solution. Let's go:

Now your system "doesn't know", how to boot, meaning where correct boot information is stored. Let's help it.

First of all we have to find, where boot information is stored.

1. Type ls.

grub> ls

You will probably see something like this:

(hd0) (hd0,msdos2) (hd1) (hd1,gpt2) (hd1,gpt1) (cd0)

Now, we have to find, where /boot folder is located. Have you ever tried manual brute-force search? No? Great, let's go! Try to find boot/ folder this way:

grub> ls (hd0,1)/
grub> ls (hd0,2)/
grub> ls (hd0,3)/
...
grub> ls (hd1,1)/
grub> ls (hd1,2)/
grub> ls (hd1,3)/
...

Keep trying, until system replies you with the list of many folder (actually, your system tree). Like this:

Great, we've found it!

In my case I've found boot/ folder in (hd0,gpt2) partition. Your story could be different: (hd0, 1) or (hd1,1) or (hd1,2) or .. Just remember this location, later we will need it.

Now, let's check, what information is in boot/ folder. So, my case is (hd0,gpt2), so, I'm trying to look inside boot/ folder:

grub> ls (hd0,gpt2)/boot

In one my case I got this (watch screenshot above):

./ ../ efi/ memtest86+.bin memtest86+.elf memtest86+_multiboot.bin grub/ config-4.15.0-91-generic System.map-4.15.0-91-generic vmlinuz-4.15.0-91-generic initrd.img-4.15.0-91-generic

in other case I got this:

Anyway, we are interested in version of vmlinuz. In first case I have only one version (vmlinuz-4.15.0-91-generic) in second case I have two versions ( first:  vmlinuz-4.15.0-46generic and second: vmlinuz-4.15.0-91-generic). When you have only one version - choose and remember it, if you have two version: try to work with the first and then with the second one). Remember this name: vmlinuz-4.15.0-91-generic, in your case you can have another version and another numbers.

Next, we have to find a proper partition. Scheme is following:

GRUB id description linux id
(hd0,1) first partition of disk 1 /dev/sda1
(hd0,2) second partition of disk 1 /dev/sda2
(hd1,1) first partition of disk 2 /dev/sdb1
(hd1,2) second partition of disk 2 /dev/sdb2
(hd1,3) third partition of disk 2 /dev/sdb3

I believe you understood the logic.

Next step is to set correct initrd. You can find it in the results of running ls command (see text above). So, let's continue:

grub> set root=(hd0,gpt2)

In your case it will be "set root=(hd1,1)" or "set root=(hd0,1)", - regarding your settings.

Now we have to run linux command to set vmlinuz path:

grub> linux /boot/vmlinuz-4.15.0-91-generic root=/dev/sda2

You see, that's why should remember the precise name of "vmlinuz-...." file and partition.

Then we should run initrd command, where we are using the name of "initrd.img-..." file (which we've got from running ls command (see above)). In my case it's initrd.img-4.15.9-91-generic.

grub> initrd /boot/initrd.img-4.15.0-91-generic

Actually it's all for now, and we have to reboot:

grub> boot

After reboot you have to see normal login screen. If not and you're again in grub-command line menu, just go through this manual again, but carefully.

When you're back in your system, it's good to update GRUB:

$ sudo update-grub2

and install it to correcto partition:

$ sudo grub-install /dev/sda2

That's all!

Category: linux Tags: GRUB vmlinuz initrd