When installing Ubuntu 8.10 I selected hd0 for grub to reside but...
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.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When installing Ubuntu 8.10 I selected hd0 for grub to reside but...
when the system boots it says it is booting from hd1,7 ext3. When I checked fdisk -lu it says it boots from /dev/sb1. This seems contradictory. I have a vanilla WinXP system with Ubuntu 8.10 installed on a usb external drive. My intention was to have XP be the primary OS until I get linux running stable. I wanted to have grub on the internal hd so that I could remove the usb drive but when I do it won't boot. Can someone please tell me how to straighten this out.
Presumably you mean the fdisk shows /boot on /dev/sdb1. Where that is (ultimately) mounted may be irrelevant to the boot process - but in your case probably not.
What it looks like you did was only install grub to the MBR of the interbnal disk - so far so good. You need the stage and config files (i.e. /boot) on there as well. That means another partition on the internal disk - and a re-install of the loader code so the MBR knows to look at the internal. Then you should be good to go.
Thank you for your insights. [Pardon the typo; I did mean sdb1.] I have plenty of partitions on the internal drive. I don't know how I got so many. There is a 3.23G primary, a 3.12G logical, a 160G extended, and three 4.98G logical partitions. Anyway, I did not notice any options, while doing the install, that permitted me to select the location of the boot loader. If they aren't available in the installation program I don't know how to proceed. Also, if I run the installation disk again what impact will that have on the rest of the ubuntu OS, (which I have spent quite a bit of time customizing) and can I quit when I have corrected the grub problem? It's too bad you are sleeping while I am typing - otherwise I'd have an answer sooner.
Regards, Dick
Woops, I see that the profusion of partitions is on the usb drive, not the internal drive. Strangely, the 3.23G and the 3.12G partitions both seem to have the ubunto OS installed. Does this do any harm - should I remove one of them? I assume I can safely create the needed partition on hd0 since there is plenty of room. And I also assume this is to be done before the re-installation. Is there any reason to do it either in Windows or linux? I feel more comfortable doing it in linux.
Last edited by dickgb; 11-12-2008 at 01:22 PM.
Reason: Error in original
I'm not sure if the "normal" install allows you to manually select the mountpoints (for /boot in this case) - it never used to, so I always use the "alternate" CD so I can control things better. Maybe there is an "expert" option somewhere now.
I had typed a missive on how to do what you want, but first we'd better see how things are setup at the moment. From a Ubuntu terminal run these and post all the output
Again thanks for your attention and efforts. Here is the info you requested. I hope this will enable you to recommend the mods that are needed. Hopefully, tomorrow you'll have some new wisdom for me.
Dick
dick@dick-Foothills:~$ sudo fdisk -l
[sudo] password for dick:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
240 heads, 63 sectors/track, 20673 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0xa7a57e45
Device Boot Start End Blocks Id System
/dev/sda1 1 843 6373048+ b W95 FAT32
/dev/sda2 * 844 20672 149907240 7 HPFS/NTFS
Disk /dev/sdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x01394e34
Device Boot Start End Blocks Id System
/dev/sdb1 1 422 3389683+ 83 Linux
/dev/sdb2 423 24321 191968717+ 5 Extended
/dev/sdb5 23803 24321 4168836 82 Linux swap / Solaris
/dev/sdb6 423 829 3269164+ 83 Linux
/dev/sdb7 23284 23802 4168836 82 Linux swap / Solaris
/dev/sdb8 830 22764 176192856 83 Linux
/dev/sdb9 22765 23283 4168836 82 Linux swap / Solaris
Partition table entries are not in disk order
=================
dick@dick-Foothills:~$ grep -vE "(^#|^\s*S)" /boot/grub/menu.lst
Here's the info you requested. I hope this will permit you to make your recommendations for a new setup that will permit the removal of the usb drive withou affecting the use of WinXPp
When I checked fdisk -lu it says it boots from /dev/sb1.
From the data you've presented, the boot code is under the root directory on /dev/sdb8.
Create a new partition on the internal - primary or logical, doesn't matter. I tend to make it ext2, but no reason not to use ext3 or any other grub supported filesystem. Give it say 200 Meg - way more than needed, but the Ubuntu installer has abysmal math; I've had it fail with 80 Meg free saying it needs 35 Meg. Others have reported similar when using separate boot partition. Let's say it's /dev/sda3 - check that it mounts automagically; usually something like /media/sda3 (might need a reboot). From a Ubuntu terminal try this
Code:
sudo cp -a /boot/* /media/sda3/
(before proceeding check that both dirs now look the same)
sudo grub
root (hd0,2) <<<=== grub counting is zero-based
setup (hd0)
quit
Next you need to correct /media/sda3/grub/menu.lst so that all the lines beginning with uuid are replaced with
Code:
root (hd0,2)
Also add the following line to /etc/fstab
Code:
/dev/sda3 /boot ext3 relatime 0 2
That should be about all.
The link from Duck2006 suggests another alternative - not what you said you wanted, but an option. Keep the external completely self contained. This would require less of the above, but would probably require you to select the boot device each time you wanted to use the external. Modern gear would allow you to have USB first in the boot order and even get around that. You would also need to restore the Windows loader on the internal - easy enough to do if you have the install disk.
I didn't get lost. I just got sick -- respiratory infection. So I haven't been able to tend to my computer (except email.)
In response to your last communication, I have tried to create a new partition in linux as well as in Windows (both gui and command) but with no success. I don't know what I am doing wrong but maybe it is just that I have gotten more than a little cautious. I don't want to destroy my WinXP system again! Hopefully, you can point me in the right direction -- again.
I finally got a program to retrieve part of the partition and created a new partition per your instructions. I was unable to complete your instructions because I got the following:
grub> root (hd0,2)
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 15: File not found
Can you please explain how to proceed. Thank you very much.
My intention was to have XP be the primary OS until I get linux running stable.
It sounds like you want to be able to use XP on your internal drive regardless of whether you have the USB drive connected, is that true? And then when you connect the USB drive, you would like the option to boot into Linux? If that's the case, can you change your BIOS to boot the USB drive? If you can, I think the solution to your problem could be really simple; you could install Grub to the MBR (Master Boot Record) of you USB drive, and then when you have the USB drive connected, you will get the Grub menu on start up so you can boot into Linux. That assumes you set your BIOS so that the USB drive comes before your internal drive in the boot order. If you then restore a Windows MBR to your internal drive, then when your USB drive is disconnected, you will boot straight into Windows. You could even add an option in your Grub menu to boot your internal Windows drive so that you don't have to disconnect/turn off your USB drive just to boot into Windows. Is this maybe along the lines of what you are looking for, or did I completely misunderstand your goal?
Also, in case you can't set your BIOS to boot your USB drive, but if your BIOS recognizes the USB drive on start up, it would be really easy to install Grub4DOS into Windows so that you could have the option to boot either Windows or your USB drive. If either of the cases I've outlined would work for you, you could save yourself from having to make a /boot partition on your Windows drive, although that's definitely an option that could work. It's up to you of course. Let me know if you want any specifics of how to go about the options I've suggested in case you are interested.
It sounds like you want to be able to use XP on your internal drive regardless of whether you have the USB drive connected, is that true?
Exactly. I want to boot to XP by default, but later I will probably change that to booting linux by default. In any case, I would like, at this time, to be able to boot to XP with or without the USB drive connected.
And then when you connect the USB drive, you would like the option to boot into Linux? If that's the case, can you change your BIOS to boot the USB drive? If you can, I think the solution to your problem could be really simple; you could install Grub to the MBR (Master Boot Record) of you USB drive, and then when you have the USB drive connected, you will get the Grub menu on start up so you can boot into Linux. That assumes you set your BIOS so that the USB drive comes before your internal drive in the boot order. If you then restore a Windows MBR to your internal drive, then when your USB drive is disconnected, you will boot straight into Windows. You could even add an option in your Grub menu to boot your internal Windows drive so that you don't have to disconnect/turn off your USB drive just to boot into Windows. Is this maybe along the lines of what you are looking for, or did I completely misunderstand your goal?
Precisely. However, I don't know how to install grub to the two drives. When I installed Windows I installed a boot program which is initiated by the MBR, correct? When I installed linux I inadvertently installed it to the USB external drive so that the grub file was there and it brings up the menu so I can select the OS I want. However, if I disconnect the USB drive, the machine doesn't know how to boot.
Following your instructions I checked to see if the USB drive can be accessed from the BIOS and it can be. Unfortunately, when I told it I wanted the USB drive to boot first it wouldn't boot at all. If I left it for a long time (lunch) it booted to the USB, i.e. linux. It may or may not have brought up the menu, but previously it brought up the menu almost instantly. If I want to boot now, I have to access the BIOS and instruct it to use the internal HD as primary.
I would appreciate it if you could tell me how to install the grub program on each of the 2 drives and where to find the info on how to edit the grub file to designate the proper drive. I am sure it is now structured incorrectly.
Also, in case you can't set your BIOS to boot your USB drive, but if your BIOS recognizes the USB drive on start up, it would be really easy to install Grub4DOS into Windows so that you could have the option to boot either Windows or your USB drive. If either of the cases I've outlined would work for you, you could save yourself from having to make a /boot partition on your Windows drive, although that's definitely an option that could work. It's up to you of course. Let me know if you want any specifics of how to go about the options I've suggested in case you are interested.
I think the Grub4DOS is probably the right solution to my problem but I will respect your opinion and follow your advice.
OK, in order to get a clearer picture of your setup, how about downloading the "boot_info_script.txt" file to your Ubuntu desktop, open a terminal (Applications > Accessories > Terminal) and do:
Code:
sudo sh ~/Desktop/boot_info_script.txt
That will create a "boot_info_results.txt" file on your desktop; please copy/paste the contents of that file to your next post. That will help clarify your setup so I can give you more specific instructions about setting up your system to dual boot.
Thanks for your instant reply. It came so quickly that I missed it yesterday.
The shell script you sent would not run per your instructions but I fooled around and got the output which follows. I have no idea whether it is complete. Please let me know if I need to access more information. It would appear that my efforts prior to your involvement deleted all boot loaders which is why I'm having so much trouble. Anything you can do to get this novice out of trouble and back on track will be greatly appreciated.
==============================
No known boot loader is installed in the MBR of /dev/sda
No known boot loader is installed in the MBR of /dev/sdb
No known boot loader is installed in the MBR of /dev/sdc
No known boot loader is installed in the MBR of /dev/sdd
No known boot loader is installed in the MBR of /dev/sde
No known boot loader is installed in the MBR of /dev/sdf
No known boot loader is installed in the MBR of /dev/sdg
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.