LinuxQuestions.org
Visit Jeremy's Blog.
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 03-18-2013, 04:55 AM   #1
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Rep: Reputation: Disabled
Grub-problem


Hi,

I just finished building LFS, now its time to boot, but unfortunately I tried alot but all my efforts vain.

FYI

output for fdisk -l from my host is


cot@boss:~$ sudo fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xe175b05b

Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 7715 61760512 7 HPFS/NTFS
/dev/sda3 7715 26167 148212736 5 Extended
/dev/sda4 26167 38914 102391808 83 Linux
/dev/sda5 9044 22160 105355264 7 HPFS/NTFS
/dev/sda6 22160 26167 32183296 7 HPFS/NTFS
/dev/sda7 7715 9044 10671104 83 Linux

Partition table entries are not in disk order
cot@boss:~$

I builded my LFS at /dev/sda7, You may note that I has no seperate partition for /boot or anything for /swap etc

FYI my laptop is already dual bootable holds windows 7 and Linux earlier..but now I am trying to add one more os (LFS)...

and from my host /etc/fstab is


cot@boss:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda7 during installation
UUID=ece89103-0538-45dc-82ab-5014e9ed9798 / ext3 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=7170833c-376c-4620-a234-3f9fd309887b none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/scd1 /media/cdrom1 udf,iso9660 user,noauto 0 0
cot@boss:~$


and inside my LFS /etc/fstab is


root:/# cat /etc/fstab
# Begin /etc/fstab

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

/dev/sda7 / ext3 defaults 1 1
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab
root:/#

and /boot/grub/grub.cfg from my host is

cot@boss:~$ cat /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
insmod png
if background_image /usr/share/images/desktop-base/boss-grub.png ; then
set color_normal=black/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'BOSS GNU/Linux, with Linux 3.7.8-pimpi3' --class boss --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
echo 'Loading Linux 3.7.8-pimpi3 ...'
linux /boot/vmlinuz-3.7.8-pimpi3 root=UUID=348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20 ro splash vga=791 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.7.8-pimpi3
}
menuentry 'BOSS GNU/Linux, with Linux 3.7.8-pimpi3.old' --class boss --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
echo 'Loading Linux 3.7.8-pimpi3.old ...'
linux /boot/vmlinuz-3.7.8-pimpi3.old root=UUID=348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20 ro splash vga=791 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.7.8-pimpi3
}
menuentry 'BOSS GNU/Linux, with Linux 2.6.39-bpo.2-686-pae' --class boss --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
echo 'Loading Linux 2.6.39-bpo.2-686-pae ...'
linux /boot/vmlinuz-2.6.39-bpo.2-686-pae root=UUID=348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20 ro splash vga=791 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.39-bpo.2-686-pae
}
menuentry 'BOSS GNU/Linux, with Linux 2.6.32-5-686' --class boss --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set 348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20
echo 'Loading Linux 2.6.32-5-686 ...'
linux /boot/vmlinuz-2.6.32-5-686 root=UUID=348b3406-e11c-4fa9-ac4b-fdc5cc7ccb20 ro splash vga=791 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-5-686
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_otheros ###

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
menuentry "Windows Vista (loader)" {
set root=(/dev/sda,msdos1)
search --no-floppy --fs-uuid --set daeecc96eecc6c77
chainloader +1
}
### END /etc/grub.d/30_otheros ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
cot@boss:~$

As directed in LFS book, I created a seperate file /boot/grub/grub.cfg inside LFS partition as follows

root:/# cat /boot/grub/grub.cfg
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod ext2
set root=(hd0,7)

menuentry "GNU/Linux, Linux 3.7.9-lfs-7.3-rc1" {
linux /boot/vmlinuz-3.7.9-lfs-7.3-rc1 root=/dev/sda7 ro
}
EOF
root:/#

and FYI

I can see this difference

at host

cot@boss:~$ sudo grub-install -v
grub-install (GRUB) 1.98+20100804-4boss4


at LFS

root:/# grub-install -v
grub-install (GRUB) 2.00

LFS book suggests one more way to create a seperate partiton for boot...If do that I think I may lose everything what I have now..?

I think I may need to work on host side, so that it may find my LFS
I have no clue for this problem..kindly help me in this....
 
Old 03-18-2013, 08:24 AM   #2
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 465

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by smdaudhilbe

and /boot/grub/grub.cfg from my host is
I don't see a menuentry for your LFS system anywhere in that.

Quote:
Originally Posted by smdaudhilbe

As directed in LFS book, I created a seperate file /boot/grub/grub.cfg inside LFS partition as follows
That looks okay, but it really isn't doing anything since your host's GRUB is doing the boot loader chores.

Quote:
Originally Posted by smdaudhilbe

