[SOLVED] Stuck at Chapter 8. Making the LFS System Bootable
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.
Stuck at Chapter 8. Making the LFS System Bootable
Linux From Scratch - Version 7.7
Chapter 8. Making the LFS System Bootable
Hi there.
Bsically i have 2 sata hard drives on my pc.
On my first hard drive i have Win xp, on second i installed LFS.
I managed to get to the end of LFS, but im stuck at grub chapter.
Basically what i did(I thought this would work, cause was afradi that i will mess up my win xp).
On my fstab i put(not showing all, just some of important ones)
/dev/sdb2 / ext4
/dev/sdb1 swap swap
Second , i did this.
Instead of grub-install /dev/sda i did, grub-install /dev/sdb
3d: My grub config
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext4
set root=(hd1,2)
menuentry "GNU/Linux, Linux 3.19-lfs-7.7" {
linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro
}
EOF
That's all. I did all the testing and everything went well from the begining. The only problem i have, is that i cannot boot, i get error like "<error> no such partition"
That's it.
Can someone please tell me, did I ruined everything or is there still a hope.
Use insmod ext2 in grub.cfg, because there is no ext4 grub module.
Code:
anak_bawang [ ~ ]$ ls /boot/grub/i386-pc/ext*
ext2.mod
extcmd.mod
Ext2 works also for ex4 file system. Like my LFS.
Code:
root [ ~ ]# fdisk -l
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 96471039 96468992 46G 83 Linux
/dev/sda2 96471040 104857599 8386560 4G 82 Linux swap / Solaris
root [ ~ ]# mount
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)
In your configuration, to boot yout LFS, remove your first hard drive.
And make sure your /dev/sdb2 was set to bootable while you were creating it.
If you run both hard disk simultaneously, could use dual boot.
Add another menuentry to your grub.cfg
Code:
set default=1
set timeout=5
insmod ext2
set root=(hd0,1)
menuentry "Windows XP" {
root=(hd0,1)
chainloader +1
}
menuentry "GNU/Linux, Linux 3.19-lfs-7.7" {
linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sda1 ro
}
For booting Linux (LFS) did you removed the XP installed hard drive?
Is that error produced by grub or Windows?
- Both hard drive boot normaly, Yes windows xp boots and runs
- And on a second HD, yes lfs grub loader runs.(when i set it to bios), then i get that error 'no such partition'
- I tried to remove xp hard drive and i get errror when booting lfs only.
Error: HD1 cannot get /C/H/S values.
You don't need a boot loader, such as grub for this. Utilize the BIOS boot screen to boot each hard drive individually. Just be sure to mark each root/primary partition as Bootable using fdisk or cfdisk.
At this point though you will need to remove Grub from the MBR to do this.
Boot loaders are meant to sort out multiple Bootable operating systems on one disk.
If i remove boot loder(grub) from my second hd(were i installed LFS) then linux wont boot. Becuse it needs a boot loader.
I think that's how it works.
I already replied but the message is not showing up. I'm replying again.
@veerain - I did try to boot only on linux (LFS) hard drive,(with just one HD, like u said) i get error.
error - HD1 cannot get C/H/S values
@anak_bawang - I dont wana install grub on sda(main hd) because i already have win xp there. That's the main point, in what im trying to do. I dont wana messeup my other HD. Logicaly what i did as noted above in 1st post it should work. I installed the LFS on my second hard drive. With swap as sdb1, Main partition bootable as sdb2, and grub installed on sdb.
Noted again for clarity:
======================= My grub install =======================
Grub installed on
grub-install /dev/sdb
======================= My grub config =======================
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd1,2)
menuentry "GNU/Linux, Linux 3.19-lfs-7.7" {
linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro
}
EOF
======================= Cut here =======================
THe fstab points to
/dev/sdb2 / ext4
/dev/sdb1 swap
Is this possibel in what im trying to do. Is there any other way without modifying my 1st HD.
By the way all this (installation of LFS in second HD) was done from Ubuntu live usb. Sorry i didnt mention that.
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext4
set root=(hd1,2)
menuentry "GNU/Linux, Linux 3.19-lfs-7.7" {
linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro
}
EOF
I take this is the grub.cfg from 2nd HD with grub installed on it.
Change "set root=(hd1,2)" to "set root=(hd0,2)". The reason is, grub is reading sdb as the 1st drive now, but the partition is still set the same "linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro"
I have got grub installed on sdb and that is how mine works.
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext4
set root=(hd1,2)
menuentry "GNU/Linux, Linux 3.19-lfs-7.7" {
linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro
}
EOF
I take this is the grub.cfg from 2nd HD with grub installed on it.
Change "set root=(hd1,2)" to "set root=(hd0,2)". The reason is, grub is reading sdb as the 1st drive now, but the partition is still set the same "linux /boot/vmlinuz-3.19-lfs-7.7 root=/dev/sdb2 ro"
I have got grub installed on sdb and that is how mine works.
I did what u said, made the changes u provided , i rebooted and my screen got filled with info.
I managed to get som of it and maybe u have seen this type of errors.
====
[1.494506] [<c175ab18>] kernel_init+0x8/0xd0
ret_from_kernel_thread+0x21/0x30
?rest_init+0x60/0x60
end trace 65f7b567f2cc437d]
===
So i have no idea what to do now, the computer crashes during this phase(i restart).
Anyway i did grub-install again on sdb, and sometimes i get that error above and sometimes i get
Kernel panic - not syncing VFS
Unable to mount root fs on block (0,0)
The LFS is installed on my second hard drive. I got this info from LFS.(second hard drive - dev/sdb)
As noted on (below at the end) the procedure that i follow to log in as chown as root on LFS.
Your requested results:
============================ CUT HERE ============================
cat config-3.19 | grep CONFIG_DEVTMPFS
Result Below:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
============================ CUT HERE ============================
cat config-3.19 | grep CONFIG_EXT4
Result Below:
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
============================ CUT HERE ============================
/etc/fstab file for lfs.
cat > /etc/fstab << "EOF"
# Begin /etc/fstab
# file system mount-point type options dump fsck
# order
============================ CUT HERE ============================
This is the procedure i go everytime i update any config files on my LFS. If you find any easy way please let me know.
I'm using Live usb stick - Ubuntu.
I login on shel on ubuntu > sudo -s
Then i do > export LFS=/mnt/lfs
> mkdir -pv $LFS
mount -v -t ext4 /dev/sdb2 $LFS (The dev/sdb is my second hard drive - the LFS)
After this i Preparing Virtual Kernel File Systems:
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
Then i do chown enviroment - code from Chapter 6 - 6.73.Cleaning up
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
I think the problem is in your kernal config file, you havn't loaded a driver, Use Y not M you need for your hardware, hard drive controller or sata driver, use "lspci" from live usb to find your hard ware then check it in the kernel.
Kernel panic - not syncing VFS
Unable to mount root fs on block (0,0)
shows not finding HD
I think the problem is in your kernal config file, you havn't loaded a driver, Use Y not M you need for your hardware, hard drive controller or sata driver, use "lspci" from live usb to find your hard ware then check it in the kernel.
Kernel panic - not syncing VFS
Unable to mount root fs on block (0,0)
shows not finding HD
What hardware info i'm suppose to look for. Any cluess.
From some sources it says that in kernel configuration the CONFIG_SCSI needs to be changed to CONFIG_SATA.
Anyway how do i edit the kernel config.
Sorry what is the command for version-check
One thing.
Can i start again at this point from chapter:
Linux From Scratch - Version 7.7
Chapter 8. Making the LFS System Bootable.
Will i harm or damage if i do that process again. Just curios. Cause i think that's were something went wrong.
THis is the ubuntu host requirement that i just found out.
root:/# bash version-check.sh
bash, version 4.3.33(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils) 2.25
bison (GNU Bison) 3.0.4
yacc is bison (GNU Bison) 3.0.4
bzip2, Version 1.0.6, 6-Sept-2010.
Coreutils: 8.23
diff (GNU diffutils) 3.3
find (GNU findutils) 4.4.2
GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.2-p11, GNU MP 6.0.0)
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.9.2
g++ (GCC) 4.9.2
(GNU libc) 2.21
grep (GNU grep) 2.21
gzip 1.6
Linux version 3.16.0-30-generic (buildd@phianna) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:45:15 UTC 2015
m4 (GNU M4) 1.4.17
GNU Make 4.1
GNU patch 2.7.4
Perl version='5.20.2';
sed (GNU sed) 4.2.2
tar (GNU tar) 1.28
makeinfo (GNU texinfo) 5.2
xz (XZ Utils) 5.2.0
g++ compilation OK
@spiky0011 - Is there a way of making this mother work or should i just restart again with another distro.
I'm lost xd.. What is the best way to start all over again.( I was doing this for a challenge and made it in 2 days, but got stuck) ;(
So you can get to boot grub atleast. After booting to grub go to grub command line mode (CLI) (See directions below menu- perhaps Ctrl-C).
In grub cli use the grub 'linux' command to select the kernel and pass parameters. And then run 'boot' command to bootup linux.
Note if the Linux HDD is primary (then only grub will boot - As BIOS booting device is primary) then change 'root' parameter as '/dev/sda2'. Also use 'Tab' key to autocomplete the rest of possibilities in grub cli. E.g. type 'linux (hd' then use 'Tab key'. Locate your kernel file and so on ...
And no need to go through whole LFS build again. Just try at grub console again and again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.