[SOLVED] Trying to fix boot loader with multiple OSes
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
I had a perfectly good install of Mandriva 2008.1 running on my computer but I recently decided to upgrade to a newer, bigger harddrive so I could set up the computer to dual-boot between Linux and Windows. So here's what I did. I installed a fresh copy of Windows XP Pro onto the new drive (the NTFS partition takes up about 1/3 of the drive). I then "cloned" the Linux partitions from my old Linux drive onto the empty space on the new drive -- so there are now a total of 4 partitions on the drive: 1 NTFS partition with WinXP and 3 Linux partitions for my Mandriva install. I am currently in the process of restoring the bootloader but I've run into some problems.
Right now, the system boots directly into Windows using the Windows boot loader. I attempted to restore the Linux boot loader I was using (Grub) using the Mandriva rescue disk -- it has an option to re-install the Linux boot loader. When I do the rescue, I get the following error:
Code:
Installing boot loader...
running: sh /boot/grub/install.sh with root /mnt
GNU GRUB version 0.97 (640K lower, 3072K upper memory)
grub> root (hd0,0)
Filesystem type unknown, partition type 0x7
grub> setup --stage2=/boot/grub/stage2 (hd0)
Error 17: Cannot mount selected partition
I am able to mount my Linux partitions using the rescue console and read them, so here is some info that might help:
Code:
[root@rescue]# fdisk -l
Disk /dev/sda: 251. GB, 251059544064 bytes
16 heads, 63 sectors/track, 486459 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x000271ab
Device Boot Start End Blocks Id System
/dev/sda1 * 1 154413 77824120+ 7 HPFS/NTFS
/dev/sda2 154414 236013 41126400 83 Linux
/dev/sda3 236014 473531 119709072 f W95 Ext'd (LBA)
/dev/sda5 236014 244126 4088920+ 82 Linux swap/Solaris
/dev/sda6 244127 473531 115620088+ 83 Linux
[root@rescue]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0
squashfs 15M 15M 0 100% /tmp/stage2
/dev/sda2 ext3 39G 7.1G 30G 20% /mnt
[root@rescue]#
I can also see the Linux partitions from within the Windows Disk Manager, although for some reason I can't read them using the Ext2 IFS for Windows program (the drives show up in My Computer but when I try to open them Windows says they're empty and asks if I want to format them).
So with all of that info, my basic problem is this: I want to dual-boot Windows and Linux on my computer. I've done it before and it worked just fine (my laptop uses Grub to boot between Mandriva and WinXP, for example). I would be happy using either Grub or the Windows boot loader. I was hoping this would be real easy since I've used the rescue disk before to fix Grub, so this is a little frustrating. Does anyone know how to either re-install Grub (perhaps it's a dumb problem like Grub is trying to use the wrong partition?) or how to configure the Windows boot loader to list my Linux install as a bootable option? Thanks!!!
Your root should be (hd0,1) or (hd0,5) depending on which is your root directory.
Thanks jschiwal, that's kind of what I was thinking the problem might be but I just wanted to be sure before I tried something and really screwed it up. So if I understand correctly, then I should try to do something like this:
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
What did you use to partition the drive with? If you used the windows install CD, it will make only 1 partition. Partition type 0x07 is Windows NTFS. After Windows makes its 1 partition, on which to install Windows, the remainder of the drive is free space. If by some diabolical scheme, you found a way to copy your linux installation directly to free space, you would have no corresponding entries in the disk partition table (MBR).
What you want to do is partition the entire disk first, just the way you want it, and put Windows on logical drive, within a extended partition. Then, put linux / in the first primary partition, /home in the second primary partition. swap in the extended partition, but not on the same logical drive as windows.
And I'll tell you something, Linux thought you were through with easy os's. The ones that take cash up front, and then blab everything you do in private all over the Internet. Linux is a classy os. She doesn't take kindly to those who are unfaithful, you, consorting with the disease infested slut Windows. Linux will abandon you, unless you make a commitment, and promise never to return to Windows.
What did you use to partition the drive with? If you used the windows install CD, it will make only 1 partition. Partition type 0x07 is Windows NTFS. After Windows makes its 1 partition, on which to install Windows, the remainder of the drive is free space. If by some diabolical scheme, you found a way to copy your linux installation directly to free space, you would have no corresponding entries in the disk partition table (MBR).
What you want to do is partition the entire disk first, just the way you want it, and put Windows on logical drive, within a extended partition. Then, put linux / in the first primary partition, /home in the second primary partition. swap in the extended partition, but not on the same logical drive as windows.
I installed Windows first on the blank drive and used the Windows installer to create the single NTFS partition. This primary partition takes up about 1/3 of the space on the drive. I then used Norton Ghost to copy my Linux partitions (/, /home, and swap) to the blank space on the drive (this used to be called "drive cloning" or "ghosting" but they may use other terms now, not sure). These partitions take up approx. the remaining 2/3 of the drive. I would have gladly had Linux be the primary OS, but I've had problems in the past in which I've installed Linux first and Windows second (for example, on one system the Windows install wound up calling it's main drive G: instead of C: which causes problems for some programs, and this happened because Windows was installed after Linux). I've done a procedure similar to this in the past (moving a Linux install onto another disk) and it worked ok so I figured I'd try my luck again. If need be I will just re-install Linux onto the drive, but I'd really really like to avoid doing that since my current install has about a year's worth of customization.
As for your comment on the MBR; you may be correct. Is there any way I can write the entries for the Linux partitions into the MBR if necessary? Or perhaps this will work itself out if I can get Grub working again?
Quote:
Originally Posted by AwesomeMachine
And I'll tell you something, Linux thought you were through with easy os's. The ones that take cash up front, and then blab everything you do in private all over the Internet. Linux is a classy os. She doesn't take kindly to those who are unfaithful, you, consorting with the disease infested slut Windows. Linux will abandon you, unless you make a commitment, and promise never to return to Windows.
How colorful! Actually the main reason I want the Windows install is for multimedia purposes. I use Linux to run my servers, program, do work stuff, etc. But when it comes to doing multimedia, Linux sucks. I'm not looking for an argument, it's just not as simple and easy as it is with Windows. I want my girlfriend to be able to use the Xbox to play music and streaming video from the computer, and with Windows all I need to do is use Windows Media Sharing or a program like PlayOn (which now works with Netflix and Hulu) and boom, done. Linux has uShare, which, while a valiant effort, doesn't quite match up to the various Windows-based options. Anyways, this is all discussion for another thread. I'm just looking to transfer my old Linux install to a new disk. Any help is appreciated. Thanks!
And I'll tell you something, ... consorting with the disease infested slut Windows. ... return to Windows.
OP had the right word for the last paragraph of your post: "colorful" -- esp. the phrase I've colored. One of the finest mini-diatribes against "Winders"(tm) I've seen.
In this case, mixing the "theology" in w/ the advice did no harm, but I see the possibility of the less sophisticated not noticing your change in tone -- perhaps you should color your colorful words. I sometimes use silver to make my off-topic comments less eye catching.
No. Use your Mandriva disk, let it load, open a terminal/konsole and log in as root and type grub (to get the grub prompt then type
root (hd0,1)
setup (hd0)
quit
This will install stage1 of Grub to the mbr of the drive pointing to sda2 (hd0,1) for the rest of the bootloader files.
Thanks! This worked, and it installed Grub into the MBR of the drive. I did run into a new problem after I installed Grub: when the Grub menu came up there was initially an error that it could not find the graphical menu, so it loaded the text-based boot menu. When I selected linux from the menu, I got the following error:
As you can see, it was using my old Grub menu, which still points to hd0,0 instead of hd0,1. So I used the rescue disk again and edited Grub's menu.lst file and tada! I was able to boot back into my old Linux install. I am now working on adding the Windows partition to my boot menu. Thanks so much for the help!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.