LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   The grub catch 22 (https://www.linuxquestions.org/questions/linux-software-2/the-grub-catch-22-a-380068/)

Devyn 11-04-2005 10:14 PM

The grub catch 22
 
Hello,

I've a bit of a dillema. My FC2 (Recently successfully upgraded to FC4) installation has become unreacheable as the grub in the /dev/hda drive is no longer there. I would like to put it back but I'm running into trouble using 'grub-install /dev/hda' or 'grub'. My system is as follows:

/dev/hda (WINDOWS 2000 FAT32 - Currently unreacheable after mobo upgrade. ERROR: NTLDR is missing.)

The Linux distro is on '/dev/hdb' with '/proc', '/home', '/usr' etc all having their own partitions defined on '/dev/hdb'.

When I run 'grub-install' from the recovery CD (After running 'chroot /mnt/sysimage' I get something similar to:

"Could not open '/proc/partitions'" error message. '/proc/partitions' is defined, of course, on the recovery cd but when I avoid to mount I get errors that 'grub-install' can't find 'grub' or other files it now needs.

My guess is I have to find a way to mount the '/proc' partition on '/mnt/sysimage/proc' so that when I 'chroot', 'grub-install' will see my disks and all required files and successfully write itself. But I'm not sure and wanted to find out how best to proceed to recover my grub boot loader.

Otherwise the partitions are mountable and readeable but the loaders are messed up preventing either OS from booting. (Lucky for me I have a second Windows PC to work with.)

Thank You,
Devyn

Simon Bridge 11-05-2005 12:29 AM

Quote:

My guess is I have to find a way to mount the '/proc' partition on '/mnt/sysimage/proc' so that when I 'chroot', 'grub-install' will see my disks and all required files and successfully write itself.
So what's stopping you?
Also see:
https://www.redhat.com/archives/fedo.../msg04846.html

syg00 11-05-2005 02:12 AM

Re: The grub catch 22
 
Quote:

Originally posted by Devyn
My FC2 (Recently successfully upgraded to FC4) installation has become unreacheable as the grub in the /dev/hda drive is no longer there. I would like to put it back but I'm running into trouble
Boot-loaders don't just pack up their bags and leave of their own accord. What did you do to convince it to be "no longer there" ???.
Quote:

/dev/hda (WINDOWS 2000 FAT32 - Currently unreacheable after mobo upgrade. ERROR: NTLDR is missing.)
A motherboard change causes this ???. You must have a bootloader present to get this message - which one are you using, and why aren't you giving us all the info we need ???.
You're the one asking for help remember.
Quote:

The Linux distro is on '/dev/hdb' with '/proc', '/home', '/usr' etc all having their own partitions defined on '/dev/hdb'.

When I run 'grub-install' from the recovery CD (After running 'chroot /mnt/sysimage' I get something similar to:

"Could not open '/proc/partitions'" error message.
Why do you have a /proc (physical) partition ???. Did you create it or did the FC install ???.
/proc is (generally) the mountpoint for the proc psuedo filesystem.
Quote:

'/proc/partitions' is defined, of course, on the recovery cd
What does this mean - the /proc exists on the CD, or it appears when you boot from the CD ???.

I have never even attempted to install any FC distro as I had a gutful of "rpm hell" on RH9, and decided to find a "better place", however I find it hard to believe they use a physical /proc.
I'd just delete your /proc (or better mv it) - however see the caveat in the previous sentence.
But - how could it make the situation any worse ???.

Devyn 11-05-2005 09:58 AM

Re: Re: The grub catch 22
 
Hello,

My apologies. I should make this more clear:

Yes, the Windows system wouldn't boot after changing the mobo and cpu from an intel based system to an AMD system (FC4 booted fine and detected everything after the change). Error is 'NTLDR is missing' though when I mounted it through the still working FC4 system, I could see all the files on the '/dev/hda1' partition. I know it appears strange that it would do that after a mobo and cpu change but

I cleared the 'mbr' per suggestions that on occassion it can start Win 2K partitions incorrectly. The suggestion was that it might assume the FAT32 partition as NTFS when in fact it's not causing it to incorrectly read the file system. I'm trying to put 'grub' '/dev/hda' or '/dev/hdb'.

> Why do you have a /proc (physical) partition ???. Did you create it or did the FC install ???.
> /proc is (generally) the mountpoint for the proc psuedo filesystem

I created the '/proc' partition during install. The install is custom.

> '/proc/partitions' is defined, of course, on the recovery cd
> What does this mean - the /proc exists on the CD, or it appears when you boot from the CD
> ???.

Was late and I was tired. It should read:
"'/proc/partitions' was not found" and it appeared when running 'grub-install' after running 'chroot /mnt/sysimage'


> So what's stopping you?
Errors

I checked the link you provided as well but after typing grub there are a number of steps suggested on other sites to get grub working but it can't find the files in the folders that way either.

Here's more on what I tried:

When I boot with an FC3 CD (I upgraded FC2 to FC4 on my system without CD's) and run 'linux rescue' it created the ram disk but on that disk there is no 'grub' or 'grub-install'. This is on the '/dev/hdb1' partition which I mount under '/mnt/sysimage' so I can get access to 'grub' and 'grub-install' binaries/scripts. Most of the partitions are successfully mounted there except '/proc' which is empty and '/usr'. I can successfully mount '/dev/hdb3' on '/mnt/sysimage/usr/' but I can't locate and mount or otherwise access '/proc' partition.

Once I mount everything that can be mounted, I run 'chroot /mnt/sysimage' and reinstall grub on my system but as it can't access '/proc/partitions' it doesn't work.

-------------------------------------- [ SESSION INFO ] --------------------------------------------
1) I type 'linux rescue'
2) After it goes through it's boot sequence, I get the message:

3) Well as I was typing this, I went back to my system to get more info for you guy's and I finally fixed the problem with grub and my FC4.

I booted from the FC3 Disk 1 CD by typing 'linux rescue text' and going through the menu's I got this error:

An error occurred trying to mount some or all of your system.
Some of it may be mounted under /mnt/sysimage.
Press <return> to get a shell.
The system will reboot automatically when you exit from the shell.

Finally I got my prompt and entered the following after mounting '/dev/hdb3' on '/mnt/sysimage/usr':

$grub
grub>root (hd1)
grub>setup (hd0)


The solution was similar to what Simon Bridge suggested and that I noted earlier on another site. Thank you for that, though I would still like to find out how to fix the 'NTLDR is missing' problem (I really don't want to ask on a windows forums as they will probably throw suggestions my way that would likely kill my distro.) so if you have suggestions I can try, to fix the problem below with booting Windows from 'grub' I would really appreciate it:

Booting 'Other'

rootnoverify (hd0,0)
chainloader +1


NTLDR is missing
Press any key to restart

One more thing noteworthy is that when I use 'fdisk' after booting with a Win 98 CD, it lists the 'C:' partition after the 'ext' partition:

Partition Status Type Volume Label MBytes System Usage
1 EXT DOS 28616 100%
C: 2 PRI DOS VC 9543 FAT32 100%

Any help you can provide would be great with regards to this last problem. :)

Thanks,
Devyn

syg00 11-05-2005 05:05 PM

I really think you should reconsider having a /proc partition - call it something else.
All the automated solutions expect this to be for proc - as will people responding to questions.

The ntldr missing message comes out of the boot sector code in the Windows partition. Strictly not part of the boot-loader (as in the MBR), but the code that is at the start of the partition it points to. Obvious when you think about it, as you are not using the Windows loader, but still getting a Windows message.
This means you are getting to the Windows partition, and launching it's code. Ignore the partitions out of (numerical) order issue - happens all the time.

Where I have seen this (ntldr missing) is where people have installed grub into the Windows partition by accident.
Booting the XP CD and getting into recovery console may provide the answer - once in, "help" will list available commands I think. The "fixboot" command seems designed to fix exactly this issue, but apparently doesn't always - try that first.
Then maybe try "bootcfg /rebuild" - never tried it, and it might be just for fiddling with boot.ini.

Else you might be up for a XP re-install.

Simon Bridge 11-06-2005 03:34 AM

I think this bit was off me...
Quote:

> So what's stopping you?
Errors

I checked the link you provided as well but after typing grub there are a number of steps suggested on other sites to get grub working but it can't find the files in the folders that way either.
I asked "what's stopping you" because you seem able to get to a command console and you were wondering about how to mount the proc partition to the /mnt/sysimage/proc mountpoint.
Quote:

My guess is I have to find a way to mount the '/proc' partition on '/mnt/sysimage/proc' so that when I 'chroot', 'grub-install' will see my disks and all required files and successfully write itself. But I'm not sure and wanted to find out how best to proceed to recover my grub boot loader.
I wondered why you hadn't tried the mount command to do so. (You hadn't said what you had tried.) Now you say there are errors when you try to mount the proc partition to /mnt/sysimage/proc ... what are they and how did you try to do this?

