LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Grub final hurdle (https://www.linuxquestions.org/questions/linux-from-scratch-13/grub-final-hurdle-863910/)

spiky0011 02-20-2011 02:56 PM

Grub final hurdle
 
I have created grub iso brunt it to cd, do I just insert the disc What do cd,s show up as sda,hda etc. or do I use [code]grub-install --grub-setup=/bin/true /media/cdrom

corp769 02-20-2011 03:14 PM

What exactly are you trying to do?

spiky0011 02-20-2011 03:28 PM

I am at Section 8.4 in the 6.7 book setting up grub. I have 10gig drive with only lfs build on it I now want to set grub up so as to boot system. Having googled some more I think I need to miss some parts of 8.4 Do I just need to install grub now, if so where? fdisk -l shows hda1 I have installed lfs on hda2 is swap I did try
Code:

grub-install --grub-setup=/bin/true /dev/hda1
but get an error "No path or device specified" Auto detection of a filesystem module failed"

druuna 02-20-2011 03:33 PM

Hi,
Quote:

Originally Posted by spiky0011 (Post 4265044)
I have created grub iso brunt it to cd, do I just insert the disc What do cd,s show up as sda,hda etc. or do I use [code]grub-install --grub-setup=/bin/true /media/cdrom

The steps in chapter 8 might not be needed if you already have another distro on the same disk. You can add LFS to its bootloader (be it lilo or grub).

If LFS is the only "distro" on your system and you do need grub, don't spend too much time on chapter 8.4.1 (do read it, just don't do the commands). You can always use the liveCD to get access and repair stuff if needed

Start with 8.4.2. Setting Up the Configuration, read it first a few times and then follow the steps given.

Quote:

grub-install --grub-setup=/bin/true /dev/hda1
The book doesn't mention 1, 2 or 3 yet for this command, use hda (or sda depending on your system). At step 8.4.3 you need to know where lfs is situated [hd0,1 if lfs is on hda1]).

Hope this helps.

corp769 02-20-2011 03:37 PM

Grub itself is installed onto the bootloader of your hard drive. As far as what you are trying to run, it would need to be /dev/hda and not hda1

EDIT: druuna beat me to it.

spiky0011 02-20-2011 04:21 PM

ok ran
Code:

grub-install --grub-setup=/bin/true /dev/hda
It installed Grub in /boot but when i ran
Code:

grub-mkconfig -o /boot/grub/grub.cfg
I get "/usr/sbin/grub-probe error" cannot find a device for / (is /dev mounted?)

corp769 02-20-2011 04:33 PM

Can you post the output of "mount" (without the quote)?

spiky0011 02-20-2011 04:41 PM

proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)

corp769 02-20-2011 04:45 PM

Try mounting hda to /mnt and run update-grub.

spiky0011 02-20-2011 04:52 PM

mkdir /mnt/hda1
cd /mnt
mount dev/hda1 returned special device /dev/hda1 dose not exist.

Just a thought I still have the original build of lfs in tty2 which shows fdisk -l dev/hda1 *
Is this causing the problem???

druuna 02-21-2011 02:46 AM

Hi,

It looks like you stopped and restarted somewhere along the line and did not remount some of the mount-points. If you reboot for whatever reason you need to remount some mount-points en re-enter the chrooted environment.

These steps (when working on chapter 6 and beyond):
Code:

#6.2.2
mount -v --bind /dev $LFS/dev

# 6.2.3
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

# 6.4
chroot "$LFS" /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h

The above is mentioned in chapter 6.4 (the note at the bottom).

Now you are set up to continue.

Hope this helps.

spiky0011 02-22-2011 12:05 PM

Done as you said druuna and got grub loaded but when starting pc kernel panic,
Code:

Root-NFS No VFS server available giving up
vfs unable to mount root fs via NFS trying floppy
vfs cannot open root device "hda1" or unknown-block (2.0)
please append a correct "root=" boot option here are available partitions

9820440 sda driver sd
8755393 sda1
1060290 sda2
1048575 sr0 driver sr

kernel panic - not syncing VFS Unable to mount root fs on unknown-block (2.0)

fdisk -l shows hda1 * boot, hda2 swap

grub.cfg shows almost the same as book version,

insmod ext3
set root=(hda,1)
search --no-floppy --fs-uuid --set 915852a7-859e-45a6-9ff0-d3ebfdb5cea2
linux /boot/vmlinux-2.6.35.4-lfs-6.7 root=/dev/hda1 ro single

The bold bits are the difference to book.
Code:

grub-mkdevicemap --device-map=device.map
cat device.map

returns (hd0) /dev/hda

then
Code:

grub-install --grub-setup=/bin/true /dev/hda

druuna 02-22-2011 12:25 PM

Quote:

Originally Posted by spiky0011 (Post 4267553)
Done as you said druuna and got grub loaded but when starting pc kernel panic,
Code:

Root-NFS No VFS server available giving up
vfs unable to mount root fs via NFS trying floppy
vfs cannot open root device "hda1" or unknown-block (2.0)
please append a correct "root=" boot option here are available partitions

9820440 sda driver sd
8755393 sda1
1060290 sda2
1048575 sr0 driver sr

kernel panic - not syncing VFS Unable to mount root fs on unknown-block (2.0)


First thing I noticed: sda vs hda.

Quote:

insmod ext3
Did you change ext2 to ext3? You shouldn't. Change it back to: insmod ext2
To be honest I don't think this line is needed at all, but I haven't tried playing with it yet, so leave it as mentioned in the book.

Quote:

set root=(hda,1)
That should be hd0,1.

Quote:

The bold bits are the difference to book.
Yep, and those are wrong :)

You might still get some errors: The output posted talks about sda and not hda (which you used). If the above 2 changes don't solve all the problems change this line:
linux /boot/vmlinux-2.6.35.4-lfs-6.7 root=/dev/hda1 ro single into:
Code:

linux /boot/vmlinux-2.6.35.4-lfs-6.7 root=/dev/sda1 ro single
Hope this helps.

spiky0011 02-24-2011 03:29 PM

I tried the setting as described plus some varibles but got a failure
Code:

Populating /dev with device nodes
[  4.7497771] modprobe used greatest stack depth: 6044 bytes left
[  5.1244071] mkdir used greatest stack depth: 6024 bytes left      [  ok]
Activating all swap files/partitions
swapon: /dev/hda2: stat failed: No such file or directory          [  Fail ]
Mounting root file system in read-only mode                        [  ok ]
Checking file systems
fsck.ext3 No such file or directory while trying to open /dev/hda1
/dev/hda1:
The sperblock could not be read or dose not describe a correct ext2
file system. If the device is valid and it really contains an ext2
file system (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternative superblock:
    e2fsck -b 8193 <device>

FAILURE                                                            [fail ]

At the moment grub.cfg has the settings as per post above

crts 02-24-2011 06:01 PM

Quote:

Originally Posted by spiky0011 (Post 4270134)
I tried the setting as described plus some varibles but got a failure
Code:

Populating /dev with device nodes
[  4.7497771] modprobe used greatest stack depth: 6044 bytes left
[  5.1244071] mkdir used greatest stack depth: 6024 bytes left      [  ok]
Activating all swap files/partitions
swapon: /dev/hda2: stat failed: No such file or directory          [  Fail ]
Mounting root file system in read-only mode                        [  ok ]
Checking file systems
fsck.ext3 No such file or directory while trying to open /dev/hda1
/dev/hda1:
The sperblock could not be read or dose not describe a correct ext2
file system. If the device is valid and it really contains an ext2
file system (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternative superblock:
    e2fsck -b 8193 <device>

FAILURE                                                            [fail ]

At the moment grub.cfg has the settings as per post above

Hi,

as druuna already stated in his earlier post you will have to change /dev/hda1 to /dev/sda1 in /boot/grub/grub.cfg. Do NOT run grub again. The problem is that the kernel on the liveCD exposes your hdd as /dev/hdXX. The newer kernel of the LFS system, however, exposes them as /dev/sdXX.
Also check your /etc/fstab for correct device-names. Your swap partition is also falsely named as /dev/hda2. It should be /dev/sda2.


All times are GMT -5. The time now is 08:49 AM.