Peppermint | Linux OS Community Forum
It is currently Mon Feb 17, 2020 10:27 pm

All times are UTC - 5 hours [ DST ]

Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [One][Ice][Two] Fixing or editing Grub2: Part 1
PostPosted: Tue Jun 15, 2010 3:53 pm 
User avatar

Joined: Wed May 19, 2010 5:11 pm
Posts: 958
Location: Asheville, North Carolina
Class: Bootloader tutorial
Difficulty: Advanced: User's risk
Time: About half an hour
Desirability: If the bootloader is working, recommend leaving this alone. Necessary to fix or customize Grub for some systems.

Dealing with Grub2 can be somewhat intimidating and frustrating at the same time. This tutorial is not a complete guide to the ins and out of Grub2 but a guide to editing it to show your other operating systems that you may have on your system. WARNING!!! Although this has been tested on Peppermint it might narf your system so do this at your own risk.

First lets look at Gurb2's file system. The bootloader file is located in the /boot/gurb but if you are used to the old Grub you will notice that the a file called menu.lst is no longer there. The main instruction file is now called grub.cfg, which is produced by various scripts that run when the command update-grub is executed. The files that are responsible for the content in grub.cfg are /etc/default/grub and the individual script files are located in /etc/grub.d/. These files are where you should do any editing when it comes to Grub2, DO NOT EVER EDIT THE Grub.cfg FILE OR VERY BAD THINGS WILL HAPPEN!!!

Update-grub actually runs the grub-mkconfig-o /boot/grub/grub.cfg. When the update-grub command is executed Grub2 will search for other Linux kernels and other operating systems but does not always find them because of how the search configuration is setup in the file that are contained in the /etc/grub.d folder. Here is the default settings *10_linux searches for other installed kernels that are on the same partition while *30_os-proder looks for other operating systems.
Although Grub2 does its job perfectly most of the time it still may need a little help from you to find your other operating systems, especially if you have them installed on more that one hard disk. Now that you have a basic understanding of Grub2's files and how they work lets get started fixing or editing Grub2. Note I tested this with a Windows XP partition so I can't say with 100% certainty that this will work for Vista or Windows 7.

Ok so lets say we have both Peppermint and Windows XP residing on the same partition and the machine has been up and running for a while but we have just re-installed Windows XP and when we reboot the system, we get Windows with no Grub boot options. Now before we go into panic mode fixing this is rather simple.

To get started boot to the live desktop, and open up a terminal by using the following key combo.


Now type in the following command and press enter.

sudo fdisk -l

Now you should see a list of all our partitions that are on our hard drive, here is an example.

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000e27fa

   Device Boot      Start         End      Blocks     Id   System
/dev/sda1   *           1            538     4321453    7    HPFS/NTFS
/dev/sda2            539            667     1036192    82  Linux swap / Solaris
/dev/sda3            668          1305      5124735     5  Extended
/dev/sda5            668          1305      5124705   83  Linux

It is very important to remember which device in the list contains our Peppermint installation, more specifically, your root file system. In this example it is on sda5. If your have customized Peppermint partition so you have a root (/) and home (/home) partitions I will assume that you know which is which. You may also have a separate /boot partition, if you do it will need to be mounted along with the root partition. Now lets mount the root, and if necessary /boot partition with the following commands.

sudo mount /dev/sda5 /mnt

sudo mount /dev/sda? /mnt/boot

Replace the ? to fit your fdisk output if you have a separate /boot partition. Now mount the rest of your devices, you need not worry about XP right now, with this command.

sudo mount --bind /dev /mnt/dev

Now in the terminal we need to chroot into the system. What this does is it allows us to run as root without having to use sudo before each command.

sudo chroot /mnt

Now we need to update Grub2 so run this command.


Now we need to install Grub2 to the Master Boot Record by issuing this command.

grub-install /dev/sda

Now sometimes you might get a error for what ever reason. If you do run this command.

grub-install --recheck /dev/sda

Now press Ctrl+D to exit chroot and once your back in the regular user mode, run these commands.

sudo unmount /mnt/dev

sudo unmount /mn

Now we can reboot the system.

Support Team Leader
Co-Creator of Lubuntu x86_64

I'm on Twitter: @Asheguy
I'm on

Linux User #507486


Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

Powered by php B.B. © 2000, 2002, 2005, 2007 php B.B. Group
Template made by DEVPPL