LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-27-2003, 06:41 PM   #1
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Typo with GRUB caused Win98 to be unbootable


Kay, so I got Win98 installed on /dev/hda, and then installed Gentoo on /dev/hdb. Everything worked fine, and Windows was bootable after following the great instructions provided on Gentoo's site. I had to do some kernel reconfiguration, so afterwards, I ran GRUB and did this:

> root (hd1,0) // /boot partition of Gentoo
> setup (hd0,0) // first partition on hda! not MBR. oops!
> quit

One small typo in the second line is what messed it up, I think; rather than installing the bootloader into the MBR of the first disk, it installed into the first partition of the first disk. I should have typed:

> setup (hd0)

So now GRUB is installed both in the MBR (hd0) and in the first partition (hd0,0). Now, when I select "Windows" from the boot menu, it tries to boot from the boot record on (hd0,0)... which is just GRUB again, giving me the bootloader menu.

As I understand it, there's no way to remove a bootloader from a disk... is there any way, outside of reinstalling Windows (ugh) to restore the Windows boot record on (hd0,0)?
 
Old 11-27-2003, 07:42 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Sorry to say that, but not too likely. Hope
someone else here has better news, and
a fair idea of what those so and so many
bytes are MEANT to look like instead of
grub...



Cheers,
Tink
 
Old 11-27-2003, 08:55 PM   #3
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Original Poster
Rep: Reputation: 48
Dang. I hope someone else has some suggestions

At least Gentoo is working great; I shouldn't have any problems mounting the partition in question and backing up anything important before reinstalling. Should also be easy to restore the MBR using the Live CD after Windows obliterates it...

I am liking Gentoo so far, aside from the lengthy merging/compiling process. Getting distcc installed right now to speed that up, though!
 
Old 11-27-2003, 10:07 PM   #4
DurantDL
Member
 
Registered: Oct 2003
Location: Virginia, USA
Posts: 31

Rep: Reputation: 15
Basically you overwrote the DOS boot sector with grub.
Indeed, there are various ways to fix this.

The original DOS boot sector backup should be in /boot.
You can put it back in place using the "dd" command.
For IDE windoze drive C: try something like this:
% dd i=/boot/boot.dos o=/dev/hda1 bs=512 cnt=1

If you have a bootable DOS disk, you could try using "recover".
 
Old 11-27-2003, 10:27 PM   #5
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Original Poster
Rep: Reputation: 48
Thanks! Both of those options sound considerably less painful than reinstalling Windows

My /boot directory has only Linux kernel stuff in it, but /boot/grub has the following:

Code:
-rw-r--r--    1 root     root         7872 Nov 26 02:37 e2fs_stage1_5
-rw-r--r--    1 root     root         7536 Nov 26 02:37 fat_stage1_5
-rw-r--r--    1 root     root         6912 Nov 26 02:37 ffs_stage1_5
-rw-r--r--    1 root     root          184 Nov 27 10:27 grub.conf
-rw-r--r--    1 root     root         1256 Nov 26 02:36 grub.conf.sample
-rw-r--r--    1 root     root         8480 Nov 26 02:37 jfs_stage1_5
-rw-r--r--    1 root     root         7072 Nov 26 02:37 minix_stage1_5
-rw-r--r--    1 root     root         9440 Nov 26 02:37 reiserfs_stage1_5
-rw-r--r--    1 root     root        33856 Nov 26 02:36 splash.xpm.gz
-rw-r--r--    1 root     root          512 Nov 26 02:37 stage1
-rw-r--r--    1 root     root       106428 Nov 26 02:37 stage2
-rw-r--r--    1 root     root         6528 Nov 26 02:37 vstafs_stage1_5
-rw-r--r--    1 root     root         9384 Nov 26 02:37 xfs_stage1_5
Any idea which of those would help me? Only 'stage1' is 512 bytes, but I'm assuming that's the GRUB loader that's supposed to go in the MBR. Maybe 'fat_stage1_5'?

Don't think I have a DOS boot disk lying around (and this machine has no floppy drive anyway), so maybe the Win98 CD-Rom can do 'recover'.

Or, if someone else has a boot.dos that they could email me, that would be wonderful! Presumably they're all about the same...?
 
Old 11-28-2003, 12:08 AM   #6
DurantDL
Member
 
Registered: Oct 2003
Location: Virginia, USA
Posts: 31

Rep: Reputation: 15
Hmm .. where did I get that boot.dos from?
Perhaps left over when I upgraded from lilo?

