LinuxQuestions.org
Review your favorite Linux distribution.
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-13-2011, 08:21 AM   #16
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 300
Blog Entries: 1

Rep: Reputation: 55

I've ruled out the kernel by booting LFS using my known good kernel from the host system with the same result, so looking elsewhere now.
 
Old 11-13-2011, 10:14 AM   #17
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 300
Blog Entries: 1

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

Last edited by Roken; 11-13-2011 at 10:27 AM.
 
0 members found this post helpful.
Old 11-13-2011, 12:20 PM   #18
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
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?
 
Old 11-13-2011, 01:02 PM   #19
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
The book dose say in the chroot enviroment you exit after grub setup
 
Old 11-13-2011, 01:22 PM   #20
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by devilboy09 View Post
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).

Hope this helps.
 
Old 11-13-2011, 01:52 PM   #21
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 300
Blog Entries: 1

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

For clarity, you could issue the commands:

Code:
sudo cp /mnt/lfs/sources/linux-3.1/arch/x86/boot/bzImage /boot/vmlinuz-3.1-lfs
sudo cp /mnt/lfs/sources/linux-3.1/System.map /boot/System.map-3.1-lfs
sudo cp /mnt/lfs/sources/linux-3.1/.config /boot/config-3.1-lfs
To achieve the same end.

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.

Last edited by Roken; 11-13-2011 at 03:51 PM.
 
0 members found this post helpful.
Old 11-13-2011, 09:25 PM   #22
liquidkaleidoscopes
LQ Newbie
 
Registered: Aug 2011
Posts: 27

Rep: Reputation: Disabled
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.
 
Old 11-14-2011, 02:07 AM   #23
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
no,i don't use a seperate partition for my lfs boot partiton.how can i replace =m with =y with vim in .config file?
i don't know the exact command
 
Old 11-14-2011, 02:42 AM   #24
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi devilboy09,

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!!

Hope this helps.
 
Old 11-14-2011, 04:35 AM   #25
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
Code:
 Make sure that you have an entry for /boot
what do you mean?
what's the exact entry in fstab?
 
Old 11-14-2011, 04:38 AM   #26
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
Code:
Are you still trying to use initrd? If you are not: Have you removed it so it won't possibly conflict?
no.based on previous posts, i gave up on that
Code:
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?
Code:
Which specific error(s) are you getting when you try to boot right now?
the same error kernel-panic... i posted earlier
i'll print the output of the commands that you asked in next post
 
Old 11-14-2011, 04:44 AM   #27
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 300
Blog Entries: 1

Rep: Reputation: 55
Quote:
Originally Posted by devilboy09 View Post
Code:
 Make sure that you have an entry for /boot
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.
 
Old 11-14-2011, 06:45 AM   #28
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by devilboy09 View Post
Quote:
Originally Posted by druuna
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
Ok.
 
Old 11-14-2011, 08:09 AM   #29
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
Code:
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.
 
Old 11-14-2011, 09:15 AM   #30
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by devilboy09 View Post
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?)

Hope this helps.
 
  


Reply

Tags
grub, kernel, lfs



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
Good but sorta easy guide to Kernel compiling/Re-Compiling? linus72 Linux - General 1 07-13-2009 01:37 PM
Compiling a module separately without compiling entire kernel kushalkoolwal Linux - Kernel 8 08-06-2008 01:45 AM
compiling kernel problem --- Kernel panic: unable to mount root fs ........ anthonymts123 Linux - General 5 07-31-2006 02:29 AM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 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