[SOLVED] Create independent Grub2 boot loader menu in USB stick.
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Create independent Grub2 boot loader menu in USB stick.
I am looking for a step by step approach - the "do-it-yourself" kind to achieve what I mentioned in the subject. I've a little knowledge of programming - so, will need hand-holding, to carry out terminal commands! Since I am at the lower end of the learning curve, explanations will be essential to grasp and understand what I am doing. I am sure, this will help a lot of late starters like me!
Let me elaborate on what I am planning on, and my requirements.
I have 2 old disks now. In each, I have windows in the Primary drive. I have installed Ubuntu, Fedora, Mint, Suse, etc. etc. versions in the residing in the extended partitions. (Crazy, but, this is just a hobby to me. I like to check and try out various distros' as they come, and maybe I plan to add one more disk!) Both of them have their own boot menus and I have to change the boot options in the BIOS every time to switch.
When I read references to Grub2, chain loading etc. I understood enough to know that I can accomplish this with a simpler option. Only my knowledge is too limited to implement it!
My wish list is to have Grub2 installed in any USB. So, when I boot through the USB, I should have the complete menu to boot onto any OS in the whole System - from the USB. Also, when I install a new flavour, or remove an old one, an update-grub should update new menu!
On the other hand, the boot loaders in the individual disks also should not be disturbed, so that I can boot into any disk by the BIOS method.
I am willing to experiment, and maybe even document it for others, if only a few of you can spare some of your time. I am sure, you can guide me, but you will need some patience! If you have any questions, please shoot.
Thanks in advance - and I do find these forums very informative.
Using a USB flash drive to house Grub is a bad idea.
If you install a Linux in an internal hard disk and boot from it that disk is the 1st boot disk and all the intructions in the boot loader and Linux register it being installed from the position of 1st boot disk.
If you boot from a USB device you tell the Bios that is your new 1st boot disk and so the internal hard disk has to be relegated to the 2nd disk position and this can cause booting problem.
Put Grub in a floppy or CD (with or without the booting menu.)
If a floppy or a CD is booted the original 1st boot disk is still valid and not altered.
Forget about the booting menu. Just a Grub prompt will do. This mean just install Grub1 or Grub2 on its own. Check out just booting tips in my signature for putting Grub in various devices. No installed operating system in a PC cannot be booted manually by a Grub prompt.
Ok, I am now on hold till I have further confirmation...
You said it is a "bad idea" due to the reasons given. Is there any way to overcome that problem? I read about issuing commands to "re-map" the 1st and 2nd disks "on-the-fly". Or is it not applicable here?
I am going thru the links you posted on your signature, and even on second reading, it all seems to be a bit "beyond me" - since my basics are rather fudgy!
Any way, I will await clarity before I proceed further.
Thanks a ton, for raising a alert - since I do not want to ruin the current setup!
This is what I get. Can't understand the "error" - since it has already created the 2 directories on the USB.
(I am using Grub2 (Ubuntu 10.04). I do not have a floppy drive, and I do not know how to install grub in a CD!
cr@cr-ub10:~$ sudo su
[sudo] password for cr:
root@cr-ub10:/home/cr# mkdir /media/usb0/proc
root@cr-ub10:/home/cr# mkdir /media/usb0/dev
root@cr-ub10:/home/cr# mount -t proc none /media/usb0/proc
root@cr-ub10:/home/cr# mount -o bind /dev /media/usb0/dev
root@cr-ub10:/home/cr# grub-install /media/usb0
/usr/sbin/grub-probe: error: /media/usb0 is not a block device.
/usr/sbin/grub-setup: error: cannot seek `/media/usb0'.
Just now I rebooted the machine with the USB. I think, I got the same menu as before. (it did not seem as if it booted thru the USB and even if it did, it did not show up the boot menus of the 2nd disk. I will recheck that, but would like your comments too.
Meanwhile, I am reading your link about booting from cd. 1st line creates a rescue image. What does the 2nd line mean? - wodim?
I think the two lines combined create an iso image for Grub2 to be burnt into a CD. I have done it couple of time and can confirm that it works.
You can use any Grub to boot any device. Here is how you do
At the Grub2 booting screen do not boot any system but just press the "c" key to drop into a Grub prompt. Issue command
[code[ls[/code]which will list out all the partitions in the PC. These are just (hd0,1), (hd0,2)...(hd1,1), (hd1,2)..
By examining the number of partitions in each disk you should have an idea which is which.
As you have sdc as a flash drive and created sdc1 there so mostly this would be (hd2,1) assuming you have not instruct the Bios to boot flash drive first and there are sda and sdb disks in the PC. You can then try the Grub2 you have just installed in sdc by command
you should now see Grub2 that you have installed. It could be just a Grub prompt.
Equally when you are in sdc Grub2 prompt you can jump back to the original disk (hd0) by commands
My point is once you have Grub2 you can go into any device, check its directory, boot up whatever system inside, etc, etc....
Thanks for all the guidance so far, but I think I missed something somewhere ... or there is some other problem that I can't identify. I checked all over that I have carried out the instructions right. The current situation is :
a) It is not booting from USB - in spite of BIOS settings.
b) from grub prompt "ls" shows only (hd0) and (hd1) drives.
c) set root=(hd2) - does not show any error.
d) "chainloader +1" and "boot" command give error "h2 cannot get C/H/S values.
(missing to give the drivemap command at some point ?)
d) set root=(hd0) + chainloader +1 + boot - leads to disk1 menu
e) set root=(hd1) + chainloader +1 + boot - leads to windows on disk i
f) (maybe because there is no grub in disk2 ?)
2) As for the CD - I tried
mkrescue ...... (it shows error - "unknown command - mkrescue"
(doubt - even tab did not show that command)
I am somewhere near, I know - just requires that one last push!!!
Do give me some hints at they occur to you. Thanks for all your help so far.