Professional Web Applications Themes

Dual boot Win XP / Linux, using grub - Linux Setup, Configuration & Administration

Hi! I just installed Win XP on the first (primary) partition, which was working fine. Then I set up Linux (Debian) on the second partition using a boot floppy, which was still ok. Then I decided to use grub as boot loader. Since I haven't had any experience with it, I must have done something wrong here: I used 'grub-install /dev/hda' to write grub into the MBR and set up the operating systems in /boot/grub/menu.lst as follows: --- title Linux root (hd0,1) kernel /vmlinuz root=/dev/hda2 title WinXP rootnoverify (hd0,0) makeactive chainloader +1 --- Now I can boot to Linux, but ...

  1. #1

    Default Dual boot Win XP / Linux, using grub

    Hi!

    I just installed Win XP on the first (primary) partition, which was
    working fine. Then I set up Linux (Debian) on the second partition using
    a boot floppy, which was still ok.

    Then I decided to use grub as boot loader. Since I haven't had any
    experience with it, I must have done something wrong here:

    I used 'grub-install /dev/hda' to write grub into the MBR and set up the
    operating systems in /boot/grub/menu.lst as follows:

    ---
    title Linux
    root (hd0,1)
    kernel /vmlinuz root=/dev/hda2

    title WinXP
    rootnoverify (hd0,0)
    makeactive
    chainloader +1
    ---

    Now I can boot to Linux, but I can't start Windows XP any more (it
    simply restarts when selecting the WinXP item).

    I wonder where windows XP stores its boot loader. If it was in the MBR
    it is overwritten now. But where should I have installed grub instead?

    And how can I restore WinXP's boot loader (ntldr)? The problem is, that
    I can't boot from CD, so I'm not able to start the Recovery Console.

    Is there anyone who could tell what I should have done to get things
    working? If someone had a solution to my problem I'd be even more happy,
    of course.

    Stefan

    Stefan Guest

  2. #2

    Default Re: Dual boot Win XP / Linux, using grub

    On Tue, 21 Oct 2003 23:13:06 +0200, Stefan S÷ffing wrote:
     
    It should work- if there are no other errors. I think grub-install failed
    for some reason.

    I prefer setting up from within the "grub shell," as opposed to
    grub-install. From the interactive shell, you can see if there are any
    problems with the setup.

    $grub
    grub>root (hd0,1)
    grub>setup (hd0)
    grub>quit

    Watch for error messages after each command.

    Notice the command root (hd0,1) specifies where menu.lst and the rest of
    grub is located, not the root filesystem.

    --Douglas Mayne
    Douglas Guest

  3. #3

    Default Re: Dual boot Win XP / Linux, using grub

    Douglas Mayne wrote: 
    >
    > It should work- if there are no other errors. I think grub-install failed
    > for some reason.
    >
    > I prefer setting up from within the "grub shell," as opposed to
    > grub-install. From the interactive shell, you can see if there are any
    > problems with the setup.
    >
    > $grub
    > grub>root (hd0,1)
    > grub>setup (hd0)
    > grub>quit
    >
    > Watch for error messages after each command.
    >
    > Notice the command root (hd0,1) specifies where menu.lst and the rest of
    > grub is located, not the root filesystem.
    >
    > --Douglas Mayne[/ref]

    I did so, but everything seems to be ok - no error message. As I wrote
    above, booting to linux works fine - I just can't boot to windows.

    But can you tell me how this chainloader thing works? Where should be
    the ntldr for windows if there's already grub installed in the MBR?

    Stefan

    Stefan Guest

  4. #4

    Default Re: Dual boot Win XP / Linux, using grub

    On Wed, 22 Oct 2003 00:02:09 +0200, Stefan S÷ffing wrote:
     
    >>
    >> It should work- if there are no other errors. I think grub-install failed
    >> for some reason.
    >>
    >> I prefer setting up from within the "grub shell," as opposed to
    >> grub-install. From the interactive shell, you can see if there are any
    >> problems with the setup.
    >>
    >> $grub
    >> grub>root (hd0,1)
    >> grub>setup (hd0)
    >> grub>quit
    >>
    >> Watch for error messages after each command.
    >>
    >> Notice the command root (hd0,1) specifies where menu.lst and the rest of
    >> grub is located, not the root filesystem.
    >>
    >> --Douglas Mayne[/ref]
    >
    > I did so, but everything seems to be ok - no error message. As I wrote
    > above, booting to linux works fine - I just can't boot to windows.
    >
    > But can you tell me how this chainloader thing works? Where should be
    > the ntldr for windows if there's already grub installed in the MBR?
    >
    > Stefan
    >[/ref]
    AFAIK, three files are necessary to start NT and its derivatives:
    ntldr
    ntdetect.com
    boot.ini

    They should reside as files on the windows partition. ntldr and the MBR
    code are separate and serve different purposes. In my experience, grub's
    mbr code is the best choice for dual boot systems- which chainloads to
    the BPB code on the Windows partition: rootnoverify (hd0,0).

    I re-read your first post. Were you ever able to start your XP setup
    before installing Debian on this disk?

    --Douglas Mayne


    Douglas Guest

  5. #5

    Default Re: Dual boot Win XP / Linux, using grub

    On 2003-10-21, Stefan S÷ffing <de> wrote: 
    >>
    >> It should work- if there are no other errors. I think grub-install failed
    >> for some reason.
    >>
    >> I prefer setting up from within the "grub shell," as opposed to
    >> grub-install. From the interactive shell, you can see if there are any
    >> problems with the setup.
    >>
    >> $grub
    >> grub>root (hd0,1)
    >> grub>setup (hd0)
    >> grub>quit
    >>
    >> Watch for error messages after each command.
    >>
    >> Notice the command root (hd0,1) specifies where menu.lst and the rest of
    >> grub is located, not the root filesystem.
    >>
    >> --Douglas Mayne[/ref]
    >
    > I did so, but everything seems to be ok - no error message. As I wrote
    > above, booting to linux works fine - I just can't boot to windows.
    >
    > But can you tell me how this chainloader thing works? Where should be
    > the ntldr for windows if there's already grub installed in the MBR?
    >
    > Stefan
    >[/ref]
    If you can boot into linux fine and the trouble is with xp, then get
    into linux and do a fdisk to see if the xp partition is set as
    active. I think most linux installs, well at least SuSE, changes
    "active" partition to the linux boot partition.

    If the above is true, just "deactive" the linux partition and set the
    xp partition active with fdisk. The ntldr is still in the xp partition.

    Myself, I prefer to install grub in the linux boot partition and use nt
    to give me a selection to boot xp or linux.
    a Guest

  6. #6

    Default Re: Dual boot Win XP / Linux, using grub

    On Tue, 21 Oct 2003 23:13:06 +0200, in article
    <3f95a17f$0$12506$freenet.de>, Stefan S÷ffing wrote:
     

    What restarts? GRUB? If it's GRUB, do you get an error message?

    I can boot Windows 2000 like this (with the 'makeactive' and 'chainloader'
    statements in the opposite order, but I seriously doubt this is relevant.)

    According to _Linux Administrator Handbook_ (Evi Nemeth, et al.), they have
    seen cases where GRUB wouldn't boot Windows and other situations where
    Windows' boot loader would boot GRUB.
     

    XP wrote its primary bootstrap to the MBR. I think the file MS calls the
    "boot loader" is c:\ntldr, but there also are other files in c:\ used for
    booting.
     

    In the old days, "fdisk /mbr" would do the trick. I read recently some
    other command was required for 2000/XP, but I don't seem to have saved the
    article.
     

    Based in the information you gave, that I snipped, it "should" have worked.
    If XP is important, there are several other boot methods.

    1) save the GRUB boot sector to a floppy (before you overwrite it with
    XP's), give XP back its MBR, and use the XP boot loader to load GRUB.
    It's a simple process, if a bit tedious

    2) try other boot managers. I've had very good luck with System Commander,
    but it isn't free. When I got GRUB to boot both Win2000 and Linux, I
    stopped using SC immediately.
    Jules Guest

  7. #7

    Default Re: Dual boot Win XP / Linux, using grub

    On Wed, 22 Oct 2003 00:02:09 +0200, in article
    <3f95ace7$0$12898$freenet.de>, Stefan S÷ffing wrote:
     [/ref]
    >
    > But can you tell me how this chainloader thing works?[/ref]

    The combination of "rootnoverify (hd0,0)" and "chainloader +1" tells GRUB
    to read the first sector of (hd0,0) [a.k.a. /dev/hda1 and c:] into memory
    and then 'execute' it, just like the BIOS would. In theory, there's no
    reason why this shouldn't work, but as I mentioned in another article I
    just posted, I've read sometimes it just doesn't work.
     

    'ntldr' is just another file in c:\, perhaps with the 'system' and 'hidden'
    bits set. It's special to the NT/2000/XP boot process but it's a file.
    (If you can boot Linux and mount the NTFS partition, you can find it in the
    XP root directory.)

    GRUB didn't mess with this file; it doesn't know how to deal with it
    either. That's part of what chainloading is all about.
    Jules Guest

  8. #8

    Default Re: Dual boot Win XP / Linux, using grub

    On Wed, 22 Oct 2003 01:21:44 GMT, in article
    <li-po.edu>, a user wrote:
     

    Also, check to make sure XP really is (hd0,0).
     

    I don't think Windows 2000 or XP "honor" the active flag. On my system,
    cfdisk says the "FS Type" of the (NTFS) Windows 2000 partition is "Hidden
    HPFS/NTFS". For Windows 2000, I used to use "unhide" and "makeactive" in
    GRUB but I took them out and Windows 2000 still booted.
     

    On my system /dev/hda1 (Windows 2000) and /dev/hda3 (Linux /boot) both are
    flagged "Boot". I don't think either Linux or Windows cares.
     

    It's worth a try.
     

    I like GRUB! When I used LILO, it was annoying to have to copy its updated
    boot sector to the WinNT partition after running /sbin/lilo. Fortunately,
    that's not a problem with GRUB.

    --
    "[O]bviously Linux owes its heritage to Unix, but not its code.
    We would not, nor will not, make such a claim."
    -- Darl McBride. CEO, The SCO Group. August 2002.
    Jules Guest

  9. #9

    Default Re: Dual boot Win XP / Linux, using grub

    Douglas Mayne wrote: 

    Yes, I was.

    But I'm no longer sure, where the problem really is. As you wrote, all I
    should need to boot XP are those three files. So I got a boot floppy,
    containing these files and tried to boot. I finally got the Windows
    "boot loader" (where I could choose the partition to boot from -
    according to the settings in boot.ini), but all I got was a message
    telling me somehting about a disk error.

    Well, since I've got too much spare time, I'll try to reinstall WinXP
    now :-/

    Stefan

    Stefan Guest

  10. #10

    Default Re: Dual boot Win XP / Linux, using grub

    Jules Dubois wrote:
     
    >
    >
    > The combination of "rootnoverify (hd0,0)" and "chainloader +1" tells GRUB
    > to read the first sector of (hd0,0) [a.k.a. /dev/hda1 and c:] into memory
    > and then 'execute' it, just like the BIOS would. In theory, there's no
    > reason why this shouldn't work, but as I mentioned in another article I
    > just posted, I've read sometimes it just doesn't work.[/ref]

    What should it find in this first sector? Is is this ntldr file or some
    piece of code that will the ntldr? How can I make sure that the first
    sector contains this special file (ntldr) and not something else?

     
    >
    >
    > 'ntldr' is just another file in c:\, perhaps with the 'system' and 'hidden'
    > bits set. It's special to the NT/2000/XP boot process but it's a file.
    > (If you can boot Linux and mount the NTFS partition, you can find it in the
    > XP root directory.)
    >
    > GRUB didn't mess with this file; it doesn't know how to deal with it
    > either. That's part of what chainloading is all about.[/ref]

    Stefan Guest

  11. #11

    Default Re: Dual boot Win XP / Linux, using grub

    On Wed, 22 Oct 2003 07:43:36 -0600, Stefan S÷ffing wrote:
     
    >>
    >>
    >> The combination of "rootnoverify (hd0,0)" and "chainloader +1" tells
    >> GRUB to read the first sector of (hd0,0) [a.k.a. /dev/hda1 and c:] into
    >> memory and then 'execute' it, just like the BIOS would. In theory,
    >> there's no reason why this shouldn't work, but as I mentioned in
    >> another article I just posted, I've read sometimes it just doesn't
    >> work.[/ref]
    >
    > What should it find in this first sector? Is is this ntldr file or some
    > piece of code that will the ntldr? How can I make sure that the first
    > sector contains this special file (ntldr) and not something else?
    >
    > <snip>
    >[/ref]
    The windows boot sector code is not "ntldr," but it is the code which
    looks for and loads ntldr. The grub loader transfers control (chainloads)
    to the boot sector code. Aside: if you try to chainload directly to
    ntldr, then grub will report "unknown executable."

    The windows boot sector code will be written to the partition when it is
    formatted by Windows "disk administrator" or by Windows setup. If you were
    to format the partition with some other tool, then there is no guarantee
    the boot code will be written to the sector. However, there is a tool
    called mkbt.exe which can be used to repair this sector- see doentation
    for mkbt.exe (google) for details.

    --Douglas Mayne
    Douglas Guest

  12. #12

    Default Re: Dual boot Win XP / Linux, using grub

    On Wed, 22 Oct 2003 15:43:36 +0200, in article
    <3f96898c$0$19447$freenet.de>, Stefan S÷ffing wrote:

    I notice Mr. Mayne has already posted an informative follow-up
    <bn69a8$6uq$xmission.com>. I'll just add a few more words.
     
    >
    > What should it find in this first sector?[/ref]

    It finds it in the first sector (sector 0; the "boot" sector) of the
    Windows XP partition. It's just some magical data and code that live
    outside the filesystem.
     

    No, ntldr is a file in c:\. As I said before, you can boot Linux, mount
    the XP partition, and see the three files Mr. Mayne mentioned: ntldr,
    NTDETECT.COM, and BOOT.INI.
     

    Yes, the boot sector loads part -- or all; I don't know and it's not an
    issue here -- of ntldr; then its job is done and XP must complete its
    bootstrap process and continue. It's the same with GRUB and Linux.
    Jules Guest

  13. #13

    Default Re: Dual boot Win XP / Linux, using grub

    On 2003-10-22, Jules Dubois <tld> wrote: 
    >
    > Also, check to make sure XP really is (hd0,0).

    >
    > I don't think Windows 2000 or XP "honor" the active flag. On my system,
    > cfdisk says the "FS Type" of the (NTFS) Windows 2000 partition is "Hidden
    > HPFS/NTFS". For Windows 2000, I used to use "unhide" and "makeactive" in
    > GRUB but I took them out and Windows 2000 still booted.

    >
    > On my system /dev/hda1 (Windows 2000) and /dev/hda3 (Linux /boot) both are
    > flagged "Boot". I don't think either Linux or Windows cares.[/ref]

    Just checked fdisk and the xp partition is flagged as "boot", which,
    to me, is the same as "active" as in older terminology. Even the
    fdisk uses the term "make active" which seems like it is now
    "boot/active" depending what one uses to view as I think windows
    stuff would call it "active".

     
    >
    > It's worth a try.

    >
    > I like GRUB! When I used LILO, it was annoying to have to copy its updated
    > boot sector to the WinNT partition after running /sbin/lilo. Fortunately,
    > that's not a problem with GRUB.
    >[/ref]

    For me, using windows to select and start an OS, is "safer"; perhaps it
    is now more a matter of not trusting m$ as m$ have messed up the
    boot sector with their "service packs".
    a Guest

Similar Threads

  1. Dual boot and grub problem.
    By Gordon in forum Ubuntu
    Replies: 6
    Last Post: June 29th, 12:05 PM
  2. Dual boot two versions of Linux
    By David Speight in forum Ubuntu
    Replies: 3
    Last Post: March 16th, 01:54 PM
  3. problem with grub in redhat 9 (dual boot win98)
    By Alex in forum Linux Setup, Configuration & Administration
    Replies: 6
    Last Post: September 26th, 05:12 PM
  4. how to put linux in 98/xp dual boot
    By Madhur in forum Linux Setup, Configuration & Administration
    Replies: 0
    Last Post: August 20th, 06:19 AM
  5. How to Install Dual Boot of Two Linux
    By Ross in forum Linux Setup, Configuration & Administration
    Replies: 3
    Last Post: July 18th, 08:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139