LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 07-09-2020, 03:10 PM   #1
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Rep: Reputation: Disabled
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.
Click image for larger version

Name:	aG38vhm8.jpg large.jpg
Views:	69
Size:	250.4 KB
ID:	33615

Click image for larger version

Name:	HtxfEBck.jpg large.jpg
Views:	61
Size:	259.4 KB
ID:	33616

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)
 
Old 07-09-2020, 03:35 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
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.
 
Old 07-09-2020, 03:55 PM   #3
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
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?

I didnt run these commands.
Quote:
umount -v $LFS/sys
umount -v $LFS/dev/pts
umount -v $LFS/dev
umount -v $LFS/run
umount -v $LFS/proc
umount -v $LFS
umount -v $LFS/usr
umount -v $LFS/home
umount -v $LFS
shutdown -r now
 
Old 07-09-2020, 03:58 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Then your missing drivers in your kernel
 
Old 07-09-2020, 04:02 PM   #5
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
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

Last edited by Shah404; 07-09-2020 at 04:03 PM.
 
Old 07-09-2020, 07:54 PM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
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.
 
Old 07-10-2020, 01:40 AM   #7
S0AndS0
LQ Newbie
 
Registered: Jul 2020
Posts: 1

Rep: Reputation: Disabled
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...


Code:
https://forums.kali.org/showthread.php?30915-How-to-boot-Kali-from-initramfs-or-Grub-prompt

Paraphrased and re-formatted bellow...


Find `hd` identifier (eg. `hd0` or `hd1`), then load the config file from the correct partition...

Code:
ls

Load the correct Grub configuration file...


Code:
configfile (hdy,x)/boot/grub/grub.cfg

> Note, in these examples the `y` of `hdy` is the HardDrive identifier, and `x` of the `hdy,x` bit denotes the partition number.


Force system to boot...


Code:
linux (hdy,x)/vmlinuz root=/dev/sdcx
initrd (hdy,x)/initrd.img
boot

___


Once system boots it'd be a good idea to rebuild the `initramfs` via...


Code:
sudo update-initramfs -uv

... and update Grub...


Code:
sudo update-grub

___


One additional tip if ya get dropped into the initramfs shell intermittently is assigning `rootwait` within the Grub config...


/etc/default/grub


Code:
GRUB_CMDLINE_LINUX_DEFAULT="rootwait"

... and updating Grup again...


Code:
sudo update-grub

... which can help on devices that have an odd bit of mounting/un-mounting behavior during boot.
 
Old 07-10-2020, 05:07 AM   #8
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
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
Quote:
cat /boot/grub/device.map
(hd0) /dev/disk/by-id/ata-HGST_HTS545050A7E680_TE85144NJJMBWW
(hd1) /dev/disk/by-id/usb-SanDisk_Ultra_4C530000060203118410-0:0
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

Last edited by Shah404; 07-10-2020 at 06:34 AM.
 
Old 07-10-2020, 06:55 AM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
post the ouput of
Code:
sudo parted -l
and the /etc/fstab of the lfs system.
 
Old 07-10-2020, 07:01 AM   #10
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
sudo parted -l of host system
Quote:
shahrukh@shahrukh-HP-15-Notebook-PC:~$ sudo parted -l
[sudo] password for shahrukh:
Model: ATA HGST HTS545050A7 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
2 538MB 184GB 183GB ext4
1 184GB 394GB 211GB ext4
6 394GB 460GB 65.7GB ext4
4 460GB 490GB 30.1GB ext4
3 490GB 500GB 9941MB fat32 boot, esp


Model: SanDisk Ultra (scsi)
Disk /dev/sdb: 30.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 106MB 105MB ext2
2 106MB 13.0GB 12.9GB ext4
3 13.0GB 17.3GB 4295MB linux-swap(v1)
and /etc/fstab of LFS
Quote:
(lfs chroot) root:/# cat /etc/fstab
# Begin /etc/fstab

# file system mount-point type options dump fsck
# order

/dev/sdc2 / ext4 defaults 1 1
/dev/sdc3 swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab
 
Old 07-10-2020, 07:23 AM   #11
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Change your grub linux line to this
Code:
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4
Change your lfs fstab to this
Code:
UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4 / ext4 defaults 1 1
UUID=<swap parition uuid> swap swap pri=1 0 0
 
Old 07-10-2020, 07:52 AM   #12
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
Sir i changed the grub.cfg
Quote:
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

UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4 / ext4 defaults 1 1
UUID=<swap parition uuid> swap swap pri=1 0 0
and again i rebooted the system. but still nothing.
Click image for larger version

Name:	WhatsApp Image 2020-07-10 at 6.20.34 PM.jpeg
Views:	38
Size:	225.6 KB
ID:	33620
 
Old 07-10-2020, 08:21 AM   #13
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
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.
 
Old 07-10-2020, 08:45 AM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
With lfs on a usb did you add usb drivers to the kernel?
 
Old 07-10-2020, 08:55 AM   #15
Shah404
Member
 
Registered: Jun 2020
Posts: 43

Original Poster
Rep: Reputation: Disabled
No Sir, i didnt add any drivers to it.
Also i edited the fstab now
Quote:
(lfs chroot) root:/# cat etc/fstab
# Begin /etc/fstab

UUID=42e174ea-46f1-4300-b5c5-870e7f9152f4 / ext4 defaults 1 1
UUID=/dev/sdb3 swap swap pri=1 0 0

proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab
Apologies for being dumb!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LFS Version 9.1, 8.4.3. Setting Up the GRUB Configuration Shah404 Linux From Scratch 6 07-06-2020 01:21 AM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
[SOLVED] Which version of book to use for BLFS??? (LFS-6.7 used for building LFS) rkmv Linux From Scratch 3 02-21-2012 05:32 PM
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration