LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   Mdk 2006 - GRUB installation problems (https://www.linuxquestions.org/questions/mandriva-30/mdk-2006-grub-installation-problems-383803/)

iklesteve 11-16-2005 05:26 PM

Mdk 2006 - GRUB installation problems
 
I've just built a new machine (AMD 64X2 4400, Asus K8N-SLI deluxe) and am having trouble getting GRUB to install.

I've got Mandriva 2006 "free" x68_64 edition, which seems to install OK, until it tries to install the bootloader. Although there are no error messages at this point, it is clear that GRUB hasn't been installed at all, as nothing is added to the MBR of the boot partition.

My system has 2x200GB SATA drives, configured in a mirror RAID using the onboard nForce raid controller. The drivers for this are installed without problem at the start of Mandriva installtion. I am planning on using BootIt as my main boot manager (it has some useful features as I will also be running 32/64bit versions of Windows) so my drive is partioned as follows:

Code:

Primary: BootIt partition (FAT) 8Mb
Primary: Win_64 partition (NTFS) 10Gb
Primary: Win_32 partition (NTFS) 10Gb
Extended:
    /boot (ext2) 100Mb
    swap (swap) 4Gb
    / (ext2) 1Gb
    /home (ext2) 10Gb
    /tmp (ext2) 10Gb
    /var (ext2) 10Gb
    /usr (ext2) 30Gb

    [Some extra FAT-32 drives for general use here]

When prompted by the install I opt to install GRUB on the first sector of the root partition (side note: this is "/boot" right? not "/"), but have tried also to install to fd0.

When running in rescue mode and trying to reinstall GRUB, I get the following message:
Code:

Installing driver for sata_nv <snip>....
=> found a Mandriva Linux root partiiton on /dev/sda7
=> type ext2, version 'Mandriva Linux release 2006.0 (Official) for x86_64

<snip>
Installing boot loader...
running: sh /boot/grub/install.sh 2> SCALAR(0xf8aff0) with root /mnt

GNU GRUB <snip>

grub> root (hd0,4)
Error 21: Selected disk does not exist
grub> setup (hd0,4)
Error 12: Invalid device requested
grub> quit

I've tried reinstalling (about 10 times) with different disk configurations but always get the same message. Having said that, it did once load correctly (about the 2nd time I installed it) but then booting failed with some initrd problems. Now it won't even get that far.

So, does anyone have any ideas about what could be causing this and how to rectify it? I think it may be because of the RAID - my drives appear to be sitting in /dev/mapper/nvidia_cdhfeddc1 etc, should they not be referenced as /dev/sdc[x]? I'm new to both RAID and SATA on linux.....

I've a few years experience running linux on both desktop and server environments but this level of detail is a bit new to me so I apologise if I ask newbie questions!

Please help if you can - I'm itching to get the dual-core power flowing! :)

i.s

purelithium 11-16-2005 05:37 PM

Your problem is probably the fact that your /boot partition is on the raid array. a /boot partition should be located on a non-raid partition, as bootloaders get confused by raid.

iklesteve 11-16-2005 07:47 PM

Thanks for the reply - I tried adding an old IDE drive to my box and moving the /boot partition across to that. Still get the same error messages when trying to install GRUB and the drive is not bootable.
i.s

purelithium 11-16-2005 09:35 PM

Hmm... why do you insist on using grub, why not just use Lilo? Since you'll be using BootIt for the bootloader anyway, why not stick with the mandriva standard?

I've had no problems with Lilo.

spitfire5c 11-17-2005 01:23 AM

Hi
As far as the rescue mode not finding the disk goes, your problem may be related to not specifying the correct harddrive/partition number.

For example, its possible that if you're using IDE devices (e,g, PATA drive), the master device on the primary IDE channel may be seen as hd0 and if you have both the master and slave in use then the slave device may be hd1. This being the case, your SATA disk would be hd1 (if only Primary/master IDE in use) or hd2 (if both Primary/master and primary/slave in use). If you are also using the Secondary IDE channel then the SATA drive maybe hd3 or hd4. In your particular case it looks like your SATA drive is hd2

Also, you said you opted for Grub to install to the root partition but in "rescue mode" you are telling grub to setup to /boot (i.e partition 4).
Now, I'm not sure where Mandriva installs the bootloader when you say 'to root' but normally root means exactly what it says (i.e "/") which in your case is partition 6 (in Grub terminology).

So, my best guess is you should specify (hd2,6) ---- but remember what I said re IDE channels above

As far as not being able to boot, you'll need to make sure you've specified the correct partition to boot in BootIt (sorry I don't know this program so can't help with that). If it still doesn't work, you should check your grub config file "menu.lst" -- paste a copy in this thread if u need help

Probably as clear as mud but hope something I've mentioned helps....

Lastly, just so you know, there is only one MBR on a disk :)

