Mint and Grub

HabschnedThis morning i installed Linux Mint for testing and kinda liked it. With Linux Mint there now are four different Operating Systems running on my old Asus laptop i use for testing stuff (and Operating Systems obviously). The installation of Linux Mint was a breeze. Downloaded the latest image, burned it onto a DVD, booted the Live System and clicked “Install Mint”. Before installing it i created about 30 GB of free space for it on my hard disk and the Mint installer happily installed away Linux Mint. I can’t really say how long it took as it let the laptop r.i.p and went for a walk with Taxi.

When coming back from the walk the installation was complete and i removed the DVD and rebooted the laptop. The first thing i noticed was the new boot loader configuration (well, it came as no surprise as Mint had to add its entries in there). Because of the new installation Linux Mint was set as default OS to boot if there was no interaction within a couple of seconds. Well, it’d be great to see a distro that installs its own boot loader but asks you which OS you would like to boot as default and not simply set the one you just installed as OS to boot.

Soooo, after installing the “usual suspects” like Evolution, Opera, Chrome, Kodi, Filezilla and all the other software i usually run on a Linux system i work with on a regular basis i had a look at the GRUB config of Linux Mint and changed the default OS to boot to Windows 7 again. At the same time i thought it’d be a good idea to post how those changes are done and what to pay attention to when changing the default OS to boot in a multiboot environment. And here we go.

Step 1

The first thing you want to do is to open a shell. Simply click the Terminal icon in the panel at the bottom of the screen. This will open the Terminal window which you will be working in for the rest of the tutorial. Now it’s time to open the GRUB config with nano and have a look at the entries it contains. As you are going to make changes to the configuration file you have to open it with elevated privileges (unless you are logged in as root which you shouldn’t be). Opening the configuration file as root requires you to use sudo.

The command line for that is

The Terminal will prompt you for the password, just enter it and hit Enter or Return. This will open the GRUB configuration file which holds all the details of the OS that are shown in the boot loader screen.

Sudo Nano Grub 1

Step 2

Now, with the configuration file open in Nano it’s time to look at the bits of code that we need to change. Actually it’s just a single line that needs a value changed, but to figure out what to put there you’ll have to look (and count) at the menu entries anyway. Here is what the first few lines will look like in the Terminal window

Sudo Nano Grub 2

I couldn’t agree more with the lines that read

It’s fairly easy to screw up your entire boot configuration and ending up with a bazillion of Operating Systems on your computer but not being able to boot a single one of them. So when making edits to the GRUB configuration….make them carefully. Doublecheck the changes you make, and then doublecheck them again.

The first thing you need to do is to figure out how many entries you have in your bootloader. There are two ways to do that. You can either count them when firing up your computer and take note of how many entries are displayed. The second one is to manually count the menue entries in the GRUB configuration file. And by menu entries i mean this code (code of a complete menu entry)

There will be more entries like that in your bootloader, so start counting now hehe. There is, however, a pecularity. Say you have counted all the menuentries in your GRUB configuration and, for example, Windows 7 shows up as seventh entry then you would have to use 6 as value of the default OS to boot.

When counting menu entries always subtract 1 from the number of the OS to boot

Step 3

Now, where do you enter the number of the OS to boot? That’s the easiest part (well, setting the timeout is almost as easy hehe). In your /boot/grub/grub.cfg look for this code

The exact line you are looking for is set default=”0″. And that’s why you have to subtract 1 from the number of your default OS, as the count starts with zero and not one. So if Windows is the fifth entry in your grub.cfg then you would replace the 0 with a 4 and save the changes by pressing CTRL+O

Sudo Nano Grub 3

And that’s it. If you didn’t screw up counting the menuentries in the GRUB configuration file then the OS of your choice should now boot as default OS when turning on your computer.


Be the first to comment

Leave a Reply

Your email address will not be published.

I confirm