LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-09-2016, 07:38 AM   #1
lfs_novice
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Rep: Reputation: Disabled
ch.8.4 continue in chroot environment? and hwo to change GRUB conf


I'm not quiet sure whether to continue in chroot or if I shall logout and start with the GRUB stuff in the host system, including installing libisoburn

Second question is: how to change the existing GRUB configuration?
 
Old 04-09-2016, 08:14 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
I boot my LFS as soon as the kernal and grub is done, then back into chroot to build X so I have a working desktop to use.

Grub, you can just a entry into the grub.cfg that you are using
 
Old 04-09-2016, 09:29 AM   #3
lfs_novice
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Hi,

I didn't understand. May be the chroot is not clear to me. But I thought, when Grub is done then I can boot the LFS System and I don't need the chroot there anymore.

But coming back to the question I have originally - On my PC there is a grub configuration already existing. It came with the installation of the host system automatically. Thats the one I have to change I believe. So I should logout of the chroot and add the new OS to the existing grub configuration. Am I right?

Thanks!
 
Old 04-09-2016, 09:35 AM   #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
Yes you need to update grub on the host it should find your LFS install and add it,

Regards chroot yes you can login into your LFS but it is a minimal system (command line only) You can re chroot in and build more of the system in chroot while using the host desktop as you are doing now, The choice is yours.
 
Old 04-09-2016, 10:50 AM   #5
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Agreeing with everything above, I just wanted to add a couple of comments. If you choose to update your main GRUB config to boot your new LFS system and begin working on BLFS in it (instead of via chroot in your host system), that's a fine idea and one that many people here do. But...remember that at first you will be staring only at a terminal screen command prompt. There will be no way to read the book (except with another computer) and no mouse pointer to copy and paste commands. To continue on with BLFS packages in that situation, you should install a text-based browser like Lynx and the GPM mouse daemon (both are simple installs). Then you can use Lynx in your LFS system to open the BLFS book (either online or downloaded), read the instructions for packages, highlight commands with the mouse pointer, and in another terminal (F2, F3, and so on) paste them into the command prompt to run them. If your LFS system is connected to the Internet, Lynx can download tarballs, too. I used to do all that a lot (now I build entirely with unattended scripts). WARNING: Text-based browsers like Lynx are not exactly intuitive to use and take some time to get used to. But like anything else new and different, it is easy once you learn.

P.S.: After installing the browser and mouse daemon, I recommend first doing the chapter three stuff to create a non-root user, startup files, and config files. Then install iptables and configure a firewall if your LFS system is connected to the Internet. Sudo also will be very handy. After that, go to it.

Last edited by stoat; 04-09-2016 at 11:03 AM.
 
Old 04-09-2016, 11:47 AM   #6
lfs_novice
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
well - I don't got it. I expected after ch. 8.3 in ch. 8.4 to change the grub menu to be able to boot the new LFS the first time. Just to see if it works or not. In Ch. 8.4.1. Introduction I did the steps on the host system - not in chroot environment.
Now in ch. 8.4.3 it says, it is recommended to have a separate partition for /boot - thats the case an here is the content (in chroot)

Quote:
root:/boot# ls
System.map-4.5 config-4.5 lost+found vmlinuz-4.5-lfs-7.9-systemd
root:/boot#
the /boot partition is mounted via fstab (for the LFS system not the host system)

Quote:
# Begin /etc/fstab

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

/dev/sda3 / ext4 defaults 1 1
/dev/sda5 swap swap pri=1 0 0
/dev/sda7 /boot ext4 defaults 1 1
/dev/sda8 /usr/src ext4 defaults 1 1
/dev/sda9 /tmp ext4 defaults 1 1
/dev/sda10 /home ext4 defaults 1 1
/dev/sda11 /usr ext4 defaults 1 1
/dev/sda12 /opt ext4 defaults 1 1
/dev/sda6 /mnt/daten vfat noauto,user,quiet,showexec,iocharset=ISO-8859-15,codepage=850 1 1

# End /etc/fstab
I don't understand the next steps:
Quote:
Install the GRUB files into /boot/grub and set up the boot track: ...
The LFS Book gives a warning to "... overwrite the current boot loader..." I don't want that because I have
a grub.cfg file on the host system already and thought I have to change this in order to get a new menu entry.

I says
Quote:
grub-install /dev/sda
My LFS system is on sda4 the boot partition is sda7

what needs to be done to the add the sda4 to the existing grub.cfg or am I totally wrong? The existing grub.cfg file say at the beginning not to change the file manually but using grub-mkconfig

Quote:
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
But the LFS book says not to use grub-mkconfig. I have no idea what to do next.

Thanks in advanced!
 
Old 04-09-2016, 12:16 PM   #7
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
If you want your Ubuntu GRUB to boot your new LFS system, then you don't really have to do anything in section 8.4.
Quote:
Originally Posted by LFS Book Section 8.4.1

Warning

Configuring GRUB incorrectly can render your system inoperable without an alternate boot device such as a CD-ROM. This section is not required to boot your LFS system. You may just want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or LILO.
So try doing whatever Ubuntu does to update its GRUB configuration (I have no idea). Theoretically, it is supposed to find your new LFS boot partition and update the Ubuntu GRUB config to boot the LFS system. If it doesn't, there is a way to add a custom entry manually to the Ubuntu GRUB config. Ubuntu people need to comment now.

Quote:
Originally Posted by lfs_novice

I don't understand the next steps:
Quote:
Install the GRUB files into /boot/grub and set up the boot track: ...
The LFS Book gives a warning to "... overwrite the current boot loader..." I don't want that because I have
a grub.cfg file on the host system already and thought I have to change this in order to get a new menu entry.

I says
Quote:
grub-install /dev/sda
That right there will bust your Ubuntu GRUB boot loader. You're right not to desire that at this time.

Last edited by stoat; 04-10-2016 at 09:39 AM. Reason: I originally said chapter 8 was optional when I meant only section 8.4 of chapter 8!
 
Old 04-09-2016, 12:44 PM   #8
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
I'm not sure what made me think your host is Ubuntu. You didn't mention Ubuntu here. Sorry. Whatever your host system is, it almost certainly uses GRUB2 and has a way to add LFS to its boot menu, either automatically or manually.
 
Old 04-09-2016, 12:46 PM   #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
You can run a test grub.cfg file.

grub-mkconfig -o /home/user/test.cfg

that will generate a test"grub".cfg in /home/user see if it finds LFS

or grub-mkconfig | less

will print on screen you can scroll through it

Last edited by spiky0011; 04-09-2016 at 12:47 PM.
 
Old 04-10-2016, 12:02 PM   #10
lfs_novice
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Yes - stoat - you are right the host system is Ubuntu

the command
Quote:
grub-mkconfig -o /home/user/test.cfg
returns a very complex file with an "unknown linux distribution" on /dev/sda4

If I got you right I should do nothing right now and just skip Ch. 8.4. But how can I check whether the new LFS- system is working or not?
I tried to run just the grub-mkconfig. It realized the unknown linux distribution as well but there is no menuitem in the boot menu for it - not in the boot menu an not in /boot/grub/grub.cfg.
 
Old 04-10-2016, 01:44 PM   #11
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
ok that just gives you a copy of grub.cfg so it wouldn't touch the 1 you are using "a test". You can run
Code:
grub-mkconfig -o /boot/grub/grub.cfg
that will change the /boot/grub/grub.cfg file then run update-grub.

https://help.ubuntu.com/community/Grub2/Setup
 
Old 04-12-2016, 01:00 AM   #12
lfs_novice
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Thumbs up

Yeep - Up and running! Thanks for your help!!

Finally - after unmounting all LFS- Partitions an redo the grub-mkconfig and update-grub it is booting and all other OS are still working!

Only problem I found so far is the keyboard layout. I need the German qwertz layout. But this is an other case.

Thanks again!
 
Old 04-12-2016, 03:58 AM   #13
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Here's my suggestion:

If you are using a host system on the same disk:

Exit chroot and run your native system's bootloader configuration utility and let it add LFS itself.

If you are using LFS on a separate disk such as /dev/sdb from the host such as /dev/sda then while inside chroot run this command sequence:

Code:
mkdir -vp /boot/grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sdb
Grub-mkconfig works. If you need tighter controls, create a proper /etc/default/grub file and rerun the commands.
 
  


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
chroot shell script logout and continue Garrett85 Linux From Scratch 3 10-10-2012 10:02 AM
Change boot order in grub.conf file lmcilwain Fedora 3 07-12-2006 12:33 AM
Grub.conf = how to change to root=LABEL=\ Eileen Fedora 6 05-18-2006 01:31 PM
where is my grub.conf? (multi-boot environment) zecodela Linux - Newbie 5 10-23-2004 02:38 AM
how to access and change grub.conf? kamaboko Linux - Newbie 2 04-24-2004 05:37 AM

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

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