LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 05-27-2007, 07:46 AM   #1
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Rep: Reputation: 15
Grub bootloader for Debian 4.0 and Win XP error 17


Hi all,

I know there are many topics concerning grub but i didnīt find any topic to my special problem...so here we go:


Hdd configuration:

Code:
/dev/hda --> 
80GB NTFS partition (Windows XP only)
Code:
/dev/hdb --> 80 GB -->
30 GB  Reiserfs, Mount point "/"
50 GB  Reiserfs, Mount point "/home"
300 MB Swap

First i installed WinXP --> No prob
Then I installed Debian 4.0 (stable) via network-install --> no prob till grub installation

During the installation i was asked where to install grub --> mbr was my destination
Installation was finished successfull.

But when i restart, grub stops with error "17"

I use Linux for a long time and had no probs, but i ever installed "Win" and "Linux" in different partitions on the same hdd.

This is my first time where i use a own hdd for every system.



Anybody an idea?


Greetz
gsx
 
Old 05-27-2007, 02:04 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Surely a search on either LQ here or Google would give a million threads about GRUB error 17. From memory, I believe it's because the bootloader cannot find the kernel because it is not on the primary drive. I don't use GRUB myself, so I cannot give specifics on how to fix it, but the basic idea (I think) is to set up chainloading in the GRUB, to tell it where to find the kernel for the Linux.
Also, you will need to install GRUB to the root of the linux partition on hdb where Linux is installed. This will allow the GRUB in the MBR to 'chainload' the GRUB in the hdb partition, which will load Linux.

Apologies if this isn't totally accurate; as mentioned, this is going from memory. Please search for "GRUB Error 17" to verify or correct what I've said here.
Best of luck and let us know when/how you get it fixed!
 
Old 05-27-2007, 02:33 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
In this setup, you would need to tell the installer to put grub on the mbr of the first drive--ie hda. If you put it on the 2nd drive, you can easily recover by changing the boot order in the BIOS. Once in Linux, you have two options:
1. put grub on what is now drive 2, then change the boot order back in BIOS.
2. reconfigure the grub config file so that the "map" command is used to boot Windows (Since Windows gets unhappy when not on the 1st drive.)

the booting article at my site (link below) may be useful.
 
Old 05-28-2007, 12:59 AM   #4
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Grub error 17 means grub does not recognize the file system. (I'm going by memory also). The only way I can see this error being produced is by installing grub in the Windows partition, (/dev/hda1), based on the hard drive(s) configurations mentioned.
Normally, the Debian installer would pre-select the MBR of the first drive set to boot in the bios, (/dev/hda), which is normally the Windows drive, all one has to do is accept and re-boot into a dual boot environment.
The mistake allot of people make is changing the order of the drives, (primary to slave and slave to primary), or change the boot order in the bios to the slave drive before installing the second OS (which ultimately should be Linux). Or removing the Windows drive and installing Linux in the other drive, than re-install the Windows drive.
In a nut shell, when setting up a dual boot with two drives, don't change nothing, just direct the Linux installer to install on the drive you want, (second drive in this case), and let it install the boot loader in the MBR of the first drive. In most Linux installation scenarios, this takes less than an hour, but when you change things around instead of letting the Linux installer handle things, you'll find yourself spending a couple days and buy yourself allot of frustration.

EDIT: If you would prefer using a different boot loader like acronis, bootitng, Windows, etc., then install the Linux boot loader in the / or /boot Linux partition, (if you create a separate /boot partition), which would be /dev/hdb1 in this case. Then add the bootable partition, (/dev/hdb1), to your preferred boot loader that is controlling/installed in the MBR of the first drive set to boot in the bios, give it a name and it will boot it when selected from the list. If my assumption is correct, you will either have to re-install Windows, or use testdisk from a Live CD, or install it in Debian and use it to repair the Windows PBR (partition boot record), that has been overwritten with grub boot code, because it probably won't boot.

Last edited by Junior Hacker; 05-28-2007 at 01:49 AM.
 
Old 05-28-2007, 06:05 PM   #5
linpu18
LQ Newbie
 
Registered: May 2007
Posts: 14

Rep: Reputation: 0
Grub boot loader

When installing Linux and Windows on the same hard disk,it is generally not a good idea to install Grub or Lilo to MBR.This mistake, made my Windows XP partition unbootable, 3 years before.It is generally far better, to use a third party boot loader, and manage Windows and Linux boot loaders from there.I have done this many times, installing Linux boot loader on the boot(/) partition of whatever distribution I wanted to install.Then, I connected Linux boot loader to the third party loader and everything worked fine.The same holds true for different hard disks.I've checked that, at least 10 times.It is generally a very good idea, to have a "control center" for your bootable partitions and additionally ,you can easily have many operating systems on the same computer.
 
Old 05-28-2007, 06:35 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,499

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Grub is fine - if left to do its job.
From the (grub) error screen, see if you can talk to grub. Hit the <c> key - if you get the "minimal BASH-like ..." message, good. Try this
Code:
find /boot/grub/stage1     (find /grub/stage1 if that fails)
That will return something like (hd1,0) - use whatever is returned in the next command
root (hd1,0)

setup (hd0)
Re-boot and see what happens now.
 
Old 05-30-2007, 07:01 AM   #7
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Original Poster
Rep: Reputation: 15
Hi all,

first thx for your replys...

@linpu18: Itīs funny, everbody has a different experience.. I always installed linux and win.. on different partitions at the same hdd. I always installed lilo/grub in the mbr and I never had any problem with it


@syg00: Yeah..grub is fine Iīll try your suggestion tomorrow, because today Iīll be on a business trip.



An additionall thing I detected:

As I said in my first post I installed grub in the mbr of hda, the winxp hdd.
Grub installed without any error, but grub didnīt wrote the configuration file "menu.lst" by itself !!
I added this file by myself and of cousrse I said grub to boot linux from hdb (hd1,0) but no chance.
 
Old 06-01-2007, 12:16 PM   #8
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Original Poster
Rep: Reputation: 15
Servus,



@syg00:
I did it your way and grub ran through the process successfully....but when I restart: Error 17!!!


At the moment I donīt have any idea how to fix.....and you?
 
Old 06-01-2007, 12:50 PM   #9
masinick
Member
 
Registered: Apr 2002
Location: Concord, NH
Distribution: Debian, sidux, antiX, SimplyMEPIS, Kubuntu, Mandriva, Fedora, Xandros, Arch, and many others
Posts: 560
Blog Entries: 14

Rep: Reputation: 35
I am curious. If your Linux system is on the second drive, what happens if you also put the MBR on the second drive, e.g. something like this:

root (hd1,0)
and then
setup (hd1)

from the GRUB command line.

What happens if you try this? Do you still get an error 17 or do you get another result? By any chance do you get lucky and it works? If so, then you can add menu entries for your other systems and you will be able to boot them from this boot loader. All you need is to find a place where it can be successfully found and recognized, then once that happens, from then on you will be fine.

I suspect the real issue is that the /boot directory, and therefore the /boot/grub directory, which contains the Stage 1 and Stage 2 components of the GRUB booting process, is physically located on disk 2, but somehow the chit chat between the MBR, GRUB, and the routines is not clearly stating that you want the MBR on the zero drive (Drive 1 or Drive C to Windows) and the GRUB stuff where your distribution exists, the second drive - or with GRUB style offsets, referred to as hd1.

Convince each program where things live and this can be done. I don't have this kind of an environment on my system so I can't try it out for you, but it most definitely CAN be done. Apparently the default installation program is not telling GRUB the right thing, and this is non standard enough that it doesn't get it right without a lot of help.

That is why I suggest seeing if you can make BOTH the MBR and GRUB live on the same drive - the Linux drive and see if you can get your hardware to understand and boot. If you can, that is one work around. If not, there HAS to be an explicit way to tell GRUB where things really live.
 
Old 06-01-2007, 06:53 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,499

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
The MBR contains a flag to indicate which disk the stage files reside on - isn't (shouldn't be) a problem. That's part of the function of the "root(...)" command.