Cheers
Ian

iklesteve 11-17-2005 06:47 PM

OK, I'm just going to swallow my pride and put myself on the line in the hope that I'm making some stupid mistake and someone can help!

My (limited) knowledge of bootloaders is that every partition on the disk (or at least every primary partition) has a boot sector that contains info on how to boot the OS and part of Grub is installed on the boot sector of /boot. (Right/Wrong??)

There is also an MBR per disk that specifies which partition to boot from. (Right/Wrong??)

Spitfire - I think you're on the right track, I'm pretty sure the errors I'm getting are due to the wrong disk being referenced. If it helps my full disk layout is this:

I have 2 IDE channels - the primary has a DVD-RW as master and a DVD-ROM as slave. The secondary has a HDD which contains (only) the /boot partition.

I also have 2 SATA controllers, each with 4 channels. My SATA disks are connected to one of these controllers but I don't know if it's the first or second controller as linux sees it.

I'm new to GRUB so unsure of exactly how to control/install it - I've tried running /sbin/grub-install from rescue mode with a number of parameters but just get messages such as "/dev/hdc does not have any corresponding BIOS device" and "/sbin/grub-install: line 356: sed: command not found". Since putting my /boot partition on a seperate IDE drive, grub seems to install even less than it would before - /boot only contains a "lost+found" directory and a keyboard mapping!

purelithium: I'd quite happily use LILO if it was offered to me - the installer only offers GRUB with/without a GUI, am I missing something?

Will continue to play about tomorrow and let you know if I crack anything. In the meantime if anyone can see something I'm doing wrong (no matter how stupid!) please let me know!

Thanks for the help so far - I know I'm so close and yet so far.....

i.s

purelithium 11-17-2005 06:59 PM

That's strange. i've never had Grub with Mandriva, always lilo....

Sorry, I don't know enough to help you any further.

spitfire5c 11-17-2005 08:08 PM

Hi

In answer to your questions:
Yes each disk has a single MBR and yes each partition has a Boot Sector.
The partiton table normally contains information (i.e its start sector etc) for upto four primary partitions or three primary plus an extended partition (I say "normally" because some 3rd party boot loaders can make "changes" to allow >4 partitions).
The partition table also flags which partition is the currently active partition. In your case, I assume the active partition will be the one with BootIt installed.

With regard to your statement/query "Grub is installed on the boot sector of /boot", I don't think it is! As I said before, I think it's on your root partition.

Did you try telling BootIt to boot from the"/" partition instead of "/boot"??

If I read correctly, you seem to have added another drive into the mix. Your call, but I think you should take back out as it'll just confuse things.

Something useful would be to copy/paste your "menu.lst" file here for people to see (/boot/grub/menu.lst).

Ian

iklesteve 11-18-2005 06:46 AM

Hi guys.

I've taken the other IDE disk out again now as suggested, it only seemed to confuse things more.

As requested, I've got the following files. They're taken from rescue mode, so the real path to them is /mnt/boot/grub/....

menu.lst:
Code:

timeout 10
color black/cyan yellow/cyan
shade 1
viewport 3 2 77 22
spashimage (hd0,4)/grub/mdv-grub_splash.xpm.gz
default 0

title linux
kernel hd(0,4)/vmlinuz root=/dev/mapper/nvidia_cdhfeddc7  resume=/dev/mapper/nvidia_cdhfeddc6
initrd hd(0,4)/initrd.img

title linux-nonfb
kernel hd(0,4)/vmlinuz root=/dev/mapper/nvidia_cdhfeddc7  resume=/dev/mapper/nvidia_cdhfeddc6 splash=silent vga=794
initrd hd(0,4)/initrd.img

title failsafe
kernel hd(0,4)/vmlinuz root=/dev/mapper/nvidia_cdhfeddc7  failsafe resume=/dev/mapper/nvidia_cdhfeddc6
initrd hd(0,4)/initrd.img

device.map:
Code:

(fd0) /dev/fd0
(hd0) /dev/mapper/nvidia_cdhfeddc

install.sh:
Code:

grub --device-map=/boot/grub/device.map --batch <<EOF
root (hd0,4)
setup (hd0,4)
quit
EOF

I hope something from this lot makes sense to someone!

I've tried BootIt pointing to "/" and "/boot" - neither partition is marked as bootable though, as GRUB always errors when installing.

Thanks again for the help.

i.s

iklesteve 11-18-2005 07:06 AM

Hmm... might be getting somewhere. After posting the above, I started playing about (well, I can't break it more!) and changed the first line of /boot/grub/install.sh to:
Code:

grub --device-map=/mnt/boot/grub/device.map --batch <<EOF
Now, when running the "Reinstall bootloader" option from the rescue menu, I get the following:
Code:

Probing devices to guess BIOS drives. This may take a long time
<snip>
grub> root (hd0,4)
 Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,4)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 15: File not found
grub> quit

There IS a file called stage1 in (/mnt)/boot/grub and I've even added symlinks from / in rescue mode to point to the files in /mnt, but it still wouldn't find them.
Any ideas now? :)

i.s

spitfire5c 11-18-2005 08:21 AM

Hi
First off, is the script you mentioned the script that runs when you select "Reinstall bootloader" ?

Second thing is that, from the output snippet you gave in the last post, root is being set as (hd0,4) which is the same as in your first post but instead of the "Error 21: Selected disk does not exist" (as per 1st post) it now finds an ext2 filesystem. This doesn't make sense unless your disk config has changed. Are you sure you removed the HD you installed on the IDE channel?

Also can you post output of
Code:

df
Ian

iklesteve 11-18-2005 10:26 AM

Will post the df output when I get home.

I'm not too sure what exactly happens when I select the reinstall bootloader option - it's one of the menu options on the splash screen for the rescue GUI. If I choose the "goto console" option there I can get to a console with my system mounted under /mnt.

My disk config is now exactly as it was in the first post - the only thing thats changed between the "selected disk does not exist" and the "Checking if /boot/grub/stage1 exists" messages is the change to the install.sh script. My guess here is that the device.map file can be used to define what (hd0) is - before it could not find that file so used the default (prob one of the IDE DVD drives) but now the map file redefines (hd0) as "/dev/mapper/nvidia_cdhfeddc". This is the drive in the RAID array, so (hd0,4) would be the 4th partition on this disk?? - ie "/boot"?

Will try repointing this to (hd0,6) as that should be the root partition - I assume that this is what it should be trying to find.

Will let you know how I get on!

tinybit 11-18-2005 08:39 PM

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/

iklesteve 11-21-2005 03:40 AM

Some progress!

I tried amending the install.sh script to:
Code:

root (hd0,6)
install(hd0,6)

and GRUB actually installed! The partition is now bootable, but when booting into it I get the message "grub: grub stage 1....." followed by some non-printable characters.

When GRUB is installed, I get the following output:
Code:

grub> root (hd0,6)
  File system type is ext2fs, partition type 0x83
grub> setup (hd0,6)
  Checking if "/boot/grub/stage1" exists... yes
  Checking if "/boot/grub/stage2" exists... yes

  Checking if "/boot/grub/e2fs_stage1_5" exists... yes
  Running "embed /boot/grub/e2fs_stage1_5 (hd0,6)"... failed (this is not fatal)
  Running "embed /boot/grub/e2fs_stage1_5 (hd0,6)"... failed (this is not fatal)
  Running "install /boot/grub/stage1 (hd0,6) /boot/grub/stage2 p /boot/grub/menu.lst... succeeded
Done.
grub> quit

So - now it seems that GRUB is at least being installed, but it is not yet possible to run it.

As requested, my df output is:
Code:

Filesystem      1K-blocks      Used    Available      Use%    Mounted on
/dev/ram3      510952          21368  489584          5%      /
/dev/sda7      2016016        63856  1849748        4%      /mnt

tinybit: thanks for the info on GRUB4DOS - will give that ago once I've reinstalled my WinXP-64 partition.

Cheers,

i.s

tinybit 11-21-2005 06:24 AM

The similar problem repeatedly occur for the old "root+setup" manner. GRUB4DOS has introduced a new method. The new utility bootlace.com can be used to install GRLDR BOOT RECORD onto the MBR. Now that the old method doesn't work, please have a try with bootlace.com. Only two steps are needed:

1. Run bootlace.com to write the MBR of /dev/hda:

bootlace.com /dev/hda

(Note: bootlace.com can also be run under DOS: bootlace.com 0x80)

2. Copy the file GRLDR to the root dir of one of the supported filesystems, which are FAT12, FAT16, FAT32, EXT2, EXT3. (NTFS is OK only when you are lucky).

README.txt within GRUB4DOS has more details(with examples that you can follow).


All times are GMT -5. The time now is 04:29 PM.