I think I may need to work on host side, so that it may find my LFS
I agree with that idea. For now I would continue to let the host's GRUB boot everything so that no matter what happens you still can boot your host and Windows. It's the safe and wise thing to do at this time, IMO. After all, you don't even know if your LFS system is capable of booting yet. You need somehow to get an entry for LFS in your host's GRUB boot menu. I guess you've tried the obvious thing: the update-grub command in the host. The other common option is to type manually an entry for the LFS system in the host's /etc/grub.d/40_custom file. It's what that file is for. I would try entering the following in your host's /etc/grub.d/40_custom file and then run update-grub in the host. Reboot and see if you have LFS in your host's GRUB boot menu.
Code:
menuentry "GNU/Linux, Linux 3.7.9-lfs-7.3-rc1" {
insmod ext2
set root=(hd0,7)
linux /boot/vmlinuz-3.7.9-lfs-7.3-rc1 root=/dev/sda7 ro
}
No promises, but it's harmless, reversible, and worth a try.

Quote:
Originally Posted by smdaudhilbe

LFS book suggests one more way to create a seperate partiton for boot...If do that I think I may lose everything what I have now..?
IMO, a separate boot partition would solve nothing about any of this.

Last edited by stoat; 03-18-2013 at 08:41 AM.
 
Old 03-21-2013, 04:32 AM   #3
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
LFS - grub

Hi,

I solved my grub problem, I just copied

1) vmlinuz-3.7.9 -> kernel image
2) System.map -> symbol file
3) config-3.7.9 -> configuration file

into /boot directory of my distro, where my GRUB2 is available,

and also I created a new script inside /etc/grub.d/ as below

#!/bin/sh
exec tail -n +3 $0

# My LFS
# on /dev/sda7

menuentry "LinuxFromScratch" {
insmod ext2
set root=(hd0,7)
linux /boot/vmlinuz-3.7.9-lfs-7.3-rc1 root=/dev/sda7 ro
}

with a name 30_otherLFS, and made executable.

after running, sudo update-grub

my kernel got placed inside /boot/grub/grub.cfg

all is well till now...

But when I booted, and tried to login my LFS, after authetication, it shows some error as below

////////////////////////

login:root
password:

Last login: Thu Mar 21 14:00:04 +0530 2013 on /dev/tty1
No mail
cannot execute /bin/bash : No such file or directory

////////////////////////

again it prompts me to login, same exists on each time of login...

I can't under stand this, Help me in this...
 
Old 03-21-2013, 05:31 AM   #4
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: Ubuntu 12.04/12.10/13.04/LFS/Centos6.3/Debain/PCBSD/Mageia 3
Posts: 1,614
Blog Entries: 1

Rep: Reputation: 226Reputation: 226Reputation: 226
Hi

Check your /etc/passwd file is correct maybe pozt it here
 
Old 03-21-2013, 06:12 AM   #5
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
Hi,

my /etc/passwd

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false

looks like this....
 
Old 03-21-2013, 06:15 AM   #6
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
/bin/bash problem

Hi,

my /etc/passwd

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false

looks like this....
 
Old 03-21-2013, 06:56 AM   #7
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
/bin/bash problem

Hi,

Friends, after doing some research I found solution to my problem at

http://www.mail-archive.com/lfs-supp.../msg05752.html

$ls -l /lib/libncurses.so.5 /lib/libdl.so.2 /lib/libc.so.6

-rwxr-xr-x 1 root root 1152240 2006-08-11 04:43 /bin/bash -> I miss this line
lrwxrwxrwx 1 root root 13 2006-07-23 21:41 /lib/libc.so.6 -> libc-2.3.4.so
lrwxrwxrwx 1 root root 14 2006-07-23 21:41 /lib/libdl.so.2 ->
libdl-2.3.4.so
lrwxrwxrwx 1 root root 17 2006-08-06 03:59 /lib/libncurses.so.5
-> libncurses.so.5.4

where as my

root:/# ls -l /lib/libncursesw.so.5 /lib/libdl.so.2 /lib/libc.so.6
lrwxrwxrwx 1 root root 12 Mar 11 12:13 /lib/libc.so.6 -> libc-2.17.so
lrwxrwxrwx 1 root root 13 Mar 11 12:13 /lib/libdl.so.2 -> libdl-2.17.so
lrwxrwxrwx 1 root root 18 Mar 12 10:02 /lib/libncursesw.so.5 -> libncursesw.so.5.9
root:/#

you can judge that I am missing the first line...

I hope it may belong to /lib/libc.so.6....

I believe after installing bash (pass 2) this may get rectify...

Please share your suggestions to solve this issue....

Whether I am pointing at correct direction....?
 
Old 03-21-2013, 01:14 PM   #8
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: Ubuntu 12.04/12.10/13.04/LFS/Centos6.3/Debain/PCBSD/Mageia 3
Posts: 1,614
Blog Entries: 1

Rep: Reputation: 226Reputation: 226Reputation: 226
Have you fixed the problem ???
 
Old 03-21-2013, 10:45 PM   #9
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
No spiky

problem is same as before....

$ls -l /lib/libncurses.so.5 /lib/libdl.so.2 /lib/libc.so.6

-rwxr-xr-x 1 root root 1152240 2006-08-11 04:43 /bin/bash -> I miss this line
lrwxrwxrwx 1 root root 13 2006-07-23 21:41 /lib/libc.so.6 -> libc-2.3.4.so
lrwxrwxrwx 1 root root 14 2006-07-23 21:41 /lib/libdl.so.2 ->
libdl-2.3.4.so
lrwxrwxrwx 1 root root 17 2006-08-06 03:59 /lib/libncurses.so.5
-> libncurses.so.5.4