@GSX go back to the grub command prompt and enter (just)
Code:
root(hd
Then hit the tab key. Should show the two disks - pick hd1. Then hit tab again - make sure the partition list is correct for that disk.
Might be worthwhile seeing the outputs of these as well
Code:
fdisk -l
cat /boot/grub/device.map

Last edited by syg00; 06-01-2007 at 06:54 PM.
 
Old 06-05-2007, 01:19 PM   #11
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Original Poster
Rep: Reputation: 15
Hi masinick,

I tried your way and also the grub installer ran through successfull.
When I reboot I always boot windows....I think because my win hdd (/dev/hda) is the primary master hdd, so he see if on this hdd thereīs bootloader..he finds the winxp loader and load winxp.

Output comes the next minutes....
 
Old 06-05-2007, 07:10 PM   #12
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Original Poster
Rep: Reputation: 15
Ok this is the way i did it again:


- Booted linux via Insert 1.36 live cd.

- Opened a superuser shell

--> Output "fdisk -l":

Code:
Disk /dev/hda: 80.0 GB, 80026361856 bytes
240 heads, 63 sectors/track, 10337 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1       10336    78140128+   7  HPFS/NTFS

Disk /dev/hdb: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        3647    29294496   83  Linux
/dev/hdb2            9976       10011      289170   82  Linux swap / Solaris
/dev/hdb3            3648        9975    50829660   83  Linux

Partition table entries are not in disk order

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       12748   102398278+   7  HPFS/NTFS
/dev/sda2           12749       24792    96743430   83  Linux

Disk /dev/sdb: 131 MB, 131072000 bytes
16 heads, 32 sectors/track, 500 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         500      127983+   6  FAT16
Partition 1 has different physical/logical endings:
     phys=(498, 15, 32) logical=(499, 15, 31)

then mounted my linux partition /dev/hdb1/:

Code:
mkdir debian
mount -o rw /dev/hdb1/ debian/
switching to my debian system:

Code:
chroot debian/
Ok...starting grub console:

Code:
grub> root (hd [TAB]
Possible disks are: hd0 hd1 hd2 hd3

grub>root (hd1,0)
Filesystem is reiserfs, partition type 0x83

grub>setup (hd0)
Checking if /boot/grub/stage1 exists .....yes 
Checking if /boot/grub/stage2 exists .....yes
Checking if /boot/grub/reiserfs_stage1_5 exists .....yes

Running embed /boot/grub/reiserfs_stage1_5 (hd0) ... 19 sectors are embedded succeeded
Running install /boot/grub/stage1 d (hd0) (hd0)1+19 p (hd1,0) /boot/grub/stage2 .....succeeded
Done
--------------------------------------------------------

Output device.map:

Code:
(hd0)	/dev/hda
(hd1)	/dev/hdb
(hd2)	/dev/sda
(hd3)	/dev/sdb
Everything is correct from my point of view!



So when I reboot my pc I get grub error 17! Why?


Status quo:

Quote:
- WinXP hdd (/dev/hda): Primary Master
- Linux hdd (/dev/hdb): Primary Slave

- Use method above: --> Grub error 17
- Use method above with "setup (hd1)" instead of "setup (hd0)": --> WinXP boots up (because of slave)


Greetz
gsx
 
Old 06-06-2007, 02:38 AM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,499

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Quote:
Originally Posted by GSX
When I reboot I always boot windows....I think because my win hdd (/dev/hda) is the primary master hdd, so he see if on this hdd thereīs bootloader..he finds the winxp loader and load winxp.
Nope - shouldn't happen. The Windoze loader should be getting over-written. Means your disks aren't in the order you think they are (from the BIOS point of view). Lets see the output from this for each of the disks - all 4. Substitute the "?" as appropriate
Code:
dd if=/dev/?d? count=1 | strings | egrep -i "(ntfs|grub|lilo)"
 
Old 06-11-2007, 06:17 AM   #14
GSX
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Debian Etch, kernel 2.6.18
Posts: 103

Original Poster
Rep: Reputation: 15
Solution

Hi all, hi syg00,

thx for your help and replies....
At the weekend I read many articles about my problem and one issue I found again and again:

Code:
When Windoze and Linux are installed on two different hddīs, 
the "/boot" partition of linux has to be on the same hdd then windowze!
So I installed Debian stable again, switched the "/boot" partition to the windowze hdd (/dev/hda) and everything runs perfectly!


Disk configuration:

Code:
/dev/hda1 --> Windoze
/dev/hda2 --> /boot

/dev/hdb1 --> /
/dev/hdb2 --> /home
/dev/hdb3 --> swap


As I said, many thx for your help.....Issue solved
 
Old 06-11-2007, 06:23 AM   #15
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Glad you got your system working, but I do not think this is correct:
Quote:
When Windoze and Linux are installed on two different hddīs,
the "/boot" partition of linux has to be on the same hdd then windowze!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover grub bootloader after win install! teronslair Linux - Newbie 15 03-07-2010 01:25 AM
Error 21 from GRUB bootloader, can't get past BIOS Load snowake Linux - Newbie 7 10-19-2006 09:27 PM
How can I disable the grub bootloader and enable the lilo bootloader? abefroman Linux - General 1 08-06-2005 09:53 AM
GRUB bootloader spits out "GRUB hard disk error" Crampedson Linux - Software 2 01-26-2005 07:34 PM
GRUB Bootloader Error 23 plasma16 Linux - Newbie 0 06-28-2004 12:58 PM


All times are GMT -5. The time now is 08:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration