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 11-08-2019, 06:47 PM   #1
xypher
LQ Newbie
 
Registered: Nov 2019
Posts: 6

Rep: Reputation: Disabled
Fail to boot LFS


Hello everyone,

I have been following the LFS guide to create my own LFS distro and I can't seem to boot in. I don't know where the problem resides, as I have followed all of the steps and I haven't seen (i think) any errors that the book didnt state as normal.

While compiling the linux kernel file, i do have seen this:

Code:
  GEN     arch/x86/lib/inat-tables.c
awk: ./arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
awk: ./arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=./arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is not a known regexp operator
Can this be a reason my system isn't able to boot up? I have tried to reinstall "gawk" as I thought it might be the problem, but I still have the same problem.

Other thing maybe I might be messing up as i have almost no experience in linux is the chapter 8.4.4 in the LFS guide. My host system fdisk -l returns:
Code:
Disk /dev/ram0: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/loop0: 1.99 GiB, 2111905792 bytes, 4124816 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3c5dc0aa

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1          2048  2000895  1998848  976M 82 Linux swap / Solaris
/dev/sda2       2000896 16777215 14776320    7G 83 Linux
And assuming this, i'm trying to use the next grub.cfg:

Code:
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.2.8-lfs-9.0" {
        linux   /boot/vmlinuz-5.2.8-lfs-9.0 root=/dev/sda2 ro
}
EOF
Also, at the last step when i have to unmount the virtual file systems and the LFS file system itself, the command umount -v $LFS returns me "target is busy". Doing umount -l $LFS does unmount it but after that if i do echo $LFS it shouldn't return me /mnt/lfs, should it? Maybe that's something else I'm doing wrong..

I would appreciate some help, thank you.
 
Old 11-12-2019, 03:16 PM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
When compiling software, you can usually ignore warnings. They're not fatal.

The umount problem can arise when you are in a directory located on the mounted partition but it can also be due to having other partitions mounted as subsidiaries of the partition you are trying to unmount. This is very likely to happen in LFS because, after mounting the new partition on $LFS, you mount /dev, /sys and /proc onto it. You also have /dev/pts mounted on /dev. To unpick all this, you must first exit the chroot, then unmount all the subsidiary systems in order before finally unmounting $LFS. Of course if you are just going to reboot, you don't need to bother about unmounting anything as the shutdown process will do that for you.

"echo $LFS" will always return /mnt/lfs whether the partition is mounted there or not because LFS just a variable, a symbolic name for your mount point.

Now for your real problem: you say your new system won't boot. You need to tell us in detail what happens when you try to boot it. Does the kernel panic? If so where?

I'm quite impressed that you got this far with LFS as you are clearly not very experienced with Linux.

Last edited by hazel; 11-12-2019 at 03:17 PM.
 
Old 11-13-2019, 04:16 AM   #3
xypher
LQ Newbie
 
Registered: Nov 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
When compiling software, you can usually ignore warnings. They're not fatal.

The umount problem can arise when you are in a directory located on the mounted partition but it can also be due to having other partitions mounted as subsidiaries of the partition you are trying to unmount. This is very likely to happen in LFS because, after mounting the new partition on $LFS, you mount /dev, /sys and /proc onto it. You also have /dev/pts mounted on /dev. To unpick all this, you must first exit the chroot, then unmount all the subsidiary systems in order before finally unmounting $LFS. Of course if you are just going to reboot, you don't need to bother about unmounting anything as the shutdown process will do that for you.

"echo $LFS" will always return /mnt/lfs whether the partition is mounted there or not because LFS just a variable, a symbolic name for your mount point.

Now for your real problem: you say your new system won't boot. You need to tell us in detail what happens when you try to boot it. Does the kernel panic? If so where?

I'm quite impressed that you got this far with LFS as you are clearly not very experienced with Linux.

Yes, when i boot into the LFS system itself, kernel starts loading then i get the next message:
Code:
kernel panic unable to mount root fs on unknown-block(0 0)
I've been stuck there for days, did some research and found that it has do something with initramfs, randomly tried this but doesn't seem to work..

Thanks for your help.
 
Old 11-13-2019, 05:00 AM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
You don't need an initramfs in LFS if you configure your kernel properly. Stock kernels that come with distros need an initramfs because the developers have no way of knowing what kind of filesystem users might have on their root device. Most people use ext4 but there are others. So the kernel boots to a RAM disk containing all the possible filesystem drivers and switches to the proper root partition once the necessary driver has been found and loaded.

Now in LFS, you build your own kernel and that makes life much simpler. You need only build drivers for hardware that you know you have and filesystems that you know you want to use. Most of these can be built as modules and loaded as necessary, but the ext4 driver must be built right into the kernel, because without it the kernel can't read the root partition and therefore can't load any driver modules.

You must go back into chroot and rebuild your kernel. This time, at the configure stage, make sure you have built in the SATA disk driver and the ext4 filesystem. Then try again.
 
Old 11-13-2019, 05:08 AM   #5
xypher
LQ Newbie
 
Registered: Nov 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks, i get it now. My question is, when i had to configure the kernel, i did not configure it manually. Instead, i used "make defconfig", so doesn't it mean it has to include those drivers by default?

Thanks for your patience, just trying to learn
 
Old 11-13-2019, 05:22 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Make defconfig is just a start. It gives you a sensible initial configuration, but there's no guarantee that it will work for your system. You need to follow it up with make menuconfig. This will give you a menu of options so you can tune the configuration to your machine. You can spend as much time as you like exploring the menu, but you particularly need to look in the block devices section (make sure the PATA/libata driver is built in) and the filesystem section (be sure to build in ext4, and make vfat available as a module). If you're dual-booting with Windows, you'll need the ntfs module too. In the drivers section, you can switch off drivers you know you aren't going to use. This will greatly reduce compilation time.

A couple of other tips:
1) Don't switch on or off anything you don't understand.
2) Make full use of kernel help. It's an amazing system. It not only tells you what the options do but often tells you whether you need them or not.

When your configuration is complete, exit and build the kernel just as you did before.

If it's any comfort to you, finding out that a new kernel won't boot the first time is a very common irritant.
 
Old 11-13-2019, 05:27 AM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
https://www.linuxtopia.org/online_bo...n/ch11s03.html
https://opensource.com/article/18/10/kbuild-and-kconfig

Last edited by colorpurple21859; 11-13-2019 at 05:34 AM.
 
1 members found this post helpful.
Old 11-13-2019, 05:32 AM   #8
xypher
LQ Newbie
 
Registered: Nov 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
Awesome, thanks for your help. I'm gonna work on it and hopefully come back with good news.
 
  


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] i cant boot into new LFS installation (lfs 7.5) sholizar Linux From Scratch 33 12-20-2021 06:55 AM
LFS error: boot lfs, Kernel panic -not syncing:VFS unable to mount root fs on unknown-block(0,0) XinyuLi Linux From Scratch 4 05-16-2017 01:17 AM
[SOLVED] if [[ -n "$1" ]]; then FAIL FAIL FAIL rbees Programming 7 03-25-2015 02:39 PM
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
Can't boot LFS ( kernel panic - not syncing ) LFS 6.6 Lyle Linux From Scratch 14 05-15-2010 03:22 AM

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

All times are GMT -5. The time now is 06:23 AM.

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