LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 09-18-2012, 10:59 AM   #1
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Rep: Reputation: Disabled
Another LFS (7.1) wont boot post.


Hi,

I'm quite new to Linux, been finding this forum LOTS of help though. Not had to make a post before, usually been able to find an answer without needing to.

Anyway, I realise there are many posts on this topic already, but despite reading lots of them I haven't been able to find an answer, so I'm hoping if I post my own specifics someone might be able to help.

I just finished building the basic LFS system from book 7.1. I want to make the LFS system bootable from my existing GRUB, so within my host system (Ubuntu 11.04) I edit the /boot/grub/grub.cgf file to include the following code which i nabbed from a post courtesy of Druuna and modified for my own system:

Code:
menuentry "LFS 7.1 - linux 3.2.6" {
   insmod ext2
   set    root=(hd0,6)
   linux  /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda6 ro
}
The partition for my LFS system is sda6, which is also the boot partition. When I reboot the system I am able to enter the GRUB menu, and I can see an entry for the LFS 7.1 system. When I select that option to boot I get an error message:

Code:
error: file not found
press any key to continue...
If I chroot into the LFS environment and do ls -l /boot I get the following:

Code:
root:/# ls -l /boot
total 6716
-rw-r--r-- 1 root root   79288 Sep 13 13:41 config-3.2.6
drwxr-xr-x 3 root root    4096 Sep 13 23:08 grub
-rw-r--r-- 1 root root 1924768 Sep 13 13:41 System.map-3.2.6
-rw-r--r-- 1 root root 4864192 Sep 13 13:40 vmlinuz-3.2.6-lfs-7.1
I think the error is saying that GRUB cant find the 'vmlinuz-3.2.6-lfs-7.1' file, yet I can find it myself in the /boot directory.

Can anyone please offer any advice? Thanks in advance
 
Old 09-18-2012, 11:46 AM   #2
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
Hi

Have you tried on ubuntu sudo update-grub.
Or have you tried booting from the grub prompt manualy
 
1 members found this post helpful.
Old 09-18-2012, 12:12 PM   #3
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Thanks Spiky,

update-grub goes like this:

Code:
sudo update-grub 
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Doesn't seem to find the LFS system automatically.

Not sure about booting from the GRUB prompt, i'm not familiar with the commands but I can give it a go if someone can advise or if I know what I need to do from there.

Thanks again!
 
Old 09-18-2012, 01:19 PM   #4
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
Hi

I,m not saying this will boot the machine but it will let you know where the kernel is.

While at boot menu press c you will enter at grub prompt grub >

