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 06-29-2015, 06:41 PM   #1
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Rep: Reputation: Disabled
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.
 
Old 06-30-2015, 12:39 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Do you run both hard disk simultaneously?

Does Windows XP boots and runs.

For booting Linux (LFS) did you removed the XP installed hard drive?

Is that error produced by grub or Windows?
 
Old 06-30-2015, 01:22 AM   #3
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Stuck at Chapter 8. Making the LFS System Bootable

EDIT: Removed for inaccuracy.

Last edited by mralk3; 06-30-2015 at 05:45 PM.
 
Old 06-30-2015, 02:05 AM   #4
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
Hope it works for you :

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 this case (dual boot) use
Code:
grub-install /dev/sda
 
Old 06-30-2015, 04:46 AM   #5
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
Do you run both hard disk simultaneously?

Does Windows XP boots and runs.

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.

Last edited by HashNoob; 06-30-2015 at 11:33 AM.
 
Old 06-30-2015, 04:55 AM   #6
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mralk3 View Post
I might be mistaken, but....

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.
 
Old 06-30-2015, 08:44 AM   #7
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
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 =======================

======================= fstab =======================

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.

Last edited by HashNoob; 06-30-2015 at 11:38 AM.
 
Old 06-30-2015, 12:31 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
Code:
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.
 
Old 06-30-2015, 01:11 PM   #9
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by spiky0011 View Post
Code:
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)

Last edited by HashNoob; 06-30-2015 at 02:03 PM.
 
Old 06-30-2015, 02:23 PM   #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
cd $LFS/boot

run
Code:
cat config-3.19 | grep CONFIG_DEVTMPFS
Code:
cat config-3.19 | grep CONFIG_EXT4
and post your /etc/fstab file for lfs.

Is this a "USB DRIVE"?
 
Old 06-30-2015, 03:02 PM   #11
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
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

/dev/sdb2 / ext4 defaults 1 1
/dev/sdb1 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=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab
EOF

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

Then i get
root:
END HERE.

I run uname -or
3.16.0-30-generic GNU/Linux

Is that correct version.

Last edited by HashNoob; 06-30-2015 at 03:13 PM.
 
Old 06-30-2015, 03:23 PM   #12
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
That must be Ubuntu kernel.

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
 
Old 06-30-2015, 05:57 PM   #13
HashNoob
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by spiky0011 View Post
That must be Ubuntu kernel.

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) ;(

Last edited by HashNoob; 06-30-2015 at 07:45 PM.
 
Old 07-01-2015, 02:18 AM   #14
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
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.
 
Old 07-01-2015, 02:26 AM   #15
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
And primary hard drive partitions are named by Linux kernel as 'sda' and secondary as 'sdb'.

And one that boots is primary so 'sda'.

So change both kernel parameter and fdisk entry as set. Both using '/dev/sda2'.
 
  


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
stuck on chapter 6.26 of lfs 7.5 Roy_SRC Linux From Scratch 3 07-25-2014 11:40 AM
[SOLVED] Making LFS 6.8 bootable slipstreamed Linux From Scratch 3 03-22-2013 01:15 AM
error making glibc in chapter 6 LFS raza.ajmi Linux From Scratch 15 12-19-2012 03:58 AM
Stuck at Chapter 5.4, Error when making dir for Binutils 2.20 BrandonJ Linux From Scratch 6 04-02-2010 09:14 PM
Stuck on chapter 5 when building Tcl-8.4.6 For LFS-5.1 deMilo Linux From Scratch 2 06-20-2004 03:31 AM

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

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