where as mine

root:/# ls -l /lib/libncursesw.so.5 /lib/libdl.so.2 /lib/libc.so.6
lrwxrwxrwx 1 root root 12 Mar 11 12:13 /lib/libc.so.6 -> libc-2.17.so
lrwxrwxrwx 1 root root 13 Mar 11 12:13 /lib/libdl.so.2 -> libdl-2.17.so
lrwxrwxrwx 1 root root 18 Mar 12 10:02 /lib/libncursesw.so.5 -> libncursesw.so.5.9
root:/#


Any clue???
 
Old 03-22-2013, 03:10 AM   #10
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Rep: Reputation: 60
Did you read the whole thread you linked to? The problem in that thread was a missing # in fstab.
Code:
# Begin /etc/fstab
# filesystem  mount-point type   options          dump  fsck
                                                       order
'fsck order' was split to 2 lines, therefore it needs a # on the line which says 'order'.

Don't worry about the output of 'ls -l /lib/libncurses.so.5 /lib/libdl.so.2 /lib/libc.so.6' not showing '/bin/bash'. It's not supposed to. With that command you only tell it to list those files you added to the command. If you want to see '/bin/bash' you can run 'ls -l /bin/bash'.
 
Old 03-22-2013, 03:34 AM   #11
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
/bin/bash problem

Hi,

I was aware of # problem, there is no such problem with me...I reinstalled my bash too. but it was not effective...

Share me any suggesstions...am trying side by side
 
Old 03-22-2013, 10:13 AM   #12
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 465

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by smdaudhilbe

my /etc/passwd

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false

looks like this....
Try checking for a space character at the end of that line for root. In other words, make sure yours is "root:x:0:0:root:/root:/bin/bash" and not "root:x:0:0:root:/root:/bin/bash ".

No promises, but I think that's happened before around here. It would be an easy mistake to make (in chapter 6.6), and difficult to detect unless you actually look for it. Anyway, no harm to find out.
 
Old 03-22-2013, 12:05 PM   #13
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: Ubuntu 12.04/12.10/13.04/LFS/Centos6.3/Debain/PCBSD/Mageia 3
Posts: 1,614
Blog Entries: 1

Rep: Reputation: 226Reputation: 226Reputation: 226
Hi

Do you get a prompt when you login???

What is the output of ls -l /bin/sh "LFS"
and ls -l /bin/bash

echo $SHELL
 
Old 03-22-2013, 12:50 PM   #14
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 301

Rep: Reputation: 60
Does /bin/bash work in chroot? You can get this error 'cannot execute /bin/bash : No such file or directory' if some of the shared libraries bash needs are missing.

From your host system run:
Code:
cd /mnt/lfs    # or whatever mountpoint you use
ldd bin/bash  # note there is no starting / before bin/bash
This is what I get:
Code:
$ ldd bin/bash
	linux-vdso.so.1 (0x00007fff411ff000)
	libreadline.so.6 => /lib/libreadline.so.6 (0x00007fbd996f4000)
	libhistory.so.6 => /lib/libhistory.so.6 (0x00007fbd994ec000)
	libncursesw.so.5 => /lib/libncursesw.so.5 (0x00007fbd99290000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fbd9908c000)
	libc.so.6 => /lib/libc.so.6 (0x00007fbd98ce7000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fbd99938000)
And for all results you get run 'ls -l' (lowercase L) excluding the starting / to see if it is there on your lfs system. Those libraries that are shown in the output of 'ldd' is from your host.

For exampel:
Code:
ls -l lib/libreadline.so.6
ls -l lib/libhistory.so.6
# ... and so on
 
Old 03-23-2013, 01:58 AM   #15
smdaudhilbe
Member
 
Registered: Feb 2013
Posts: 43

Original Poster
Rep: Reputation: Disabled
/bin/bash problem

Hi,

Dear Stoat.....

You are great as per your suggesstion, I saw fault with my /etc/passwd, it was "root:x:0:0:root:/root:/bin/bash " I changed it to "root:x:0:0:root:/root:/bin/bash"....You know my LFS works fine now...

But only thing, I wrongly configured my /etc/sysconfig/console, since I'm unable to enter any symbols like ;:'"{})(_-+/ etc.. inside my vim editor..

what ever my LFS works...I feel very very happy...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
12.4 new install grub 2 boot problem with grub put on it's own partition not on MBR james2b Ubuntu 14 12-07-2012 09:34 AM
Problem with GRUB: partition not found. Grub Rescue?? genoboss Ubuntu 117 01-04-2011 07:56 PM
Installing GRUB in another disk problem, GRUB Hangs in boot caosxxi Linux - General 7 08-26-2009 01:55 PM
installing GRUB 2, grub-install problem r00tb33r Linux - Software 1 02-26-2007 09:42 PM
Grub setup problem (/boot/grub/stage1 not found) davidas Debian 2 04-28-2004 08:13 PM


All times are GMT -5. The time now is 09:41 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration