Monday, May 7, 2018

Getting My GRUB On: Adventures in the GRUB Command Shell

A few weeks ago, I inadvertently broke my operating system. I was running Ubuntu 16.04 LTS. Whilst trying to fix a Java problem, I somehow divested myself of all Super User privileges. After attempting to reboot into recovery mode and failing, I resigned myself to the fact that I'd probably have to do transfer all my files to an external drive and a clean OS install as well. What I didn't realize at the time was that I could have used something like SuperGRUB2 to boot into recovery mode and fix my permissions problem... but let's not dwell on that because I'm running out of four-letter words.

So, without delay, I copied all my files over and went OS shopping. I briefly considered reinstalling Ubuntu 16.04 LTS or one of the newer distributions but thought I'd see what else was out there. I landed on Zorin OS - lauded by its makers as the "perfect" replacement for Windows (shout out to Fossbytes for the great info). It installed without a hitch. When I went to restart the computer however, something interesting - and annoying - happened: the computer opened the GRUB command shell and gave me the following prompt:

grub>

I found a great resource for booting from the GRUB command shell here: www.linux.com

Even after trying this however, the computer would continually boot into the GRUB command shell. I tried booting using the SuperGRUB2 disc using a different kernel but the same thing happened over and over again. Also, after a new kernel was installed, the desktop loaded Cinnamon instead of the Zorin OS desktop (which was weird but a symptom of a larger problem). I will say this: I'm still pretty new to Linux and its intricacies and this issue was quickly going over my head. One thing that usually solves issues like this however is a clean install of the OS so I thought I'd just try that.

Once I loaded up the Zorin OS 12.3 disc, it gave me the opportunity to choose the partition on which the OS would be installed. That's when something occured to me: I had previously partitioned part of the hard drive to install Windows on it. It was formatted as NTFS. There were SIX partitions of the 500GB HD with the following information: (hd0, gpt1) = boot, (hd0, gpt2) = UEFI, (hd0, gpt3) = swap, (hd0, gpt4) = NTFS, (hd0, gpt5) = ext4, (hd0, gpt6) = free space. Zorin was installed on (hd0, gpt5).

To make things cleaner, I repartitioned the HD and merged the primary partition and the (previously) NTFS one. It was onto this new partition that I installed the new OS.

The install completed without a hitch and when I restarted the computer, it bypassed the GRUB command shell altogether. Here's what I think happened:

1) Even though GRUB was correctly installed and updated, the NTFS partition confused the boot process and caused it to revert to the shell (forcing me to tell it which partition was the primary, etc.) since there wasn't another OS installed on the partition. Removing the NTFS partition removed the confusion and allowed the computer to boot correctly because I only gave it one choice of primary partitions versus two.

2) During the GRUB shell boot operation, I selected the most recent kernel and initrd file available. Normally, this wouldn't be an issue. However, in Zorin OS, the Software & Updates must come from the "Main Server", not your regional server (according to the forums I read). Here is a screenshot of that menu:



I had selected the North American region. One of the first things I did was change this to "Main Server". I haven't run any updates yet but I'll post again if Cinnamon reappears or something else unintended happens.

TTFN,
Gabe

No comments:

Post a Comment