Thursday, August 31, 2017

grub2 - How do I get the GRUB menu to show when starting my dual-boot system?




Recently I have installed Ubuntu 10.10 and selected a wrong option while installing it.



Now the problem is that my machine directly boots Ubuntu and even does not show me grub menu.



How do I install grub menu ?



And how do I add Windows Vista to the grub menu?



This is what I have tried.




sudo grub

> root (hd0,0)

> setup (hd0)

Error 17: Cannot mount selected partition


I don't know what's going wrong here and I am sure that I have not wiped out my windows partition.




Edit :



sudo update-grub

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
ls: cannot access /media/BC54B2C654B282A6/boot

Boot: No such file or directory
done





sudo os-prober

ls: cannot access /media/BC54B2C654B282A6/boot
Boot: No such file or directory



Thanks.



I tried using sudo update-grub and sudo os-prober but I had no luck.



So this is what I have done.



sudo gedit /etc/default/grub and placed a comment # in front of the line GRUB_HIDDEN_TIMEOUT=0.




Then I updated my grub so that I don't have to press Left shift for the grub to appear using sudo update-grub .



After updating the grub I opened grub.cfg using sudo gedit /boot/grub/grub.cfg command.



And added



menuentry "Windows Vista" {

set root='(hd0,1)'


chainloader +1

}


between ### BEGIN /etc/grub.d/40_custom ### and ### END /etc/grub.d/40_custom ###



And don't forget to save the file.



I am marking this answer as Community wiki in case someone wants to add or modify this post.







Edit to update:



Meanwhile (2013) we have a GUI tool to repair/reinstall grub: Boot Repair.



To use it, do one of the following:





  • Create a live CD/USB of Ubuntu Secure Remix, which is an Ubuntu live with supplementary rescue tools, boot from that and use Boot Repair.


  • If you already have a regular Ubuntu live iso, create live usb with UNetbootin, live boot from that and install Boot Repair





sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get
update



sudo apt-get install -y boot-repair && boot-repair &





(But apt-get update on a live USB might involve updates that take some time - and are also useless if the live usb is not persistent - so I recommend the first solution.)



Using Boot Repair to fix/reinstall GRUB is simple, just choose default/recommended repair option; more details here.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...