[SOLVED] LFS Version 9.1, 8.4.3. Setting Up the GRUB Configuration
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
LFS Version 9.1, 8.4.3. Setting Up the GRUB Configuration
Hello Users,
As i already posted a similar thread few days back, i was told to mention in the 40_custom file the entry of my new lfs, as i have already dual booted my system, with two ubuntu's,
I've read that grub has some files in grub.d directory,
and if we somehow run 30_os_prober, grub will auto find the OS in all disks, and put that in grub.cfg
and by running grub2-mkconfig, it calls 30_os_prober.
What is 30_os_prober?
And how is it actually called?
but as i navigated in the grub.cfg file on my host.
I saw there's already an entry there of my lfs.
with menuentry as unknown linux.
all locations to kernel seem accurate.
This is grub entry
Code:
menuentry 'unknown Linux distribution (on /dev/sdc2)' --class linux --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux->
insmod part_gpt
insmod ext2
set root='hd2,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd2,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5c5-870e7>
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sdc2
}
submenu 'Advanced options for unknown Linux distribution (on /dev/sdc2)' $menuentry_id_option 'osprober-gnulinux-advanced-42e174ea-46f1-4300-b5c5-870>
menuentry 'unknown Linux distribution (on /dev/sdc2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/>
insmod part_gpt
insmod ext2
set root='hd2,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd2,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5>
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sdc2
}
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
also there was no intramfs mentioned anywhere there.
I think it should be there, as intramfs is loaded first right?
but when i restarted my OS.
Sorry if the attachments aren't visible
My OS doesn't boots
Quote:
end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Did you make an initramfs in lfs? If not you don’t have all the drivers needed to boot compiled into your kernel and not as modules. If yes you haven’t included everthing needed to boot in the initramfs
Last edited by colorpurple21859; 07-09-2020 at 03:38 PM.
Hello Sir,
There was no mention of initramfs in the book.
Also there isnt any mention of that in the grub.cfg
Quote:
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 5.5.3-lfs-9.1" {
linux
/boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda2 ro
}
EOF
These above lines are from the book, but i didnt need to do that, because entries were automatically made in grub.cfg.
I dont know how!
Also when i restarted the system, i forgot to unmount the virtual file system. would that have created problem somehow?
Ohh.
Sir what drivers?
and is there any way to resolve this?
I would really appreciate that.
I am actually a newbie in linux.
Most of the things go over my head
You need to look at the links at the beginning of 8.3.1. The drivers that allow access to your hard drive and the file system need to be built into your kernel and not as a module. lspci -v will clue you in on what drivers your need. as well as running lsmod on the host system.
If the device is dropping into a Busybox (initramfs) shell (also sometimes known as a Grub shell) then it may be possible to force the system to boot via instructions found on the Kali Linux forums...
Sir i compiled kernel again.
Starting with the command
Quote:
make mrproper
And then
Quote:
make defconfig
and then
Quote:
make menuconfig
As book stated
Quote:
Be sure to enable/disable/set the following features or the system might not work correctly or boot at all:
So i enabled some, but some werent there
Those i couldnt find were
Quote:
[*] open by fhandle syscalls [CONFIG_FHANDLE]
and
Quote:
[ ] Fallback user-helper invocation for firmware loading [CONFIG_FW_LOADER_USER_HELPER]
then make
and make install module
when running grub-install
Quote:
(lfs chroot) root:/# grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: cannot find a device for /boot/grub (is /dev mounted?).
but as discussed earlier, i want to add entry in the grub of my host machine.
There is already an entry in grub.cfg
Quote:
menuentry 'unknown Linux distribution (on /dev/sdc2)' --class linux --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-42e174ea-46f1-4300-b5c5-870e7f9152f4' {
insmod part_gpt
insmod ext2
set root='hd2,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd2,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5c5-870e7f9152f4
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sdc2
}
submenu 'Advanced options for unknown Linux distribution (on /dev/sdc2)' $menuentry_id_option 'osprober-gnulinux-advanced-42e174ea-46f1-4300-b5c5-870e7f9152f4' {
menuentry 'unknown Linux distribution (on /dev/sdc2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.5.3-lfs-9.1--42e174ea-46f1-4300-b5c5-870e7f9152f4' {
insmod part_gpt
insmod ext2
set root='hd2,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd2,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5c5-870e7f9152f4
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sdc2
}
}
On reboot, lfs is not loading again
same error
Quote:
end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
but lsblk is showing
Quote:
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 196.3G 0 part
├─sda2 8:2 0 170.5G 0 part
├─sda3 8:3 0 9.3G 0 part /boot/efi
├─sda4 8:4 0 28G 0 part /
└─sda6 8:6 0 61.2G 0 part
sdb 8:16 1 28.7G 0 disk
├─sdb1 8:17 1 100M 0 part /media/shahrukh/3e141aea-2491-44be-96a0-14c0d05
├─sdb2 8:18 1 12G 0 part /media/shahrukh/42e174ea-46f1-4300-b5c5-870e7f9
└─sdb3 8:19 1 4G 0 part
sr0 11:0 1 1024M 0 rom
lfs is on sdb, not on sdc.
so ichanged it to sdb in grub.cfg.
Also i generated device.map file in host machine
It shows
so i changed hd2 to hd1 in the file grub.cfg, but what about gpt2? i kept it as it is. then i rebooted the system.
But still nothing.
Please help
Thank You
menuentry 'unknown Linux distribution (on /dev/sdb2)' --class linux --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-42e174ea-46f1-4300-b5c5-870e7f9152f4' {
insmod part_gpt
insmod ext2
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5c5-870e7f9152f4
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4
}
submenu 'Advanced options for unknown Linux distribution (on /dev/sdb2)' $menuentry_id_option 'osprober-gnulinux-advanced-42e174ea-46f1-4300-b5c5-870e7f9152f4' {
menuentry 'unknown Linux distribution (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.5.3-lfs-9.1--42e174ea-46f1-4300-b5c5-870e7f9152f4' {
insmod part_gpt
insmod ext2
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci2,gpt2 42e174ea-46f1-4300-b5c5-870e7f9152f4
else
search --no-floppy --fs-uuid --set=root 42e174ea-46f1-4300-b5c5-870e7f9152f4
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4
}
}
and deleted everything /etc/fstab of lfs
now it has
Quote:
(lfs chroot) root:/# cat /etc/fstab
# Begin /etc/fstab
The screenshot says uuid is wrong/doesn’t exist
You was only suppose to change the /dev/sdc2 /dev/sda3 to UUID= <uuid number> not delete the other lines
The swap line in you file is wrong suppose to be the uuid of swap partition not copy/paste what I wrote
Last edited by colorpurple21859; 07-10-2020 at 08:24 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.