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.
OK, fixed it up on mine and can now boot into LFS, so here's what I did and something for you to try:
*** IF YOU START THIS WITHIN 10 MINUTES OF ME POSTING GO BACK AND START AGAIN _ I MISSED A COUPLE OF STEPS AND HAVE EDITED ACCORDINGLY ***
Mount your LFS partition (I'll assume that you mount it at /mnt/lfs)
Code:
cd /mnt/lfs/sources/linux-3.1 #(or wherever in the lfs filesystem you have your kernel source)
chroot to LFS and:
Code:
make mrproper #(to clean up the build environment)
exit chroot, and then
Code:
cp /boot/config-3.1 .config
gedit .config #(use your favourite text editor. You can also do this with vim in a chroot to lfs, but this is faster and easier)
Now, use your editors find and replace to change all instances of =m to =y (this is overkill for the purpose, but since you are probably building a kernel suited to your system it can't hurt).
Make sure that CONFIG_SATA_AHCI=y and CONFIG_ATA=y, as well as any controller for your own hardware (for example mine is NVidia so CONFIG_SATA_NV=y here)
To keep things clean you may also want to remove the /mnt/lfs/lib/modules directory.
Save, then enter chroot to LFS, cd to /sources/linux-3.1 make menuconfig. Exit menuconfig and save (dunno why, but if you don't do this then make will quiz you on all the options).
Code:
make
make modules_install #This should do almost nothing
exit chroot
copy bzImage, System.map and .config to /boot per the LFS book
Code:
gedit /mnt/lfs/etc/fstab
Change any entries pointing to UUID to absolute devices (e.g. /dev/sda1 etc) to suit your lfs system. Make sure that you have an entry for /boot. I've personally commented out the entry for /dev since it produces warnings at boot time. It seems to be mounted before fstab is used here. YMMV on this. Make sure that you leave the entry for /run otherwise you will get a fatal error at the end of booting and pressing enter will shutdown your system. Then save.
Code:
gedit /boot/grub/grub.cfg
Go to your entry for your lfs system and make sure that it is similar to:
Code:
menuentry "Linux From Scratch" {
insmod ext2
set root='(hd0,1)'
linux /vmlinuz-3.1-lfs root=/dev/sdb3 ro
}
Where set root='(hd0,1)' points to the partition holding /boot (hd0, msdos1) is my best guess for your system. You will also need insmod part_msdos in yours.
/dev/sdb3 should be amended to point to your LFS /root - NOT using UUID.
Save and try to reboot, with luck it will work now.
silly question.when you logout from chroot after make mrproper,you said i should cp /boot/config-3.1 from host machine!!!
there is no confi-3.1 in host system.it's in chroot envirement actually here--> /mnt/lfs/boot/config-3.1
i issued copy command in chroot envirement,is that wrong?
silly question.when you logout from chroot after make mrproper,you said i should cp /boot/config-3.1 from host machine!!!
there is no confi-3.1 in host system.it's in chroot envirement actually here--> /mnt/lfs/boot/config-3.1
i issued copy command in chroot envirement,is that wrong?
spiky0011 is correct, all the kernel build steps should be done in the chrooted environment. In your case the grub steps should be done outside!
BTW: I just finished building LFS 7.0 and it boots/runs without any problems (followed the book, no deviations). You might want to check if the following option is activated in the kernel: General setup ---> Enable deprecated sysfs features to support ...... This one is was deactivated out of the box and needs to be active (look at the /etc/fstab file).
EDIT: just re-read your post - and I'd misread it before. I'll leave my original reply here in case it clarifies things later.
If you copied .config to /boot in the chroot environment it's probably not where it should be on your system. In that case, stay in the chroot and try cp /boot/config-3.1 /sources/linux-3.1/.config (or whatever you called it when you originally copied), then exit chroot and carry on. Your problem, and the in and out of chroot is simply because you aren't using the LFS grub to boot (good idea, it will trash your existing grub), so you need to get all the files in the right place.
If I'm honest, this is probably also the cause of your original "file not found" error.
----
Original reply
If you followed my suggestions exactly as written, when you exit the chroot environment you should still be in /mnt/lfs/sources/linux-3.1 folder in the host terminal, so issuing the copy command will copy your LFS config file to your /boot folder, which is the correct one. (You could do it from within chroot, too. The reason I didn't is that it would mean mounting your /boot folder in the chroot environment to do so. It doesn't really matter whether you copy from within chroot or directly from the mounted lfs partition - you are still copying the same file).
If you issue the copy command in the chroot environment when using an existing grub you will copy the files into the LFS filesystem at /mnt/lfs/boot rather than the system /boot folder, which means grub won't find it when you try to boot.
As others said, there is no need to use an initrd for L.F.S. In a similar vein, there is probably no need to build much as modules. Anything critical must be built into the kernel (y, not M). If your PATA or SATA driver is built as a module (and you're not using the initrd correctly), it will not load the driver for your hard drive controller before it tries to mount /, which will cause a kernel panic.
If you're installing Linux from Scratch on a separate hard drive, you could install GRUB on that drive separately from your main one. I don't know why this would be necessary, but it might help.
From the error messages you're getting, it sounds like it's loading the kernel, so it has the right partition for that. It's having trouble finding your root partition, and the most likely reasons for that are:
1. GRUB is configured to use the wrong one.
2. The kernel is misconfigured so that it can't load your SATA driver.
3. (Maybe) fstab is incorrect, or not being loaded for some reason.
Are you sure that your host system is mounting /boot? Does your host system use a separate partition as boot? If / is /dev/sda1, then it's probably not a separate partition.
Before I answer your question: You've had many answers in this thread, some of them are conflicting, and depending on what you did or didn't do you might have created a bit of a mess.
It might be a good idea to tell us what your current status is:
- Are you still trying to use initrd? If you are not: Have you removed it so it won't possibly conflict?
- Have you restored the original configuration settings as mentioned in the LFS book (you've been trying many different things)?
- Which specific error(s) are you getting when you try to boot right now?
- To get an idea what is being used can you post the content of the following files:
---> From your host: the grub configuration file and the output of df -h
---> From LFS (from inside the chrooted environment): /etc/inittab, /etc/fstab and the output of ls -la /boot
Please put all inside [code] ... [/code] tags. If you don't know how: LQ - BB Code List.
Quote:
Originally Posted by devilboy09
how can i replace =m with =y with vim in .config file?
After loading your .config file
Code:
:%s/=m$/=y/
Editing the .config file by hand is kinda tricky. Do not forget to run make menuconfig (say yes to save config) after you edited your .config file!!
what do you mean?
what's the exact entry in fstab?
Based on your system booting as far as loading the kernel, skip that for now. We may have to address it when we get past your immediate problem, but it isn't a pre-requisite for fixing the immediate problem.
Have you restored the original configuration settings as mentioned in the LFS book (you've been trying many different things)?
i don't undrestand.what original configuration?
The configuration as mentioned in the LFS book. For example: I do remember you used rw instead of ro in the grub lfs startup line, did you change that back to ro. You also used initrd, are you sure all related to that is removed.
We'll see when you post the output I asked for.
Quote:
Quote:
Originally Posted by druuna
Which specific error(s) are you getting when you try to boot right now?
the same error kernel-panic... i posted earlier
You have mentioned 2 different boot errors in this thread.....
Please post the exact error(s) and a few (5 or so) lines before that.
Quote:
i'll print the output of the commands that you asked in next post
The configuration as mentioned in the LFS book. For example: I do remember you used rw instead of ro in the grub lfs startup line, did you change that back to ro. You also used initrd, are you sure all related to that is removed.
yes,i correct that
Code:
You have mentioned 2 different boot errors in this thread.....
Please post the exact error(s) and a few (5 or so) lines before that.
the error in post #3
i did everything Roken said in post #17 and now i can't even boot with my host machine.i mean it just go straight to my lfs systemthat is not ok and give me the error that i said.and i took your advice in post #20.( is there any special key that i can press in boot time to go to boot menu)
Code:
From your host: the grub configuration file and the output of df -h
i didn't ran df -f
at the end of the process i edited the grub like roken said:
menuentry "Linux From Scratch" {
insmod ext2
set root='(hd0,1)'
linux /vmlinuz-3.1-lfs root=/dev/sdb1 ro
}
and i'm stuck
Code:
From LFS (from inside the chrooted environment): /etc/inittab, /etc/fstab and the output of ls -la /boot
ok
inittab
Code:
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc S
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty --noclear tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab
fstab is the same as post #3
and /boot is empty
Last edited by devilboy09; 11-14-2011 at 08:11 AM.
i did everything Roken said in post #17 and now i can't even boot with my host machine.i mean it just go straight to my lfs systemthat is not ok and give me the error that i said.and i took your advice in post #20.( is there any special key that i can press in boot time to go to boot menu)
I'm sorry to have to say this: Ignore post #17, there are errors in that post and it is _not_ consistent with your setup!
Quote:
at the end of the process i edited the grub like roken said:
menuentry "Linux From Scratch" {
insmod ext2 set root='(hd0,1)'
linux /vmlinuz-3.1-lfs root=/dev/sdb1 ro
}
That is _not_ correct! You are _not_ using a separate /boot partition, also hd0,1 points to /dev/sda, not /dev/sdb
Assuming the following: Debian is on /dev/sda1 and LFS is on /dev/sdb1, your grub menu entry for LFS should look like this (see post #11):
Code:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Linux From Scratch (7.0) (on /dev/sdb1)" --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd1,1)'
menuentry "GNU/Linux, Linux 3.1-lfs-7.0" {
linux /boot/vmlinuz-3.1-lfs-7.0 root=/dev/sdb1 ro
}
Check if you use vmlinuz-3.1-lfs-7.0 or vmlinuz-3.1-lfs. If you use vmlinuz-3.1-lfs edit the above accordingly. Use ls -l /mnt/lfs/boot/ to check.
Quote:
inittab
Code:
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc S
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty --noclear tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab
fstab is the same as post #3
and /boot is empty
Both inittab and fstab look ok (btw did you change your hosts /etc/fstab as mentioned in post #11?)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.