LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub Checking if "/boot/grub/stage1" exists... no (but it does) ??? (https://www.linuxquestions.org/questions/linux-general-1/grub-checking-if-boot-grub-stage1-exists-no-but-it-does-659750/)

taylorkh 08-01-2008 08:50 AM

Grub Checking if "/boot/grub/stage1" exists... no (but it does) ???
 
Here is the situation - I have a Dell Dimension 4600 (Pentium 4) in which I have installed a "mobile rack" and have several drives which I can put into the rack (one at a time) depending on what OS I wish to run.

I created an install of Ubuntu 7.10 on an 80 GB SATA drive then backed it up with g4l. I built partitions on a 160 GB SATA drive to match the size of those on the 80 GB drive, copied the MBR using dd and restored the / and /home partitions to the 160 GB drive using g4l. Note: the 3rd partition is swap and the 4th partition /data is empty at this point - it takes up what ever space is left on the drives. Worked great.

Now I am trying to clone back from the 160 GB drive to an 80 GB drive. I have followed the same process. However, when I try to boot the machine goes to a GRUB prompt and stops.

After trying various things I decided to install Grub manually. I built the partitions with fdisk restored the data to sda1 and sda2 with g4l. This time I did NOT restore the mbr. Then I booted from a Ubuntu 7.10 live CD. Here is the layout of the 80 GB drive:
Quote:

ubuntu@ubuntu:/$ sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1f341f33

Device Boot Start End Blocks Id System
/dev/sda1 * 1 984 7903948+ 83 Linux
/dev/sda2 985 3474 20000925 83 Linux
/dev/sda3 3475 3723 2000092+ 82 Linux swap / Solaris
/dev/sda4 3724 9729 48243195 83 Linux

I invoked grub and proceeded as follows:

Quote:

ubuntu@ubuntu:/$ sudo grub
grub> root (hd0,1)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found
I ran fsck on the partitions which I had restored with g4l and they showed clean. I then mounted partitions on the drive and poked about. I was able to navigate around the / and /home partitions (sda1 and sda2) with no problem. The stage1 file appeared to be where it was supposed to be:

Quote:

ubuntu@ubuntu:/$ sudo mkdir /test
ubuntu@ubuntu:/$ sudo mount /dev/sda1 /test
ubuntu@ubuntu:/$ ls -l /test/boot/grub
total 220
-rw-r--r-- 1 root root 197 2008-02-14 19:38 default
-rw-r--r-- 1 root root 30 2008-02-14 19:38 device.map
-rw-r--r-- 1 root root 8660 2008-02-14 19:38 e2fs_stage1_5
-rw-r--r-- 1 root root 8452 2008-02-14 19:38 fat_stage1_5
-rw-r--r-- 1 root root 15 2008-02-14 19:38 installed-version
-rw-r--r-- 1 root root 9152 2008-02-14 19:38 jfs_stage1_5
-rw-r--r-- 1 root root 4693 2008-07-07 14:28 menu.lst
-rw-r--r-- 1 root root 4201 2008-07-07 14:28 menu.lst~
-rw-r--r-- 1 root root 4265 2008-04-28 23:09 menu.lst.orig
-rw-r--r-- 1 root root 7860 2008-02-14 19:38 minix_stage1_5
-rw-r--r-- 1 root root 10132 2008-02-14 19:38 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 2008-02-14 19:38 stage1
-rw-r--r-- 1 root root 110292 2008-02-14 19:38 stage2
-rw-r--r-- 1 root root 9980 2008-02-14 19:38 xfs_stage1_5

I am no doubt missing something simple here. My next step is to do a clean install of Ubuntu on the 80 GB drive just to make sure it is not a mechanical malfunction. I sort of doubt that as I have recently run XP and Fedora 9 on this drive.

Thank for any advice.

Ken

p.s. Do I need to mount sda1 before running the grub "setup" command? Guess I will try that as well.

mostlyharmless 08-01-2008 09:32 AM

hd0 vs hd?
 
Sometimes BIOS and therefore Grub have a different idea about the drive order than you do. You mentioned a multirack system, I suspect that placing the drives in different locations may be underlying the problem, particularly if more than one drive is in at the time.

Try typing, at the grub prompt:

root ([TAB]

to see what drives are available. You can then use

find (hd0,0)/grub/stage1

or variations thereof to find out where grub thinks the files are.

Larry Webb 08-01-2008 09:35 AM

Quote:

Originally Posted by taylorkh (Post 3233256)

p.s. Do I need to mount sda1 before running the grub "setup" command? Guess I will try that as well.

No if you have the grub shell your commands were good and if you are doing this from your ubuntu install disk. My only question is are you sure your root partition is number 1 and if it is your commands should be

root (hd0,0)

setup (hd0)

taylorkh 08-01-2008 09:59 AM

Thanks for the prompt reply Larry. Tried mounting and that did not help - as you indicated. I believe you have hit the nail on the head. If partition numbering is zero based my root would be 0. I was following instructions in an article where the writer had about half a dozen different OS installed on the same disk. In reading it again I think he was installing on his second partition for some reason. I simply followed his example.

I just finished installing a fresh Ubuntu 7.10 image on the existing partitions of the 80 GB drive. Booted fine. I then used g4l to replace the / and /home partitions and again it boots. I will go back and try "boot (hd0,0)" and make sure that works. Then I have to remember why I was making this copy of my "production" install(?) I think it was to upgrade to 8.04 and see what gets broken. Thanks again!

Regards,

Ken

taylorkh 08-01-2008 12:48 PM

It helps to use the correct partition. boot (hd0,0) did the trick. Thanks again.

Larry Webb 08-01-2008 05:17 PM

You are welcome.


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