I am afraid my C: boot.dos has bad values for your HDD.
I recall the boot sectors are customized for each partition;
I once moved the MBR to floppy to boot directly from C: ...

DOS drive partitions have a boot record, two FATs, and root directory.
Sizes vary according to partition size and format (FAT-12, -16, or -32).
DOS will also refuse to repair partitions it does not recognize.

I propose the following solution, if you are williing:
- use the Linux CD to backup the "grub" MBR
- backup the C: partition header
- erase the (grub) boot sector
- run the WinCD "recover" command
- check to see if all is well with C:
- if not, save off the new boot sector
- use "dd" to replace the first Mb of C:
- use "dd" to restore the new boot sector
- use the Linux CD to restore the "grub" MBR
Sound like a good strategy to you?

Since other solutions involve using various repair toolkits,
you should use "dd" to back up the HDD partition header.
Maximum size: boot=512, FATs=2*65536*4, root=[dir_entries]*32
You should be safe if you back up the first Megabyte.

- use the Linux CD to backup the "grub" MBR

- backup the C: partition header
% dd if=/dev/hda1 of=/root/hda1.header bs=1024 cnt=1024

- erase the (grub) boot sector
% dd if=/dev/zero of=/dev/hda1 bs=512 cnt=1

- run the WinCD "recover" command
Boot the WinCD, and exit to the prompt
> recover C:
- check to see if all is well with C:
All is well if you can READ SUBDIRECTORIES and ALL FILE DATA IS CORRECT !

- if not, save off the new boot sector
% dd if=/dev/hda1 of=/boot/hda1.boot bs=512 cnt=1

- use "dd" to replace the first Mb of C:
% dd if=/root/hda1.header of=/dev/hda1 bs=1024 cnt=1024

- use "dd" to restore the new boot sector
% dd if=/boot/hda1.boot of=/dev/hda1 bs=512 cnt=1

You really only needed the boot sector, but WinCD may clobber more.

- use the Linux CD to restore the "grub" MBR
 
Old 11-28-2003, 07:45 AM   #7
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Original Poster
Rep: Reputation: 48
Woohoo!

Okay, I was unable to find a 'recover' executable on the Win98 boot CD (or in my \windows\command directory). There was a 'recover.txt' which described how to recover from a previous backup, but I have no such backup.

Anyhow, after a bit more searching, it turns out that I'm not the first person to have done this. This person and this person did the same thing, and the recommended restoration process was to run "sys c:" from a boot floppy. The Win98 CDrom doesn't come with 'sys', so I just used the CD to boot. Can't run 'sys' on the current drive, so I did:

C:\WINDOWS\COMMAND> sys e:
System transferred
C:\WINDOWS\COMMAND> copy sys.com e:
1 file(s) copied
C:\WINDOWS\COMMAND> e:
E:\> sys c:
System transferred

(I can't believe I ever thought that DOS was cool. What a wussy interface it is compared with *nix). Anyway, windows will now boot. It has apparently lost a bunch of driver settings and whatnot, and the video mode is wrong, but that can be easily fixed.

Thanks a bunch for your help, at any rate! The solution turned out to be much easier than I'd have expected.
 
Old 11-28-2003, 08:21 AM   #8
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Original Poster
Rep: Reputation: 48
Blah. That did not work, apparently. Win98 booted, but practically nothing worked; all my devices were gone, no CD-Rom drive, and I got a protection error on booting it the second time. I tried restoring the original first megabyte that I backed up per your suggestion, and then overwriting the first 512 bytes with the post-recovery version; it booted and seemed okay, but I got critical errors with just about everything I did.

Rather than putz about with it any longer and probably end up with a flaky (flakier) Windows install, I am just gonna reinstall Windows Already got the important stuff backed up (which wasn't too much, since this box just had a fresh install a couple weeks ago), so it should be fairly painless. And actually, we're about to buy a new 80GB hard drive, so maybe I'll just start over with that; the drive that's in there is quite old, and could well be the source of some of the problems.
 
  


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
Booting Win98 with GRUB kahlil88 Suse/Novell 1 06-19-2005 08:09 AM
Grub w/ Gentoo 2.6.3 - Kernel Panic - typo? smehi Linux - General 1 03-29-2004 01:24 AM
GRUB problem after each win98 boot qstat Linux - Newbie 2 11-05-2003 02:33 AM
is it an error or typo? blackcat Linux From Scratch 1 09-02-2002 06:41 PM
RH7.2/WIN98 Grub vs LILO MrGreg Linux - Software 2 11-08-2001 03:28 AM


All times are GMT -5. The time now is 10:17 AM.

Main Menu
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