The next sentence seems to be incomplete.
Quote:

I checked the link you provided as well but after typing grub
...yes? After typing "grub" what? You continue:[/quote] there are a number of steps suggested on other sites to get grub working but it can't find the files in the folders that way either[/quote]See? There's a bit missing. I've had this happen to me too - you probably typed it but it didn't get through.

After reading the replies to syg00, I am even more confused about what you have done.

It seems reasonable to me that win won't boot after changeing the entire mboard and CPU type. Fedora will support a wide range of CPUs as it is pretty complete. While win will run on a wide range of CPUs, a particular win installation may not. syg00 may know otherwise(?), but I cannot think of any reason it should.

The advice to remove the MBR seems to have been bad advice. Especially as it didn't seem to include instructions on how to stick grub somewhere else. Can you provide a link to that advice?

I suspect you are looking at a reinstall of windows, if you really must have it at all :) and a less complicated partitioning scheme for FC4.

I cannot think why you'd want to stick the proc fs in it's own physical partition. I don't know of anyone who has done it. If it isn't for the proc file system, then you'd better rename it. OTOH: FC4 worked OK in this configuration before didn't it? Chances are it is just messing up your grub install.

Note: this is a proc partition to be mounted, normally, on the /proc mountpoint? (no slash in the partition name - like: partition name = root, mount point = /; partition name = boot, mountpoint = /boot; see?)

I can understand giving /boot, /usr and /home their own partitions to live in though.

/bin/bash 11-06-2005 06:25 AM

If you have an XP cd then try syg00's suggestions. Unfortunately now-a-days most OEM's just supply System restore CD's which "unintellegently" write an image file to the hard drive destroying everything in it's path.

Another option is to find the backup bootsector (yes XP keeps a backup bootsector) and copy it back to the bootsector. Usually the backup bootsector is the last sector of the partition. If you have a hexeditor that lets you edit the harddrive directly then just copy the sector that way. If not you can use dd to copy the sector but that would require you calculate the last sector, then run dd something like this:
dd if=/dev/hda1 of=XPbootsect bs=512 count=1 skip=[number of last sector]
cat XPbootsector >/dev/hda1

You may want to look at the file XPbootsector with a hexeditor first to make sure it is a bootsector before you write it to /dev/hda1.

It should have NTFS at byte 4.

As for /proc partition, I agree with the others. The information in /proc is dynamic kernel info. There is no information in /proc that should be stored on the harddrive so however big your /proc partition is you are wasting that space.

Devyn 11-06-2005 02:21 PM

Hello,

Thanks again for the help!

> Then maybe try "bootcfg /rebuild" - never tried it, and it might be just for fiddling with boot.ini.

Unfortunately I have Windows 2000 and 'bootcfg' is not available on that CD. However, I did plug the drives back into the old mobo (Elitegroup P4S5A w/ Pentium IV Celeron 1.7Ghz CPU & 512 MB SDRAM) and the system booted though it complained that it can't find 'ntoskrnl.exe' in 'C:\WINNT\system32'.

My new mobo is an Asus K8V-X SE with the AMD Sempron 2800 and 512MB DDR.

So I'm guessint this isn't an OS issue but rather some BIOS settings between the boards.

Thanks,
Devyn

/bin/bash 11-07-2005 03:55 AM

Go into BIOS setup and try turning on LBA for HD0 harddrive. Do an auto detect ad see if it detects it correctly.

Devyn 11-07-2005 10:00 AM

