LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-01-2016, 10:43 PM   #1
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Rep: Reputation: 1
Make LFS bootable


Hi All,

I have currently setup LFS ( LFS 7.9 ) with custom modules and all looks fine so far. But needed assistance in making it bootable.

Since I am running it in a virtual machine ( OpenSuse 13.2 ), I can break, crash , restore n number of times.

I am unable to make it boot.
Goal here is to boot the machine, and have grub give me an option to boot into LFS and actual host installation ( dual boot ).

Quote:
linux-upri:/boot/grub2 # fdisk -l ( AS seen on host machine )

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0007fcd0

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 2248703 2246656 1.1G 82 Linux swap / Solaris
/dev/sda2 * 2248704 23230463 20981760 10G 83 Linux
/dev/sda3 23230464 41943039 18712576 8.9G 83 Linux

Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00021b05

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 4196351 4194304 2G 82 Linux swap / Solaris
/dev/sdb2 * 4196352 35653631 31457280 15G 83 Linux
Here, sdb2 is where I have built LFS.


fstab ( as seen when logged into chroot )

Quote:
oot:/etc# cat fstab
# 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


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

insmod ext2
set root=(hd1,2)

menuentry "GNU/Linux, Linux 4.4.2-lfs-7.9" {
linux /boot/vmlinuz-4.4.2-lfs-7.9 root=/dev/sdb2 ro
}
root:/#
Grub has been installed on /dev/sdb


So, the problem with this is, I dont have menu entry during boot to choose the lfs installation.

I have tried booting into HD2 directly but it gives error as shown in attachment.
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2016-05-02 at 9.13.01 am.png
Views:	99
Size:	7.8 KB
ID:	21672  

Last edited by avanish321; 05-01-2016 at 10:46 PM.
 
Old 05-01-2016, 11:09 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
When in your chroot, is vmlinuz-4.4.2-lfs-7.9 in /boot?
 
Old 05-01-2016, 11:14 PM   #3
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: 1
yes

Quote:
root:/boot# ls -la
total 9436
drwxr-xr-x 3 root root 4096 May 2 07:49 .
drwxr-xr-x 23 root root 4096 Apr 29 23:08 ..
-rw-r--r-- 1 root root 102905 May 2 07:38 config-4.4.2
drwxr-xr-x 5 root root 4096 May 2 07:51 grub
-rw-r--r-- 1 root root 3370294 May 2 07:38 System.map-4.4.2
-rw-r--r-- 1 root root 6168992 May 2 07:38 vmlinuz-4.4.2-lfs-7.9
 
Old 05-01-2016, 11:27 PM   #4
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: 1
Probably booting directly into HD2 will not work because of the way how fstab has been updated ( guessing ). So my main goal as of now is to update the entry of lfs so that when I reboot, I get to choose Opensuse + LFS .
 
Old 05-01-2016, 11:30 PM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
OpenSUSE is installed on /dev/sda in the vm? Presumably, grub was installed on /dev/sda when you installed OpenSUSE and /dev/sda is probably the default boot device. Thus, you would need to add the menu entry to the grub.cfg on /dev/sda2.
 
Old 05-01-2016, 11:58 PM   #6
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by weibullguy View Post
OpenSUSE is installed on /dev/sda in the vm? Presumably, grub was installed on /dev/sda when you installed OpenSUSE and /dev/sda is probably the default boot device. Thus, you would need to add the menu entry to the grub.cfg on /dev/sda2.
Yes, you are right, Opensuse is installed on /dev/sda and this is the default boot device.

I managed to update the entry by following method


edit this file on opensuse : /etc/grub.d/40_custom
with

menuentry "GNU/Linux, Linux 4.4.2-avanish-7.9" {
savedefault
insmod ext2
set root='(hd1,2)'
linux /boot/vmlinuz-4.4.2-lfs-7.9 root=/dev/sdb2 ro
}

and run this command as root.

grub2-mkconfig -o /boot/grub/grub.cfg

By doing this, I was able to get the entry updated in grub. But ended up with another error. This time kernel panic when booting into LFS.

VFS: unable to mount root fs on unknown block(0,0)
Any idea whhat went wrong here?
 
Old 05-02-2016, 01:58 AM   #7
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
Did you see this
http://www.linuxfromscratch.org/~kre...sic-kernel.txt

Code:
   # Optional, required for VMware virtual machines
   # Begin here
   Misc devices  --->
      <*> VMware VMCI Driver
   # End here
Code:
 # Optional, required for VMware virtual machines
   # Begin here[*] SCSI low-level drivers  --->
         <*>   BusLogic SCSI support (used by older VMware virtual solutions, can be optionally selected)
         <*>   VMware PVSCSI driver support (used by vSphere I think, but not by default, can be used by Player and Workstation too)
   # End here
Also I not sure but maybe you have to have "Additions" for usb in VMware?.

You also said you are using "opensuse grub" to boot They tend to use alot of modules and an intrid to boot there systems.

When using lfs grub sdb

set root=(hd1,2) should be set root=(hd0,2) IF booting from 2nd/usb drive. As grub see it as the 1st drive mbr (sda) with the root on 2nd drive sdb2

Last edited by spiky0011; 05-02-2016 at 02:29 AM.
 
Old 05-02-2016, 02:27 AM   #8
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by spiky0011 View Post
Did you see this
http://www.linuxfromscratch.org/~kre...sic-kernel.txt

Code:
   # Optional, required for VMware virtual machines
   # Begin here
   Misc devices  --->
      <*> VMware VMCI Driver
   # End here
Code:
 # Optional, required for VMware virtual machines
   # Begin here[*] SCSI low-level drivers  --->
         <*>   BusLogic SCSI support (used by older VMware virtual solutions, can be optionally selected)
         <*>   VMware PVSCSI driver support (used by vSphere I think, but not by default, can be used by Player and Workstation too)
   # End here
Also I not sure but maybe you have to have "Additions" for usb in VMware?
I installed grub by running
grub-install /dev/sda ( I did this purposefully )

I believe I managed to fix it by installing the low level drivers. So now, when I log into lfs ( My first custom built Linux yipeeee !! ), I am getting bash 4.3 prompt. None of the credentials are working. The only one that seemed to work is the one when I configured Shadow. Is this normal?

I need some assistance here now.

1. I reverted the changes made so far back to the time when I began Chapter 8. Making the LFS System Bootable. Reason : I wanted dual boot option. So I guess, I must configure grub. I am no longer able to achieve this. Can you help me on this please?
If I run grub-install /dev/sda in my chroot environment, I only get to log into my LFS system. My opensuse host is lost.
 
Old 05-02-2016, 02:32 AM   #9
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
Yes do Ch1,2,3 of BLFS 1st. Then move on to what you need/want.

yes the bash prompt is correct at 1st.
 
Old 05-02-2016, 02:40 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
For my other OS,s I just copy from there grub.cfg and put it in lfs grub.
Code:
menuentry "Centos" {
          insmod ext2
          set root='(hd0,7)'
          echo 'Loading Centos'
          linux /boot/vmlinuz-2.6.32-358.14.1.el6.i686 ro root=/dev/sda7 quiet splash nomodeset VGA=792
          initrd /boot/initramfs-2.6.32-358.14.1.el6.i686.img
}
UUID dont work in lfs grub so I use /dev/sda7. Dont for get initrd for OS.

You can install "os prober" that will assit in locating OS,s.

If you want to use opensuse grub you could build an initrd
http://www.linuxfromscratch.org/blfs...initramfs.html
 
Old 05-02-2016, 07:47 AM   #11
avanish321
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: 1
Thanks.

This is just beginning. There's still lot more to compile in BLFS. I am specifically interested in configuring GUI. Might need all of your assistance when it comes to it and I am sure members here would be there to back me up when time comes.

Closing this thread!
 
  


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
Make LFS iso bootable using isolinux tduck Linux From Scratch 10 03-10-2016 10:01 PM
Bootable medium for LFS picopek Linux From Scratch 5 04-24-2014 03:08 AM
Make bootable usb from unofficial lfs 7.4 live cd iso image AbhinavKumar Linux From Scratch 1 02-15-2014 07:38 AM
How to make my LFS-5.1 Bootable from CD ROM alihamza Linux From Scratch 4 09-29-2007 08:59 AM
bootable / install LFS nixnoobie Linux From Scratch 2 09-16-2003 03:42 PM

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

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