LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   GRUB won't install (http://www.linuxquestions.org/questions/red-hat-31/grub-wont-install-4175450241/)

Thakowbbery 02-15-2013 05:38 AM

GRUB won't install
 
I guess this must be just another thread within thousands of others with the same problem:

1) I've just "cloned" a RHEL5 system using rsync;
2) I've modified /etc/fstab and /boot/grub/menu.lst to match the new system;
3) /dev/sda1 is mounted as / and /dev/sda3 is mounted as /boot (n-checked with mount, fdisk and any other possible way to confirm this);
4) Booted the new system with RHEL5 DVD in rescue mode;
5) The rescue mode recognizes and mounts the entire system (/, /boot, /var and so on) in /mnt/sysimage;
6) chroot /mnt/sysimage;
7) "grub-install --root-directory=/ /dev/sda" or "grub-install /dev/sda" returns the same error: The file /boot/grub/stage1 not read correctly;
8) grub (shell) > find /boot/grub/stage1 or find /grub/stage1 returns the same error: File not found;
9) grub (shell) > root (hd0,0) identifies the partition correctly, but setup (hd0) or setup (hd0,0) returns the same error: it cannot find "/boot/grub/stage1" or "/grub/stage1";
10) Already tried copying the entire /boot from a working system with the same kernel version: didn't solve it;
11) The same procedure was done in two other systems with the same kernel version and both worked with grub-install right from the start.

12) The only difference between this system and the other is that:
12.1) The other had /dev/sda1 as /boot and /dev/sda3 as /;
12.2) This one has /dev/sda1 as / and /dev/sda3 as /boot.

As you people can see I've already tried a lot of different things. The last one is actually invert the partition order, but that I think it's very weird (and I'm gonna need some time to move data between disks).

Anyone has any idea about what is happening, please?

John VV 02-16-2013 03:25 PM

as i recall the older RHEL5 ( 5.9 is current)
required the /boot partition to be formatted to "ext2" for the now legacy grub install

also the older RHEL5 needed the "boot" flag set IF /boot was NOT the very first partition on the disk

use a GParted live cd to set the boot flag to sda3

rng 02-17-2013 04:48 AM

What is(are) the exact rsync command(s) that you used to "clone" your system? That may have a bearing on why grub is not working.

Thakowbbery 02-17-2013 09:42 AM

Hey people.

I guess John was the closest. I managed to switch the / and /boot partitions and then Grub installed normally.
Perhaps one thing I should've tried was setting the boot flag (noted for next time).

RNG, about the rsync command, I went through the man page and came up with the following:


rsync varlHEAXog --exclude-from=<file> <source> <destination>

The exclude file has /dev, /proc and /sys in it.

So far this command worked wonders for 9 different systems.


All times are GMT -5. The time now is 01:58 PM.