LinuxQuestions.org
Help answer threads with 0 replies.
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-07-2013, 12:14 AM   #1
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Rep: Reputation: 24
[LFS 7.3} 8.4 GRUB Install


Phew, I've come a long way up this steep learning curve!

Need some help with the final step. Am a bit confused by the book's instructions regarding the code.

I don't have a separate boot partition and have decided to install grub in root(sda3). So the process should be as follows: Please clarify me.

Code:
$ cd /boot/grub
$ grub-install /dev/sda3
 
Old 05-07-2013, 01:25 AM   #2
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
If you don't have another bootloader that you use with chainloading, you should install grub in mbr (sda).

You don't need to cd to your grub-folder to install grub in mbr. You can run 'grub-install /dev/sda' from anywhere.
 
1 members found this post helpful.
Old 05-07-2013, 03:01 AM   #3
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by Lennie View Post
If you don't have another bootloader that you use with chainloading, you should install grub in mbr (sda).

You don't need to cd to your grub-folder to install grub in mbr. You can run 'grub-install /dev/sda' from anywhere.
Just to clarify, I install the qrub as the same location as as that of the host?
 
Old 05-07-2013, 03:19 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by DeeGee View Post
Just to clarify, I install the qrub as the same location as as that of the host?
When you reach the grub chapter you basically have 2 choices to consider:

1) Use the bootloader that your host has set up and add an entry for LFS. If you decide to do this then you can skip the grub chapters mentioned in the LFS book.

You do need to add an entry to Debian's grub configuration (run update-grub2 on your Debian box). You'll end up with a dual boot system (Debian and lfs in your case).

2) Install and configure grub as described by the LFS book.
This does have a possible down side: Debian's grub will be overwritten and become useless. If, on the other hand, Debian is only used as a temporary host (Debian will be removed once LFS is up and running) then you will have to build and configure grub as shown in the LFS book.

The configuration needs to be tailored to your needs/setup, you cannot just copy the current settings used by Debian.
 
1 members found this post helpful.
Old 05-07-2013, 04:14 AM   #5
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by druuna View Post

2) Install and configure grub as described by the LFS book.
This does have a possible down side: Debian's grub will be overwritten and become useless. If, on the other hand, Debian is only used as a temporary host (Debian will be removed once LFS is up and running) then you will have to build and configure grub as shown in the LFS book.

The configuration needs to be tailored to your needs/setup, you cannot just copy the current settings used by Debian.
I wish to go by this option. So, shall I go on by installing grub to sda (or should it be sda1)?

Thank you for the very clear explanation .
 
Old 05-07-2013, 04:23 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by DeeGee View Post
I wish to go by this option. So, shall I go on by installing grub to sda (or should it be sda1)?

Thank you for the very clear explanation .
It should be installed to the MBR (disk) and not a partition.

If the disk is assigned to sda then you need to use grub-install /dev/sda.

You did mention this being done inside a VM, this might indicate that the disk assignment might be different (vda for example). Run df -h or fdisk -l on your Debian host to show what's being used. This info might also be handy for the construction of the /boot/grub/grub.cfg file.
 
1 members found this post helpful.
Old 05-07-2013, 04:56 AM   #7
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Code:
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         973     7811072   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             973        1066      748545    5  Extended
/dev/sda3            1066        2610    12403161   83  Linux
/dev/sda5             973        1066      748544   82  Linux swap / Solaris
This is my partitioning scheme, so accordingly there's no problem and can use sda straightaway, I believe.

Also, for the grub.cfg file I'm a bit confused about some parts and their meanings.

Code:
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 3.8.1-lfs-7.3" {
        linux    /boot/vmlinuz-3.8.1-lfs-7.3 root=/dev/sda3 ro
}
EOF
As my LFS partition is sda3, I've modified the file accordingly. My problem is with the set root value. Is the current value correct?
 
Old 05-07-2013, 05:13 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You need to follow the Grub naming convention (mentioned in the book) to set the root=(hdX,Y) option:
Code:
sda1 -> hd0,1
sda2 -> hd0,2
sda3 -> hd0,3
sdb1 -> hd1,1
sdb2 -> hd1,2
etc...
LFS is using /dev/sda3 and I do not see a separate /boot partition:
Code:
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,3)
menuentry "GNU/Linux, Linux 3.8.1-lfs-7.3" {
        linux    /boot/vmlinuz-3.8.1-lfs-7.3 root=/dev/sda3 ro
}
EOF
 
2 members found this post helpful.
  


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
[SOLVED] Fix lfs grub spiky0011 Linux From Scratch 12 12-25-2011 09:58 AM
[SOLVED] grub 1.99 in LFS???? devilboy09 Linux From Scratch 18 11-11-2011 07:41 PM
error in 6.34 grub lfs-6 sharmashikha Linux From Scratch 1 07-05-2005 08:22 AM
Adding LFS to GRUB dinolinux Linux - Software 5 06-30-2005 11:06 AM
Grub install LFS 5.x cuco76 Linux From Scratch 5 07-02-2004 04:29 PM

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

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