Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have done a custom Ubuntu 13.04 installation on a 8GB USB pendrive using a minimal CD install [system root on /sda1 3.5GB ext4, shared partition /sda2 NTFS 4GB mounted as /shared, no swap partition]. It works just fine but it lacks a useful boot option: "boot from first drive".

On LiveCDs you get that option which skips the LiveCD boot and restores the normal boot sequence as if the LiveCD wasn't even there. I want to add that option to my USB installation as well because I often forgot the USB pendrive attached to my PC and it's very nasty to restart the PC using the hard reset button (not to mention also any faults that this can cause). A few people already suggested me to simply add another boot menuentry in grub.cfg like

menuentry "Boot from first hard disk" {
    set root=(hd0,0)
    chainloader +1
}

But this entry always looks for the first partition on the first hard drive. On my PC this is not the case as I have the OS installed on hd(0,1). Other PCs instead might actually use hd(0,0) while others might as well use hd(1,4) or anything else. The point is, I can't just add an entry that uses a specific drive and partition. I need to add a menuentry that actually "skips" the grub2 bootloader from the USB pendrive and makes the boot sequence continue next, just like the USB pendrive wasn't even there.

Can someone please tell me how can I do that? I tried looking for a grub.cfg file on a LiveCD so I could copy the menuentry from there, but I found no grub.cfg in /boot/grub2.

share|improve this question

1 Answer 1

Pretty close actually.

menuentry "Boot from first hard disk"

{

set root=(hd1)

chainloader +1

}

This works for me. hd1 because hd0 is usb drive.

share|improve this answer
    
BIOS always reports boot drive as hd0 in grub. So next drive is hd1. That usually is port order for SATA drives, but I have skipped ports and on a reboot my flash drive may insert itself as sdb and higher drives then get renumbered. Also the OP's posted entry of a grub2 boot stanza would never use hd0,0 as with grub2 the first partition is always 1. Only with grub legacy was the first drive, partition hd0,1. –  oldfred Dec 7 '13 at 4:55
    
I did not get your comment. Can you please elaborate? –  Niraj Dec 7 '13 at 10:39
    
your entry is correct, I was just trying to elaborate a bit. I have several drives and do have similar entries, but sometimes I have to manually edit as order can change. With just one drive, boot drive will be hd0 and second drive hd1 as you have in your boot stanza. Title/menuentry needs to be inside {}. –  oldfred Dec 7 '13 at 18:31
    
Unfortunately this is not working for me. When switching to different PCs the driver order changes from one to another. On my laptop set root=(hd1) works flawlessly but on my desktop PC it will make grub load the next OS from my secondary HD which doesn't have one, so the PC fails to boot. the same happens on other PCs. What I was looking for is a way to properly skip grub when I select the proper boot entry, so grub will just leave and the PC would continue booting normally from the other drives in the same sequence it would have if grub didn't load at all. –  T3STY Dec 7 '13 at 20:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.