LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cant install xp and ubuntu on separate sata drives (https://www.linuxquestions.org/questions/linux-newbie-8/cant-install-xp-and-ubuntu-on-separate-sata-drives-708855/)

aBitLater 03-03-2009 12:38 PM

[solved] cant install xp and ubuntu on separate sata drives
 
I'm having serious problems with this.

I've started over from scratch several times, and don't know how to proceed.

My latest attempt.

1) install winxp on 1st sata drive
2) install ubuntu on 2nd sata drive - with grub on hd0 (1st drive)

Then I try the grub option for winxp, and I get
Code:

Windows could not start because the below file is missing or corrupt:

C:\Winnt\System32\Ntoskrnl.exe

my google searches reveal that this is due to a missing or corrupt boot.ini file.

So then I load the windows install disk for repair ("R" option), do a "fixboot" and "fixmbr", which gets windows to boot, but overwrites grub

Then I go to ubuntu livecd and do some grub magic, per instructions from googling, and get grub back. But it still won't load windows, I get the same error as above.

So I tried using the windows XP bootloader by dd'g the grub mbr and copying to windows c drive and modifying the boot.ini. When I try this option and select my ubuntu install, I only get a blank black screen that says only "GRUB" at the top... it fails to load.

Need some help! Appreciate any pointers! (I'm wondering if SATA is the issue here??? or is it because I want to put both operating systems on separate drives? - most of the google results seem to be geared around having windows and linux on the same hard drive)

Thanks again, in advance!

rjwilmsi 03-03-2009 01:20 PM

What you are doing (installing Windows XP on one hard drive and Ubuntu on another hard drive, and using SATA drives) is perfectly reasonable and what I do myself (though I use opensuse).

I think that the trick you are missing here is that you need to be installing grub on the hard drive on which LINUX is installed. The Ubuntu installation should not be making any modifications to your Windows hard drive. Since it seems to be doing this by default, your best option might be to install Ubuntu with the Windows drive disconnected. Ubuntu should then install grub on your LINUX drive but without creating an entry for Windows. You should set your BIOS to boot from your LINUX drive by default. In the short term you can also use the option of changing the boot priority of your hard drives in your BIOS should you wish to boot Windows.

Then you can use whatever tools Ubuntu provides for managing disk mount points and the boot loader and create the appropriate mount point for your Windows drive and the required grub entry (ensuring that the grub boot loader is not written to the Windows drive). Alternatively, you could do this manually by modifying the files I indicate below.

Below is a sample of the configuration I use for a setup that should be pretty similar to yours:

Code:

root> more /boot/grub/menu.lst
# Modified by YaST2. Last modification on Thu Jan  1 10:15:46 UTC 2009
default 0
timeout 8
##YaST - generic_mbr
gfxmenu (hd0,3)/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.1 - 2.6.27.7-9
    root (hd0,3)
    kernel /vmlinuz-2.6.27.7-9-default root=/dev/disk/by-id/raid-pdc_cbegijeiii-part1 resume=/dev/disk/by-id/ra
id-pdc_cbegijeiii-part2 splash=silent showopts vga=0x31a
    initrd /initrd-2.6.27.7-9-default

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.1 - 2.6.27.7-9
    root (hd0,3)
    kernel /vmlinuz-2.6.27.7-9-default root=/dev/disk/by-id/raid-pdc_cbegijeiii-part1 showopts ide=nodma apm=of
f noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x31a
    initrd /initrd-2.6.27.7-9-default

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    makeactive
    chainloader +1

root > more /etc/fstab
/dev/mapper/pdc_cbegijeiii_part2 swap                swap      defaults              0 0
/dev/mapper/pdc_cbegijeiii_part1 /                    ext3      acl,user_xattr        1 1
/dev/mapper/pdc_cbegijeiii_part4 /boot                ext3      acl,user_xattr        1 2
/dev/mapper/pdc_cbegijeiii_part3 /home                reiserfs  acl,user_xattr        1 2
/dev/disk/by-id/ata-WDC_WD1600AAJS-00PSA0_WD-WMAP93058762-part1 /windows/C          ntfs-3g    users,gid=users
,fmask=133,dmask=002,locale=en_GB.UTF-8 0 0
proc                /proc                proc      defaults              0 0
sysfs                /sys                sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts              /dev/pts            devpts    mode=0620,gid=5      0 0

root> more /boot/grub/device.map
(hd1)  /dev/disk/by-id/ata-WDC_WD1600AAJS-00PSA0_WD-WMAP93058762
(hd0)  /dev/disk/by-id/raid-pdc_cbegijeiii


T74marcell 03-03-2009 01:30 PM

Try putting Linux and GRUB on the same drive, and let XP have the entire other drive on it's own. I don't know if that will solve the problem, but at least XP will not detect unauthorized changes to it's disk setup. This could also involve that XP goes on the second drive. That can be tricky, unless you always boot through GRUB.
I would like to know how this went, so please give some feedback about any results.

----------
T74marcell

Arch Linux

yancek 03-03-2009 04:38 PM

If you have not resolved this problem it would be useful to post the contents of your boot.ini file as well as the output of "sudo fdisk -l" and your Ubuntu menu.lst file.

Quote:

Windows could not start because the below file is missing or corrupt:

C:\Winnt\System32\Ntoskrnl.exe
The message above is after Grub loads and turns over control through chainloading to windows and is a very common error with windows. Is the Ntoskrnl.exe file there?

ALPHUX 03-03-2009 10:50 PM

install ubuntu on seperate hd
 
I am having similar problems.
Just installed ubuntu onto laptop thinking there would be a choice as to which hard drive I wanted to use. No such luck! Now I have the dual boot ubontu/xp sp3 on my laptop sata. Cant even uninstall it to try again.
This is gonna be a steep one!

aBitLater 03-04-2009 09:36 AM

Ok, I have started from scratch again since the last post.

Here's what I've done
1. installed winxp on the sata drive on channel 1
2. disconnect winxp sata drive
3. install ubuntu on the only drive connect (channel 2)
4. reconnect windows drive
5. change BIOS order for which sata channel is the boot up, making it ubuntu's disk with grub (channel 2 has the start-up sata drive now)
6. ubuntu starts up on (as it sees things) hd0,0
7. I added in these lines to /boot/grub/menu.lst

Code:

title Windows
    map (hd1) (hd0)
    map (hd0) (hd1)
    rootnoverify (hd1,0)
    makeactive
    chainloader +1


* I also tried T74marcell's suggestion of installing ubuntu on same drive as windows. This did not work, so I wiped it out, then loaded the Windows XP disk, "R" for restore, and did "fixboot" and "fixmbr" on the windows drive.

While at the restore console, I also did this (from a google result suggestion elsewhere)
c:\expand d:\i386\ntoskrnl.ex_ c:\windows\system32

(That didn't fix anything)

* I also tried using a different keyboard, as another web page suggested the ntoskrnl error could be causes by a bad pin on the keyboard connector. (I'm using USB, and switched to a different PS/2 style)... that didn't help either.

PLEASE NOTE:
1. grub is on the ubuntu disk (channel 2 sata, the BIOS boot up disk)
2. if I disconnect the ubuntu disk, windows can load normally
3. Choosing the grub option for winXP will get me into the boot.ini menu - which has an option for linux that I added when I was trying to boot linux from windows - had problems with that too, but that's another story. It is after I select the default option from the boot.ini menu that I get the error.
4. Also important: if I put the XP CD in, BUT DO NOT boot from it (let the prompt for "press any key to boot from CD.." run out), somehow windows boots perfectly. It skips my grub altogether, so I guess the CD (even though I didn't boot from it) auto-magically finds my windows drive and loads the *same boot.ini*. Funny thing here is that when I get the boot.ini after having the XP CD in the CD drive, everything works.

From point 3 above, I'm thinking my problem is with boot.ini (?)
looking at the boot.ini, I see "multi" used instead of "scsi" - I was wondering, shouldn't windows see the drives as scsi, as linux apparently does (I have sda and sdb, not hda and hdb in linux).

Here is the contents of grub on the ubuntu disk, boot.ini on windows disk, and fdisk -l output (note from fdisk output, the windowsXP install originally used the whole drive, it was shrunk when I tried T74marcell's suggestion)

Again, thank you all for your continued help!
-- Brian

/boot/grub/menu.lst
Code:

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default                0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout                5

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title                Windows 95/98/NT/2000
# root                (hd0,0)
# makeactive
# chainloader        +1
#
# title                Linux
# root                (hd0,1)
# kernel        /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=3fecfacb-8afd-46dd-83fa-b46a33a466d5 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=3fecfacb-8afd-46dd-83fa-b46a33a466d5

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title                Ubuntu 8.10, kernel 2.6.27-11-generic
uuid                3fecfacb-8afd-46dd-83fa-b46a33a466d5
kernel                /boot/vmlinuz-2.6.27-11-generic root=UUID=3fecfacb-8afd-46dd-83fa-b46a33a466d5 ro vga=792
initrd                /boot/initrd.img-2.6.27-11-generic
quiet

title                Ubuntu 8.10, kernel 2.6.27-11-generic (recovery mode)
uuid                3fecfacb-8afd-46dd-83fa-b46a33a466d5
kernel                /boot/vmlinuz-2.6.27-11-generic root=UUID=3fecfacb-8afd-46dd-83fa-b46a33a466d5 ro  single
initrd                /boot/initrd.img-2.6.27-11-generic

title                Ubuntu 8.10, kernel 2.6.27-7-generic
uuid                3fecfacb-8afd-46dd-83fa-b46a33a466d5
kernel                /boot/vmlinuz-2.6.27-7-generic root=UUID=3fecfacb-8afd-46dd-83fa-b46a33a466d5 ro quiet splash
initrd                /boot/initrd.img-2.6.27-7-generic
quiet

title                Ubuntu 8.10, kernel 2.6.27-7-generic (recovery mode)
uuid                3fecfacb-8afd-46dd-83fa-b46a33a466d5
kernel                /boot/vmlinuz-2.6.27-7-generic root=UUID=3fecfacb-8afd-46dd-83fa-b46a33a466d5 ro  single
initrd                /boot/initrd.img-2.6.27-7-generic

title                Ubuntu 8.10, memtest86+
uuid                3fecfacb-8afd-46dd-83fa-b46a33a466d5
kernel                /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

title Windows XP Pro
map (hd1) (hd0)
map (hd0) (hd1)
rootnoverify (hd1,0)
makeactive
chainloader +1

boot.ini
Code:

[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Professional" /noexecute=optin /fastdetect

c:\grub.lnx="linux"

fdisk -l
Code:

Disk /dev/sda: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000ad764

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1      15583  125170416    7  HPFS/NTFS

Disk /dev/sdb: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x022b4428

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *          1      35726  286969063+  83  Linux
/dev/sdb2          35727      36481    6064537+  5  Extended
/dev/sdb5          35727      36481    6064506  82  Linux swap / Solaris


yancek 03-04-2009 05:27 PM

If I understand correctly, you now have your Ubuntu drive as first boot priorit and xp on the second drive? If so, change your xp entry in Grub menu.lst to:

Quote:

title Windows XP
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
You need the rootnoverify before the map commands.

Your fdisk -l output shows the xp as sda, first drive so the above may not work? If it doesn't, log in as root and run commands from grub prompt:

geometry (hd0)
geometry (hd1)

to get partition info as Grub sees it.

Not really that familiar w/boot.ini file but the entry below you showed in your post looks a little odd. Really don't know enough about it to say. Perhaps someone else more familiar will view the post.

Quote:

/noexecute=optin

jschiwal 03-04-2009 05:39 PM

Just a dumb question. What was the exact command yoou used to copy the second drives MBR to the first drive. Particularily, how many bytes did you copy?

Your C:\BOOT.INI file will chainload the boot loader for Linux, if you have copied the first 244 bytes of drive 2 to the C:\GRUB.LNX file. So you don't need a windows stanza in the grub menu, if the computer boots up to the first HD and ntldr presents you with a boot menu.

You do need to update for the device /dev/sdb however, before copying the MBR fragment to C:\GRUB.LNX.

aBitLater 03-04-2009 05:59 PM

yancek:
I'm not sure how it works or why it's this way, but yes, the ubuntu drive is the boot drive, and ubuntu was installed while the cables were unplugged on the windows drive. I would have thought that ubuntu would see itself as being on sda and not on sdb. Having said that, when I boot into ubuntu, the first message I see from grub is something about booting from (hd0,0), then it goes right into ubuntu loading.

To be more confusing, here is the output of geometry
Code:

grub> geometry (hd0)
drive 0x80: C/H/S = 36481/255/63, The number of sectors = 586072368, /dev/sda
  Partition num: 0,  Filesystem type unknown, partition type 0x7

grub> geometry (hd1)
drive 0x81: C/H/S = 36481/255/63, The number of sectors = 586072368, /dev/sdb
  Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
  Partition num: 4,  Filesystem type unknown, partition type 0x82

This looks like grub 'geometry' sees the windows disk as hd0 (at least after ubuntu is loaded).

I had the rootnoverify line as first before, but changed it to match rjwilmsi's example in this thread. I'll change it back. Wonder if I should change my grub entry for XP to 'rootnoverify (hd0,0)' - this is confusing the hell out of me, I'm sure it can't be easy on you :)

EDIT: Here is technet's explanation of /noexecute option in boot.ini
Quote:

/NOEXECUTE
This option is only available on 32-bit versions of Windows when running on processors supporting no-execute protection. It enables no-execute protection (also known as Data Execution Protection - DEP), which results in the Memory Manager marking pages containing data as no-execute so that they cannot be executed as code. This can be useful for preventing malicious code from exploiting buffer overflow bugs with unexpected program input in order to execute arbitrary code. No-execute protection is always enabled on 64-bit versions of Windows on processors that support no-execute protection. There are several options you can specify with this switch:/NOEXECUTE=OPTIN Enables DEP for core system images and those specified in the DEP configuration dialog.
/NOEXECUTE=OPTOUT Enables DEP for all images except those specified in the DEP configuration dialog.
/NOEXECUTE=ALWAYSON Enables DEP on all images.
/NOEXECUTE=ALWAYSOFF Disables DEP.
jschiwal:
When I was trying to accomplish a boot menu for ubuntu from within windows boot.ini, I had copied 512 bytes from the ubuntu drive. This was according to a couple web sites I found. Today I saw another post where someone recommended "dd if=/dev/sdb bs=446 count=1 of=some-filename".

I think I'd *prefer* to let grub do this, but am willing to try that option again if all else fails.

EDIT:
I'm not sure what you mean when you say,
Quote:

You do need to update for the device /dev/sdb however, before copying the MBR fragment to C:\GRUB.LNX.

yancek 03-04-2009 11:22 PM

If the previous entry I suggested for xp does not work try:

title windows xp
rootnoverify (hd0,0)
chainloader +1

kmacphail 03-05-2009 06:08 AM

From what I can make out there appears to be a bit of a conflict between which drive is hd0. Ubuntu from my experience preffers to be given the title hd0 this can be altered from the boot/grub directory edit the device.map file. To do this from the command line type:

sudo nano /boot/grub/device.map

You will be given something like this:

hd0 - sda
hd1 - sdb


If this is the case then switch these round:

hd1 - sda
hd0 - sdb


Then we will need to make sure that this is as it should be in the menu.lst

sudo nano /boot/grub/menu.lst

any refernce to ubuntu should be from hd0 and any referneces to your windows drive should be hd1.

This sorted the problem for me.

ps why did you disconnect the hard disk while installing Ubuntu? there is an option to set the hard disk that you want as long as you know if it is sda or sdb.

Duck2006 03-05-2009 07:16 AM

If all fails you can try EasyBCD.

http://neosmart.net/dl.php?id=1

aBitLater 03-05-2009 01:20 PM

Quote:

Originally Posted by kmacphail (Post 3465631)
From what I can make out there appears to be a bit of a conflict between which drive is hd0. Ubuntu from my experience preffers to be given the title hd0 this can be altered from the boot/grub directory edit the device.map file. To do this from the command line type:

sudo nano /boot/grub/device.map

You will be given something like this:

hd0 - sda
hd1 - sdb


If this is the case then switch these round:

hd1 - sda
hd0 - sdb


Then we will need to make sure that this is as it should be in the menu.lst

sudo nano /boot/grub/menu.lst

any refernce to ubuntu should be from hd0 and any referneces to your windows drive should be hd1.

This sorted the problem for me.

ps why did you disconnect the hard disk while installing Ubuntu? there is an option to set the hard disk that you want as long as you know if it is sda or sdb.

I only had one line in the device.map file. It listed hd0 as sda. Even /etc/fstab listed ubuntu drive as sda. I changed that one line to sdb, but that didn't change anything. Ubuntu still booted up to sdb.

I changed device.map back to default and switched the cables on the sata drives. Finally ubuntu sees itself properly as sda. But the winXP option in grub still got me into the windows boot.ini menu, and the ntoskrnl.exe error still appeared.

I inserted windows CD for fixboot, fixmbr, etc, and it overwrote my ubuntu (stupid me). did a grub repair but that failed to get ubuntu up. Now doing fresh install of both OS's again.

This time, I am disconnecting the disk on channel 1 (that will be ubuntu), and installing windows with only that one disk connected (channel 2).

When that finishes, I'll reconnect ubuntu and install it on the channel 1 sata disk with the windows disk still connected on channel 2 - but I will choose the option to put grub on the root partition of the ubuntu disk. Then I will make sure BIOS boots up on channel 1 / ubuntu.

frieza 03-05-2009 01:23 PM

just a question but woudn't it be easier to install grub on the MBR of the first drive and let it handle booting the correct drive and partition (including windows)?

aBitLater 03-05-2009 03:13 PM

Quote:

Originally Posted by frieza (Post 3466063)
just a question but woudn't it be easier to install grub on the MBR of the first drive and let it handle booting the correct drive and partition (including windows)?

depends on who you talk to or which google result you take instruction from.


All times are GMT -5. The time now is 03:51 PM.