type set root=(hd0, then press the TAB key that will list all partition, hopefully your lfs will be listed hd0,msdos6. If it is Type the 6 after (hd0,msdos6) It should look like this.
grub > set root=(hd0,msdos6) hit enter

grub > "type" linux /boot/ then hit TAB that will list kernels on that partition it should show the kernel you want. If you start typing vml the TAB will self complete

you should have grub > linux /boot/vmliunz-3.2.6-lfs-7.1 then enter.
then at grub > "type" boot

it should boot if all is good. This will also show the path to the kernel is correct.
 
Old 09-18-2012, 01:53 PM   #5
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Ok, so I have followed those instructions and got part way.

At the grub prompt I type

grub> set root=(hd0

and then hit tab. I get a list of the partitions, and listed is 'Partition hd0,msdos6: Filesystem ext2...'. So I complete the grub command to read

grub> set root=(hd0,msdos6)

and then hit enter. This command is accepted. Then, continuing with the instructions, at the grub prompt I type

grub> linux /boot/

and then hit tab, but nothing is found. If I type

grub> linux

and then hit tab, I get a response to say that possible commands are 'linux linux16'.

So it lets me set the root partition but then it doesn't seem to find the kernel
 
Old 09-18-2012, 02:53 PM   #6
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
Hi

Can you post the output of
Code:
sudo blkid
from ubuntu and the /etc/fstab from lfs.
 
Old 09-18-2012, 04:06 PM   #7
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Results of sudo blkid in host system (Ubuntu):

Code:
sudo blkid
/dev/sda1: UUID="7b20b9f0-5eea-4dda-81cf-9399bfd02521" TYPE="ext4" 
/dev/sda5: UUID="fc760024-4213-43f8-a9c7-b58fea8b5aa7" TYPE="swap" 
/dev/sda6: UUID="6e508619-04ac-4cde-aa94-a24aa87f151e" SEC_TYPE="ext2" TYPE="ext3"
Contents of fstab in LFS:

Code:
#Begin /etc/fstab

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

/dev/sda6     /           ext3     defaults            1    1
/dev/sda5     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=4,mode=620      0    0
tmpfs         /run        tmpfs    defaults            0    0
devtmpfs      /dev        devtmpfs mode=0755,nosuid    0    0

#End /etc/fstab
Thanks again Spiky.
 
Old 09-19-2012, 01:43 PM   #8
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
Hi

It all looks ok I dont see why it wont find the kernel.

At grub prompt set root=(hd0,6) enter then try linux / then use tab. I,m not expecting it to find it.
Then Maybe try restart run through it again but try grub >linux /boot/vmlinuz-3.2.6-lfs-7.1

At the moment thats all i can think of.
 
Old 09-20-2012, 09:10 AM   #9
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Hi Spiky,

Thanks again for all your help and support.

I have gone through the steps listed above. I have set the root the hd0,6 and then typed 'linux /' at the terminal and hit tab. This autocompletes the rest of the command to read 'linux /lost+found/' so I guess this is the only possible entry (didn't give me any other options). This in itself seems interesting as I guess at this point it should find my file system on hd0,6 which should contain more than just /lost+found.

Anyway, I continue with the instructions, reboot and try the second set of commands listed but again get 'error: file not found'.

One thing that has occurred to me (please forgive my noobness) is that I have set the fstab file and all other config files that concern the hard disk to refer to the hard disk as 'sda'. This is because, using a disk utility in the hosts system (ubuntu), this is how they are listed. However, my hard disk is connected via IDE (not SATA) so as far as I understand it the disk should be referred to as 'hda'. Maybe Ubuntu does not stick to this convention, which is why they display as 'sda' in the disk utility inside my host environment, but maybe for the purposes of LFS I should use the standard convention.

Anyone have any ideas?
 
Old 09-20-2012, 11:50 AM   #10
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
Hi

Can you
Code:
sudo mount -v /dev/sda6 /mnt
Then
Code:
ls /mnt
post output

Just a thought did you
Quote:
stoat
Something similar has been caused before by "CONFIG_DEVTMPFS is not set" in the kernel configuration. Anyway, it can't hurt to check. If you still have your .config file in your kernel source directory, or if you can mount your LFS partition and examine the config file in /boot, then search or grep for CONFIG_DEVTMPFS=y. If yours "is not set" instead, then correct it and recompile the kernel...

Originally Posted by Page 226 of LFS v7.2

Device Drivers --->
Generic Driver Options --->
Maintain a devtmpfs filesystem to mount at /dev

Last edited by spiky0011; 09-20-2012 at 12:28 PM.
 
Old 09-20-2012, 02:13 PM   #11
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Couple of things that seem odd but may not be relevant you are using insmod ext2 in grub.config but blkid says sda6 is ext3, stuff in the fstab is irrelevant as you havn't got to that bit yet as you haven't booted, are you using an initrd? if so the path to that needs to be in the grub.config entry, have you set your kernel to recognize ext2/3 file systems?
Try using grub1 not grub2 as it is easier to configure, also you may want to try lilo ( I haven't used it ) as it seems easier to set up than grub.

Last edited by Keith Hedger; 09-20-2012 at 02:16 PM.
 
1 members found this post helpful.
Old 09-21-2012, 09:30 AM   #12
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Spiky:
Here is the output of 'ls /mnt' after mounting /dev/sda6 to /mnt.

Code:
lost+found
Shouldn't I expect to see the contents of the root of my LFS file system there?

Regarding the kernel configuration, I definitely set those options during the set up, and I double checked when I recompiled the kernel when following Keith's advice below.


Keith:
Following the LFS guide I created an ext3 file system by issuing the following command using e2fsprogs.

Code:
mke2fs -jv /dev/sda6
During chapter 8 the LFS guide instructs to create a grub.cfg file which includes the line 'insmod ext2'.

As I wanted to use the existing GRUB from my host system I added the menu option shown in the post above to the host's grub.cfg file, which was based on a suggestion made in another post.

However, since then I have also tried following the LFS guide exactly, which involves overwriting the host GRUB from within the LFS environment and then writing a grub.cfg file as follows (which also uses the 'insmod ext2' line).

Code:
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,6)
menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1" {
linux /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda6 ro
}
When I try this method I get a different error, but the system still does not boot.

Code:
GRUB loading
Welcome to GRUB

error: incompatible license
Entering rescue mode...
grub rescue>
As far as I am aware I am not using an initrd for the LFS system as nowhere in the guide does it instruct to do so. From what I understand, my host system (Ubuntu 11.04) does not use an initrd by default and I have not configured it to do so.

I wasn't sure if I had configured the kernel to recognise ext2/3, so I recompiled and installed all the options that related to ext2, of which there were several, but I still receive the same errors.


One last thing I noticed whilst running these diag's (which I didn't spot before) was an error message I received when trying to umount LFS after entering back into the host environment in order to reboot the system into the LFS system.

I run through the instructions to unmount various things and get the following.

Code:
umount -v $LFS/dev/pts
devpts umounted
umount -v $LFS/dev/shm
shm umounted
umount -v $LFS/dev
/dev umounted
umount -v $LFS/proc
proc umounted
umount -v $LFS/sys
sysfs umounted

umount -v $LFS
Could not find /mnt/lfs in mtab
umount: /mnt/lfs: not mounted
Dunno if that is at all relevant but I don't know why I should receive such an error, the $LFS variable is set correctly at this point, but it complains that it cannot find /mnt/lfs in mtab.

/etc/mtab looks like this:

Code:
more /etc/mtab

/dev/sda1 / ext4 rw,errors=remount-ro,commit=0 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
none /dev devtmpfs rw,mode=0755 0 0
none /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
none /dev/shm tmpfs rw,nosuid,nodev 0 0
none /var/run tmpfs rw,nosuid,mode=0755 0 0
none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
gvfs-fuse-daemon /home/mel/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=mel 0 0
/dev /mnt/lfs/dev none rw,bind 0 0
devpts /mnt/lfs/dev/pts devpts rw 0 0
shm /mnt/lfs/dev/shm tmpfs rw 0 0
Thanks again everybody

Last edited by mev; 09-21-2012 at 09:31 AM.
 
Old 09-21-2012, 09:54 AM   #13
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
From what I can see you are using sda6 for your lfs and in the grub menu config you are setting root=(hd0,6) grub partitions are zero based so you should use root=(hd0,5). complaints from your host system can for now be ignored as they are not part of the boot process, of course if a partition is not cleanly unmounted when you boot you will have to sit through a disk check.
 
Old 09-21-2012, 10:14 AM   #14
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
Hi

If you built on sda6, then mounting the partition mount -v /dev/sda6 then ls should show lfs dirs.

As you only show 3 partitions I take it sda1 is host sda5 is swap and sda6 is showing nothing???

Just try
Code:
df -h /dev/sda6
output should look
Filesystem Size Used Avail Use% Mounted on
/dev/sdc1 9.7G 2.6G 6.6G 29% /media/LFS-7rc2
 
Old 09-21-2012, 11:17 AM   #15
mev
LQ Newbie
 
Registered: Sep 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Keith,

I am not sure that is the case in this particular instance. Section 8.4.2 from the LFS manual describes this differently.

This seems to be verified by the effect of me changing hd0,6 to a lower value, such as hd0,5. When i do this I get the following message:

hd0,3 - No such partition
hd0,4 - No such partition
hd0,5 - Unknown file system
hd0,6 - file not found


Spiky,

I think this is the crux of the problem. You are correct in terms of the use of the 3 partitions, sda1 is host, sda5 is swap and sda6 should be LFS.

I get the following output from your suggestion:

Code:
df -h /dev/sda6
Filesystem            Size  Used Avail Use% Mounted on
none                  1.6G  632K  1.6G   1% /dev
This is after a full reboot and before manually mounting anything - doesn't seem right.

Because I built the LFS system over several sessions, and to make mounting everything and entering the chroot environment easier, I wrote a simple script.

Code:
#!/bin/bash
#simple script to prep for end enter into the chroot environment
#for building the LFS project.

#Set $LFS
export LFS=/mnt/lfs

#Mount and populate /dev
mount -v --bind /dev $LFS/dev

#Mount virtual kernel file system
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys

#Switch to chroot
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
The first thing the script does is to set the $LFS variable. It then mounts all the necessary stuff and switches me into the chroot environment. However, if I try echo $LFS nothing is returned (this is from within the LFS environment). If I logout and go back to the host environment and again try echo $LFS nothing is returned, making me think that maybe the $LFS variable is not getting set correctly and then the rest of the script behavior is not as desired.

It does look as though I have entered the LFS environment when I run the script because my prompt goes from 'root@ubuntu:/home/mel#' to 'root:/#'. That maybe means nothing though. This is probably why n00bs shouldn't try LFS!!
 
  


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
Horrible ordeal trying to boot LFS. Tried older version - won't boot either Lyle Linux From Scratch 9 05-20-2010 08:56 PM
Can't boot LFS ( kernel panic - not syncing ) LFS 6.6 Lyle Linux From Scratch 14 05-15-2010 03:22 AM
xandros 4 wont boot on post install marlonr1970 Linux - Hardware 0 02-07-2007 10:20 AM
how to wont post to site jlawren7 LQ Suggestions & Feedback 2 01-03-2005 01:23 PM
install Suse, xp wont boot, repair xp suse wont boot Tangz Linux - Newbie 10 07-16-2004 05:37 PM

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

All times are GMT -5. The time now is 01:37 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