Re-installing the GRUB2 bootloader using a chroot with Linux Mint 14.
Posted: December 31, 2012. At: 1:51 PM
The Microsoft Surface tablet due to the implementation of the UEFI Secure Boot is not being very cooperative in terms of allowing the installation of Linux. This could be a very good portable tablet for running Linux on the move but if you can not overcome the limitations of the Secure Boot system then Linux is not going to happen on the Surface. it looks like a very fragile and poorly designed tablet anyway. Purchasing an Android tablet and installing Ubuntu for ARM would be a better idea; you could use a Bluetooth keyboard and then have a similar setup to the Microsoft Surface; but with a Linux based operating system and a wide variety of apps to install. Obviously if you installed Ubuntu onto the surface you could run Linux software and take the Linux operating system with you on the move. Linux and UNIX software is better and more secure than the Microsoft equivalents. The Internet Explorer browser has been the target for many malware attacks of late; this is a good reason to adopt free and open source software like Chromium or Firefox instead.
The Ubuntu Linux distribution; love it or hate it is shipped pre-installed on computers sold in mainland China and other countries around the world. Linux Mint 14 is another good alternative for the desktop if you do not want to run Ubuntu for one reason or another. The Linux Mint 14 DVD distribution comes with all multimedia codecs and Youtube support out of the box, this means that you may install it onto your computer and you will be playing your music and watching your movie collection right away. That is amazing in this day and age. On Ubuntu you need to type
sudo apt-get install ubuntu-restricted-extras to install the required codecs. But that is a small annoyance. I recently re-installed my Windows partition with Windows 7 Enterprise and I had to re-install the Grub 2 bootloader so I could run Linux Mint 14. I booted the Linux Mint Live DVD, mounted the partition on the hard disk and chrooted into the partition following this Gentoo tutorial here: Gentoo Chroot. Then I had to type
grub-install /dev/sda and the GRUB 2 bootloader was re-installed into the boot sector of the hard disk.
I had to mount the appropriate partition first.
mint ~ # mount /dev/disk/by-uuid/bc5b19b4-1674-42f6-9508-08b7b37f3645 /media/mint/bc5b19b4-1674-42f6-9508-08b7b37f3645
After that you need to mount the /proc filesystem for the chroot.
mint ~ # mount -t proc none /media/mint/bc5b19b4-1674-42f6-9508-08b7b37f3645/proc
And the /dev filesystem so that the system will function correctly.
mint ~ # mount -o bind /dev /media/mint/bc5b19b4-1674-42f6-9508-08b7b37f3645/dev
Before you chroot, you need to copy over the /etc/resolv.conf file so that your chroot environment can resolve domain names.
mint ~ # cp -L /etc/resolv.conf /media/mint/bc5b19b4-1674-42f6-9508-08b7b37f3645/etc/resolv.conf
This command will actually enter the chroot environment.
mint ~ # chroot /media/mint/bc5b19b4-1674-42f6-9508-08b7b37f3645/ /bin/bash mint / #
Then all I had to do was re-install the grub boot code using the grub-install command.
mint / # grub-install /dev/sda Installation finished. No error reported.
After that I re-booted and I was presented with the GRUB 2 boot menu and I was able to load Linux Mint. That is how easy it is to access your Linux installation with a chroot and re-install GRUB. You may also click on the appropriate partition in the Caja file manager and then it will be mounted under /media/mint and you may then load a terminal and type
sudo su - and then follow along with the rest of these steps easily enough. So feel free to re-install Windows if you wish; but do not fear, re-installing the GRUB boot-loader is easy with this tutorial.