Apparently, there’s a simple way to hack a Linux distro. Just hit backspace 28 times in a row and you’re in. This applies to systems that use Grub2 boatloader, which applies to pretty much all Linux distros. On bootup, you can bypass the lock screen by hitting backspace 28 times in a row, and it will send you to the grub rescue shell. Researchers say there is a bug that creates a memory error leak, which in turn opens up a rescue shell. You’ll need physical access to the keyboard to take advantage of this bug. Ubuntu, Redhat and Debian have already release patches, so you’re out of luck.
If you run Ubuntu and you installed Windows later, then know what I’m talking about. Windows just wrote over the MBR record. Windows doesn’t play nice at all. You no longer have access to your Ubuntu distribution.
I’ve read tons of documentation how to recover Grub2, but this is the simplest and the one that worked for me. So, to recover Grub2 after a Windows install, just perform the following:
Boot from a Ubuntu Live CD.
Preferably the same release, but it doesn’t have to be as long as you have access to a Linux Terminal or the Bash shell.
sudo fdisk -l
That’s the letter L by the way. This should tell you where your Linux distribution is located. Mine is sda1. You may to look for the one with the Linux partition. Mine was set to ext4.
sudo mount /dev/sda1 /mnt
There shouldn’t be any errors if the partition is mounted properly. If you have experienced an error, you probably did something wrong like mounting a different partition or a partition that doesn’t exist.
sudo grub-install --root-directory=/mnt/ /dev/sda
Restore Grub2 to the MBR.
sudo shutdown -r now
There is probably a more graceful way of rebooting, but this one works as well.
Update the Grub menu after the reboot.
That was easy. Practically it’s just one command that really did the trick. There is no typing and editing involved. Like I said, the simplest way to recover Grub2 after a Windows install.
In 2005, I wrote a short article on how to delete old kernels in Linux. At that time, I was using Fedora exclusively. Since then, I’ve moved on to Ubuntu. In addition, Grub2 is now standard for all Ubuntu releases. This short article will show you how to remove old kernels in your Linux system as well as clean up your Grub2 entries. By the way, you will see Grub2 entries only if you have a multi-boot configuration. If not, Ubuntu will boot directly to the login screen.
First, determine the current kernel being used by typing the following command in the Terminal.
# uname -r
The result will display something like the one below.
Now, it’s important not to delete your current kernel because all hell will break loose or the sky will fall on your head. In either case, you don’t want to be in that predicament.
You can use the ‘Synaptic Package Manager’ to remove the older kernels. Use ‘2.6.32’ to narrow down your search. Right click on the kernel you want removed and choose ‘Mark for Complete Removal.’ After all older kernels are removed, you can now update the Grub2 configuration.
# sudo update-grub
That’s it. The next time you boot your multi-boot Ubuntu system, you will see less entries in Grub as well as successfully have deleted older kernels you no longer needed. There is a more detailed instruction how to remove other entries in Grub from howtogeek.com.