Jump to content











Photo
- - - - -

Booting Linux From Grub4Dos


  • Please log in to reply
3 replies to this topic

#1 Kirkx

Kirkx

    Member

  • Members
  • 30 posts
  •  
    Canada

Posted 05 September 2014 - 09:12 AM

When I installed my first Linux distro several weeks ago I looked around the web trying to figure out how to boot the distro from Grub4Dos and I got the impression that the task is next to impossible or, at best, extremely complicated. As it turns out, booting Linux from Grub4Dos is actually quite easy, but it's not intuitive, poorly documented, and can be outright intimidating for new Linux users migrating from Windows. So I decided to create this thread, with the intention that it becomes a place for tips and tricks about booting Linux.

 

In the three examples below Xubuntu is installed on the seventh partition on the first hard disk (/dev/sda7). In theory all this should work the same for any distro based on Ubuntu that has Grub2 bootloader.

 

Example #1: booting using hard coded UUID

1) Convert the partition number: Linux => Grub4Dos

/dev/sda7 => (hd0,6)

2) Find out UUID of boot partition /dev/sda7 - run the following command from the terminal, UUID will be shown in the right column:

 

blkid -o list

 

Tip for newcomers from Windows: Linux terminal has Edit-Copy functionality, so you can easily copy/paste UUID to your menu.lst.

 

3) Copy UUID on the kernel line as shown in the code example below. UUID must be followed by a space and ro (which stands for "read only").

4) Check the kernel version number in /boot directory (in the example below it is 3.13.0-35):

http://i.imgur.com/KleEUE1.png

5) Create menu.lst file:
 

title Xubuntu
root (hd0,6)
kernel /boot/vmlinuz-3.13.0-35-generic root=UUID=95c8g184-fdze-7b49-8st5-b88g4f5d3729 ro
initrd /boot/initrd.img-3.13.0-35-generic

To get the splash screen add the following at the end of kernel line: quiet splash

kernel /boot/vmlinuz-3.13.0-35-generic root=UUID=95c8g184-fdze-7b49-8st5-b88g4f5d3729 ro quiet splash

The default Xubuntu installation also has $vt_handoff parameter at the end. For the life of me I couldn't figure out what it is supposed to do so I just removed it and the distro boots just fine without it. For the record, here is the original kernel line with all default parameters:

kernel /boot/vmlinuz-3.13.0-35-generic root=UUID=95c8g184-fdze-7b49-8st5-b88g4f5d3729 ro quiet splash $vt_handoff

6) Remember that after each kernel upgrade the kernel version must be manually edited in menu.lst.

 

----------

To see all default kernel parameters do the following:

 

- boot to Grub2

- select the line that reads Advanced Boot Options or something similar

- hit Edit (it's usually E key)

- check the kernel line

 

Example #2: booting via Grub2. This may be handy in case the previous boot method has stopped working for some reason.

title Grub2 of Xubuntu
kernel (hd0,6)/boot/grub/i386-pc/core.img

Example #3: booting with symlinks

 

The following method uses symlink to vmlinuz file, so you never have to edit menu.lst after kernel updates. Sounds good on paper, but on my system the boot process seems to be slower compared to the method with hard coded UUID described in Example #1. Sometimes the system just won't boot at all. Maybe the kernel line needs some changes:

title Xubuntu (symlink)
root (hd0,6)
kernel /vmlinuz root=/dev/sda7 ro
initrd /initrd.img


#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 6629 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 05 September 2014 - 09:25 AM

Plenty of help on grub4dos on my site - e.g. here http://www.rmprepusb...orials/grub4dos  and lots of tutorials and examples using grub4dos + links to other reference sites (e.g. diddy), etc.



#3 Kirkx

Kirkx

    Member

  • Members
  • 30 posts
  •  
    Canada

Posted 20 November 2014 - 09:05 AM

While Steve's tutorials mentioned in the post above are a great read, their focus is clearly on booting from an iso image on the live CD or USB drive. My primary interest is in booting a Linux distro installed on the hard drive.

 

Below is an update on booting a distro using boot file symlinks. The three code examples work ok booting Xubuntu v14.04.1 (kernel v3.13.0-39-generic) installed on hard disk #1 (Legacy BIOS / MBR machine). They have also been tested on a system with Grub2 permanently uninstalled. Using the symlinks eliminates the need to manually edit "menu.lst" after each kernel upgrade. In Xubuntu (and many other Ubuntu based dsitros) the symlinks are here:

 

http://i.imgur.com/lIoccAd.png

 

and the boot files are here:

 

http://i.imgur.com/BtX9ree.png

 

1) This seems to be the cleanest code. UUID is passed as the kernel parameter:

title Xubuntu (symlinks-1)
root (hd0,22)
kernel /vmlinuz root=UUID=95c8g184-fdze-7b49-8st5-b88g4f5d3729 ro
initrd /initrd.img

UUID must be in upper case, entering it in lower case (as shown below) will result in kernel panic:

kernel /vmlinuz root=uuid=95c8g184-fdze-7b49-8st5-b88g4f5d3729 ro

2) This code does not specify UUID at all, only device (partition) number. My guess is that it doesn't work with all kernels, probably only with newer ones.

title Xubuntu (symlinks-2)
root (hd0,22)
kernel /vmlinuz root=/dev/sda23 ro
initrd /initrd.img

3) This is the code with "root" command replaced by "uuid" command. In this case "uuid" must be in lower case, otherwise the boot process will stop and throw some error code. This command wasn't available in older versions of Grub4Dos.

title Xubuntu (symlinks-3)
uuid 95c8g184-fdze-7b49-8st5-b88g4f5d3729
kernel /vmlinuz root=/dev/sda23 ro
initrd /initrd.img

I'm not sure if any of the above examples has a better, more correct code, or if they can all be considered equal.

 

----------

I have started a thread on Ubuntu forums about permanently uninstalling Grub2. This is actually quite easy to do, and it greatly speeds up kernel updates, especially if you have a few different distros installed on the same machine. Boot file symlinks referred to in this post are not affected, they are apparently generated by the kernel installer and not by Grub2 updater. The thread is here:

 

http://ubuntuforums....d.php?t=2248645



#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 6629 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 20 November 2014 - 11:46 AM

If using wubi you can use

chainloader /wubildr.mbr





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users