8

I have installed Linux Mint Cinnamon, but whenever I turn my PC on it goes into the grub shell, I dont know why, and I also don't know how to boot GUI Linux Mint from shell, please help me

4
  • Can you add the screen photo?
    – MiniMax
    Commented Aug 4, 2017 at 15:24
  • Is Mint not listed in GRUB's boot entries? If not, you may need to run update-grub to make GRUB auto-detect your operating systems and list them. You should probably do this from a live CD or USB (or however you installed Mint in the first place). See this question for instructions: askubuntu.com/questions/145241/…
    – cat
    Commented Aug 4, 2017 at 15:27
  • @Minimax it only shows a grub text followed by '>' sign, and nothing I just want to boot into Cinnamon! but how? Commented Aug 4, 2017 at 15:40
  • Some information about the GRUB troubleshooting
    – MiniMax
    Commented Aug 4, 2017 at 16:23

2 Answers 2

14

I have the same problem! The solution is here: https://www.linux.com/tutorials/how-rescue-non-booting-grub-2-linux/

Quoted from the above mentioned website.

[...]

The GRUB 2 command shell is just as powerful as the shell in legacy GRUB. You can use it to discover boot images, kernels, and root filesystems. In fact, it gives you complete access to all filesystems on the local machine regardless of permissions or other protections. Which some might consider a security hole, but you know the old Unix dictum: whoever has physical access to the machine owns it.

When you’re at the grub> prompt, you have a lot of functionality similar to any command shell such as history and tab-completion. The grub rescue> mode is more limited, with no history and no tab-completion.

If you are practicing on a functioning system, press C when your GRUB boot menu appears to open the GRUB command shell. You can stop the bootup countdown by scrolling up and down your menu entries with the arrow keys. It is safe to experiment at the GRUB command line because nothing you do there is permanent. If you are already staring at the grub> or grub rescue>prompt then you’re ready to rock.

The next few commands work with both grub> and grub rescue>. The first command you should run invokes the pager, for paging long command outputs:

grub> set pager=1

There must be no spaces on either side of the equals sign. Now let’s do a little exploring. Type ls to list all partitions that GRUB sees:

grub> ls
(hd0) (hd0,msdos2) (hd0,msdos1)

What’s all this msdos stuff? That means this system has the old-style MS-DOS partition table, rather than the shiny new Globally Unique Identifiers partition table (GPT). If you’re running GPT it will say (hd0,gpt1). Now let’s snoop. Use the ls command to see what files are on your system:

grub> ls (hd0,1)/
lost+found/ bin/ boot/ cdrom/ dev/ etc/ home/  lib/
lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ 
srv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old
initrd.img initrd.img.old

Hurrah, we have found the root filesystem. You can omit the msdos and gpt labels. If you leave off the slash it will print information about the partition. You can read any file on the system with the cat command:

grub> cat (hd0,1)/etc/issue
Ubuntu 14.04 LTS n l

Reading /etc/issue could be useful on a multi-boot system for identifying your various Linuxes.

Booting From grub> This is how to set the boot files and boot the system from the grub> prompt. We know from running the ls command that there is a Linux root filesystem on (hd0,1), and you can keep searching until you verify where /boot/grub is. Then run these commands, using your own root partition, kernel, and initrd image:

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

The first line sets the partition that the root filesystem is on. The second line tells GRUB the location of the kernel you want to use. Start typing /boot/vmli, and then use tab-completion to fill in the rest. Type root=/dev/sdX to set the location of the root filesystem. Yes, this seems redundant, but if you leave this out you’ll get a kernel panic. How do you know the correct partition? hd0,1 = /dev/sda1. hd1,1 = /dev/sdb1. hd3,2 = /dev/sdd2. I think you can extrapolate the rest. The third line sets the initrd file, which must be the same version number as the kernel.

The fourth line boots your system.

On some Linux systems the current kernels and initrds are symlinked into the top level of the root filesystem:

$ ls -l /
vmlinuz -> boot/vmlinuz-3.13.0-29-generic
initrd.img -> boot/initrd.img-3.13.0-29-generic

So you could boot from grub> like this:

grub> set root=(hd0,1)
grub> linux /vmlinuz root=/dev/sda1
grub> initrd /initrd.img
grub> boot

Booting From grub-rescue>

If you’re in the GRUB rescue shell the commands are different, and you have to load the normal.mod and linux.mod modules:

grub rescue> set prefix=(hd0,1)/boot/grub
grub rescue> set root=(hd0,1)
grub rescue> insmod normal
grub rescue> normal
grub rescue> insmod linux
grub rescue> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub rescue> initrd /boot/initrd.img-3.13.0-29-generic
grub rescue> boot

Tab-completion should start working after you load both modules.

Making Permanent Repairs

When you have successfully booted your system, run these commands to fix GRUB permanently:

# update-grub
Generating grub configuration file ...
Found background: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga
Found background image: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga
Found linux image: /boot/vmlinuz-3.13.0-29-generic
Found initrd image: /boot/initrd.img-3.13.0-29-generic
Found linux image: /boot/vmlinuz-3.13.0-27-generic
Found initrd image: /boot/initrd.img-3.13.0-27-generic
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
# grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

When you run grub-install remember you’re installing it to the boot sector of your hard drive and not to a partition, so do not use a partition number like /dev/sda1.

Author: Carla Schroder

0
1

I had the same issue when I tried to upgrade Ubuntu on my computer not too long ago.

I used the following source to get me started: https://www.linuxfoundation.org/blog/blog/classic-sysadmin-how-to-rescue-a-non-booting-grub-2-on-linux

But I did run into a couple issues that the website did not touch upon and I wanted to elaborate to help anyone else that may run into the same issue.

If you read through the article, the main commands is as follows:

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

My main issue was the command root=/dev/sda1

My computer did not have that option. So when I entered that into the grub CLI and attempted to boot into the OS, it failed and I was taken back to the grub.

My computer has a NVM express (NVMe) pci SSD so that is why putting root=/dev/sda1 did not work.

The following site (https://www.cyberciti.biz/faq/linux-list-disk-partitions-command/) gives a breakdown of the different types of disks:

/dev/hd* – IDE disks. /dev/hda will be first IDE hard disk, /dev/hdb will be second IDE hard disk, and so on.

/dev/sd* – SCSI or SATA disks including SSDs. /dev/sda will be first SATA/SCSI hard disk, /dev/sdb will be second SATA/SCSI hard disk, and so on.

/dev/nvme* – NVM Express (NVMe) pci SSD. /dev/nvme0n1 will be first NVMe SSD, /dev/nvme1n1 will be second NVMe SSD, and so on.

The grub is not like a normal CLI and only has a limited amount of commands that can be run.

I had to run cat /etc/fstab in the grub to find out the exact name of the disk.

When running cat /etc/fstab in the grub, the output that I saw was:

grub> cat /etc/fstab
# /etc/fstab: static filesystem information.
...
# <filesystem> <mountpoint> <type> <options> <dump> <pass>
# / was on /dev/nvmeXXXXX during installation
UUID=XXXXXXXXXXX / ext4 errors=remount-ro 0

I was able to determine that I should be using /dev/nvmeXXXXX so the commands I used to get back to my OS was:

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/nvmeXXXXX
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .