I have installed openSuse 11.1 on a 4 GB USB TDK stick. I need to know how to install the grub bootloader on the MBR of the usb drive so that I don’t disturb my vista boot loader. I did this sucessfully with ubuntu (where it gives you an option as to which MBR to install grub on). The options for installing the bootloader on openSuse are very confusing and don’t really let you specify the mbr of the usb drive.
Say my usb drive is hdb, I would like to install the bootloader at /dev/hdb (the drive’s MBR), but all I see is /dev/hdb2, etc. I don’t want the vista bootloader to know anything about the openSuse installation.
You should be able to see how suse identifies each drive in the partitioner. Just make careful note and at the bootloader settings remember to go to the advanced tab, select mbr and the dev.
“You should be able to see how suse identifies each drive in the partitioner. Just make careful note and at the bootloader settings remember to go to the advanced tab, select mbr and the dev.”
The bootloader page for 11.1 doesn’t have an advanced tab where you can select mbr and the dev. Nowhere does it allow you to say what the device is where you want the mbr installed.
Here is a pic from one of my blogs, you may need to use the zoom button
There are a couple lengthy threads elsewhere on these forums dealing with booting from a USB stick, in one case just having the boot files there the others the entire OS. Worth checking.
A key point to keep in mind is that booting from USB of course requires bios support, but there is no standad or consistent method for how bios’s manage this, and so results vary and consequently one method will work while another not - all just depending on the bios.
I can give you 3 methods:
First, you can use YaST Boot Loader to install grub to the USB’s MBR: Under the Boot Loader Installation tab in the Location column, click on Boot from Master Boot Record, then click Other (bottom-right) and click Edit Configuration Files. On the subsequent screen in the pull-down choose /etc/grub.conf and you will see the install command that YaST will feed the grub shell. Change what is probably (hd0) to (hd1) - you can see device.map on that same screen and verify the grub’s disk numbering/alignment file is consistent with your setup (i.e., that (hd1) is what you actually want). Then click OK. Back on the previous screen under Location you should now see the check mark moved to Custom Boot Partition and /dev/sdb indicated. This will install to that disk’s MBR. Important note: This method puts grub’s stage1 in the MBR with an embedded pointer to the partition where grub’s stage2 is located. Etc/grub.conf should reflect that. So e.g. if the USB is sdb and /boot/grub/stage2 is on sdb2, then the install command in grub.conf should be “setup (hd1) (hd1,1)”. A second important note in ref to prev bios comment: Strictly speaking, if you are booting from USB with USB configured in the bios as first boot or by (if bios supports it) an on-the-fly bios menu boot selection, then the grub notation should be reversed. That is, device.map should be changed to have the USB numbered as (hd0), and this change should be carried through to grub.conf and menu.lst. Whether this is required is entirely dependent on the particular machine, but it often is.
Second, you can install grub to the USB MBR in exactly the same way that Ubuntu does - using the “grub-install” script which is included in the grub package. Except that in openSUSE it has a different name, i.e., “grub-install.unsupported”. So from a terminal you can do, assuming sdb is the USB drive (note: do not mix this method with YaST):
su -
/usr/sbin/grub-install.unsupported /dev/sdb
Third - and what I strongly prefer - is to not install grub to the MBR when that is an option. In recent years all manner of not-so-funny business is being done in the MBR by manufacturers and Microsoft (99% of the time undocumented), not to speak of the surprisingly frequent flaws and inconsistencies in bios’s. The foolproof method of booting is to put “generic” (DOS, or even Windows) code in the MBR and to install grub to the partition boot sector, as long as that partition is a “primary”. To do this in openSUSE requires 2 steps, because YaST, while it has a generic MBR code install option, does not allow you to specify the disk (while it does for grub, per above). So, the first step is to use YaST to install grub to the USB partition where the kernel resides. Under the Boot Loader Installation tab, Location column, check the “Boot from Root Partition” box only. Then click on Boot Loader Options (upper-right) and on the next screen (upper-left) click “Set active flag in Partition Table for Boot Partition” (make sure no other boxes there are checked). Click OK and proceed on to Finish. Then open a terminal, and do:
su -
dd if=/usr/lib/boot/master-boot-code of=/dev/sdb bs=440 count=1
The above assumes sdb is the USB device - be absolutely certain you have the correct drive name. You now have generic code in the MBR which will call the boot sector of whichever primary partition is marked active. Since you previously installed grub stage1 to that boot sector, this will boot grub without having put grub in the MBR.
Side note: Everything done via YaST above can easily be done in the grub shell, and in fact most of what YaST Boot Loader actually does uses the shell. So the main purpose of YaST is to assist the user in configuring grub, similar to (but more extensive than) all of the parameter options which are embedded in menu.lst in the Debian (Ubuntu) version of the file.
Thank you very much for your help. I finally got openSuse 11.1 to boot from the memory stick using your 3rd method - Boot from Root Partition, then copy the master-boot-code to /dev/sdb.
The only problem I had on first reboot was that I had to change (hd1,1) to (hd0). No big deal.
Thanks again for your help.
Great. You’re welcome.
Yes, you would need to switch the (hd1) to (hd0), as I explained under the first method - I should have reiterated that - because the USB is now the first boot device.