LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Fix lfs grub (https://www.linuxquestions.org/questions/linux-from-scratch-13/fix-lfs-grub-920449/)

spiky0011 12-25-2011 06:45 AM

Fix lfs grub
 
Hi
I have to fix my LFS system. I done dd copy of sdb1 which was lfs then put back on a new hard drive which was partition the same, The new drive was set as sdb1. then dd back the img to the same partition on new drive. When I try to boot all I get is the word "GRUB-" and flashing cursor.

The original HD was 40gig new drive is 80gig But sdb1 was formatted as ext4 and partition 16gig the same as original

druuna 12-25-2011 07:12 AM

Hi,

Is/was GRUB installed to the mbr? And if so: Are you sure this is still the case for your "new" HD?

You might need to run grub-install /dev/sdX (8.4.3. Setting Up the Configuration).

Hope this helps.

spiky0011 12-25-2011 07:17 AM

Hi
Grub was installed on the sdb drive only.
So your advice would be boot a live cd mount sdb1 then
Code:

grub-install /dev/sdb1
I presume that is as root

druuna 12-25-2011 07:29 AM

Hi,
Quote:

Originally Posted by spiky0011 (Post 4557995)
Hi
Grub was installed on the sdb drive only.
So your advice would be boot a live cd mount sdb1 then
Code:

grub-install /dev/sdb1

No! This will place grub on sdb1, not the mbr.

I don't know what you have previously done, this being sdb. Did you originally put grub on the mbr of sdb or sda? Put it there where you have put it before. If this is sdb then:
Code:

grub-install /dev/sdb
Quote:

I presume that is as root
Yep.

BTW: Is grub used that came with LFS or are you using grub that's part of another distro (the one on sda?) If another distro's grub is used: DO NOT use the above command, it will overwrite the one used by the other distro.

Hope this helps.

spiky0011 12-25-2011 07:33 AM

I used grub from lfs and yes it was put on sdb So as to only boot that drive, It is completely seperate from the other drives

druuna 12-25-2011 07:37 AM

Hi,
Quote:

Originally Posted by spiky0011 (Post 4558000)
I used grub from lfs and yes it was put on sdb So as to only boot that drive, It is completely seperate from the other drives

In that case you can safely use the grub-install /dev/sdb command.

Hope this helps.

spiky0011 12-25-2011 08:10 AM

ok I have loaded Ubuntu live cd mounted lfs sdb1. I ran the command sudo grub-install /dev/sdb I get an error.
Code:

grub-probe: error: cannot find a device for /boot/grub.

No path or device is specified.
Try ``grub-probe --help'' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.
ubuntu@ubuntu:/media/lfs/boot$ cd grub
ubuntu@ubuntu:/media/lfs/boot/grub$ sudo grub-install /dev/sdb
grub-probe: error: cannot find a device for /boot/grub.

No path or device is specified.
Try ``grub-probe --help'' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

Any thoughts

spiky0011 12-25-2011 08:50 AM

Hi

Ok have fixed problem here's how

load live cd mount lfs system then run

Code:

sudo grub-install --recheck --root-directory=/media/lfs /dev/sdb

spiky0011 12-25-2011 08:52 AM

fix grub when transfering to new drive
 
Hi

Ok have fixed problem here's how

load live cd mount lfs system then run

Code:

sudo grub-install --recheck --root-directory=/media/lfs /dev/sdb

druuna 12-25-2011 08:55 AM

Hi,

Glad to see you got this solved.

BTW: Did you chroot into LFS or use Ubuntu's grub-install?

And can you put up the [SOLVED] tag.

spiky0011 12-25-2011 09:29 AM

I ran sudo command from ubuntu live cd not chroot.
So the other option would be to chroot into lfs here.
I take it you have not tried copying to a new drive before?

druuna 12-25-2011 09:52 AM

Hi,
Quote:

Originally Posted by spiky0011 (Post 4558046)
I ran sudo command from ubuntu live cd not chroot.
So the other option would be to chroot into lfs here.

Yes, but you first need to run these (6.2.2. and 6.2.3.):
Code:

mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys

Quote:

Originally Posted by spiky0011 (Post 4558046)
I take it you have not tried copying to a new drive before?

Yes I have done this before, but unlike you I dd-ed the entire drive (sda) and not a partition (sdaX). All ran fine afterwards (removed the old disk and started using the clone).

spiky0011 12-25-2011 09:58 AM

Well I hope this helps other ppl in the future (good excercise)


All times are GMT -5. The time now is 05:09 AM.