Without a working operating system, your rig isn’t really a computer.
It can be a very opaque problem, with no easy way to drill down into the root cause.
And without determining what the issue is, how can you fix it?
Jordan Gloor / How-To Geek
On Linux,GRUBis the software that controls the boot process.
If you havemultiple operating systems installed, it let’s you pick the one you want to boot into.
GRUB is controlled by its configuration.
It relies on other supporting files too, for perform its functions.
If any of these are missing or become corrupted, GRUB won’t work.
Changes to the hard drives and partitions of your system need to be reflected in GRUB’s configuration.
This is an advanced version of GRUB that was released back in 2012.
This is a minimalist environment that will let you perform a handful of actions.
Done correctly, however, these steps can resurrect your box.
There are two different GRUB shells.
Once your setup has booted, you’re in a much better position to cure the root cause.
The commands you have access to are not the same as the usual Linux versions.
For example, the GRUB shelllscommand isn’t the Bashlscommand.
It has very little in common with it.
We can see this by using the–helpoption.
It lists five options only.
That’s a far cry from thedozens of optionssupported bylsin Bash.
Nevertheless, even with our somewhat muted palette of commands, we can still rectify the situation.
At the prompt, typelsand hit “Enter.”
On this computer, it lists three items.
The “gpt” label stands forGUID partition table.
To look at the partitions in turn, we’ll usels.
We’ve found that the second partition has a Linux file system on it.
We’ll investigate a little further by looking at the root directory of that partition.
Clearly, this is theLinux partition, withthe boot directoryon it.
This is where the GRUB files, Linux boot images, and other boot files are stored.
On this computer, we’ll need to reference partition(hd0,2)when we issue our commands.
On your system you’d use whatever partition you find your Linux installation on.
It’s also great for looking inside configuration files.
We need to specify which Linux kernel to boot from.
We do this with thelinuxcommand.
On our example computer, we’re using(hd0)which is the first hard drive.
This is calledsdain the usual Linux nomenclature.
We found that the second partition is the Linux partition, so we need to specifysda2.
Your machine might be different.
We also need to specify whichRAM-based file system image to use when the computer boots.
This must use the same numerical component as the Linux kernel we’re using.
Now, to boot our system, bang out “boot” and hit “Enter.”
This should boot your gear up into Linux.
This will scan our system, identify operating systems, and create a new GRUB config.
We need to run this as the root user.
Rarely, you might need to reinstall the GRUB bootloader too, usinggrub-install.
Note you don’t need to specify which partition to install on, just which drive.
In normal installations, it’s the same drive your Linux is on.
The proof of the pudding comes with the next reboot.
your rig should reboot normally.
You might be left in the GRUB rescue mode.
We need to uselsto find the Linux partition, just as if you were using the GRUB shell.
Having identified the Linux partition, you’re able to go ahead and enter these commands.
Remember to use the drive identifiers and kernel version numbers that are correct for your system.
Theinsmodcommand loads kernel modules.
Once it has rebooted and you have logged in, update GRUB with theupdate-grubcommand.
Related:How to Create a Bootable Linux Live USB on Your Mac