Hello,

> Go into BIOS setup and try turning on LBA for HD0 harddrive. Do an auto detect ad see if it detects it correctly.
Thanks again. Yes that would solve it but my new board only had 'Auto' and 'Disabled'. Choosing 'Auto' should detect the drive as being formatted in LBA mode but it doesn't and LBA is turned off on the drive. The old mobo has such an option and I have it on forcing LBA mode regardless of how the drive is formatted. So what I did next is to read the MBR to a file and hex edit it to check what is the actual partition ID and it's correctly set to 0x0C which is Win 95 FART32 w/ LBA so it should be turned on. However, I've also read there is a entry for choosing LBA or C/H/S on the drive but I need to find the brakedown of a Win 95 FAT32 partition to know where that is so I can set it to force LBA that way. Once I find that I may be able to salvage my setup.

If there are any linux drive utilities that I could use to accurately check for such problems, I would really like to know about now. :)

I would post my partition information but I'm away from my terminal and can't show you my 'fdisk -l' at the moment.

Thanks,
Devyn

Devyn 11-07-2005 11:55 AM

Hello,

Allright. Here's the drive geometry and 'fdisk -l' info if it will help.

Thanks,
Devyn

------------------------------------------------------------------------
/dev/hda geometry
physical 16383/16/63
logical 16383/255/63

/dev/hdb geometry
physical 16383/16/63
logical 65535/16/63
------------------------------------------------------------------------

Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 19396 9775521 c W95 FAT32 (LBA)
/dev/hda2 19396 77536 29302560 f W95 Ext'd (LBA)
/dev/hda5 19397 38585 9671098+ b W95 FAT32
/dev/hda6 38585 77536 19631398+ b W95 FAT32

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 255 2048256 83 Linux
/dev/hdb2 256 4079 30716280 83 Linux
/dev/hdb3 4080 10453 51199155 83 Linux
/dev/hdb4 10454 14593 33254550 f W95 Ext'd (LBA)
/dev/hdb5 10454 13003 20482843+ 83 Linux
/dev/hdb6 13004 14278 10241406 83 Linux
/dev/hdb7 14279 14593 2530206 82 Linux swap

/bin/bash 11-12-2005 03:01 AM

Quote:

it can't find 'ntoskrnl.exe' in 'C:\WINNT\system32'
Have you recently used a boot editor to change the windows bootsplash screen? There should be a backup of ntoskrnl.exe somewhere on your system. It may be named ntoskrnl.ex_.

Devyn 11-15-2005 08:22 PM

Hi All,

I've resolved the issue. The heads for the partitions on '/dev/hda' were set to 16. This caused BIOS to incorrectly detect the partition and display 'LBA: off' during boot. I edited those values and set this to 255 instead. After that, the drive was detected as LBA instead of CHS, BIOS showed 'LBA: on' and Windows booted fine. Good ol linux 'dd' and 'fdisk'. :) Then I dived head long into the Windows driver hell but that's a story for another night. :)

Thanks,
Devyn

Simon Bridge 11-16-2005 02:57 AM

Well done :)

tinybit 11-18-2005 09:14 PM

GRUB and LILO always conflict with Windows.

So try GRUB for DOS please. It is a cross-platform boot loader based on GNU GRUB. The GRUB.EXE can be started from DOS/Win9x; and GRLDR can be started from BOOT.INI of Windows NT/2K/XP/2003; and even more, the GRUB.EXE can be started from LINUX via the KEXEC tool.

By using GRUB.EXE or GRLDR, you don't have to touch your MBR. It is the safest way coexisting with DOS/Windows.

You needn't install GRUB for DOS. Just run GRUB.EXE from DOS, or append a line of "C:\GRLDR=START GRUB" into your BOOT.INI(restart and select the "START GRUB" menu item), that will do.

Download GRUB for DOS here: http://freshmeat.net/projects/grub4dos/

There is a fat12grldr.img file with the GRUB for DOS release. You can create a GRUB bootable floppy with this fat12grldr.img file.

Or, you can just copy GRUB.EXE to your DOS floppy and run GRUB.EXE to enter the GRUB environment.


All times are GMT -5. The time now is 05:36 PM.