LinuxQuestions.org
Visit Jeremy's Blog.
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-25-2018, 06:53 PM   #1
Ultranaut
LQ Newbie
 
Registered: Apr 2016
Posts: 16

Rep: Reputation: Disabled
Exclamation LFS Grub Confusion


Hi guys, so I recently just finished up an LFS project, but I'm having some trouble with GRUB. Background: my host system is Ubuntu, which is located on /dev/sda. My LFS project is on /dev/sdb. Here's my partition info:
Code:
Device     Boot Start        End    Sectors   Size Id Type
/dev/sda1  *     2048 1953523711 1953521664 931.5G 83 Linux

Device       Start       End   Sectors  Size Type
/dev/sdb1     2048    206847    204800  100M BIOS boot
/dev/sdb2   206848   4401151   4194304    2G Linux swap
/dev/sdb3  4401152 625142414 620741263  296G Linux filesystem
It might be worth noting that I set up my second drive as a GPT table.
But when I booted, the GRUB had somehow taken up the /dev/sda drive, and Ubuntu on /dev/sdb. Booting into /dev/sda got me to the GRUB login, but when clicking my LFS distro, it says that the partition is not found. Weirdly enough, going into the sdb drive somehow allowed me to enter the LFS distro, but the Ubuntu boot is there as well???
Here is my grub.cfg:
Code:
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod ext2
set root=(hd1,3)

menuentry "GNU/Linux, Linux 4.15.3-nebula-8.2" {
        linux   /boot/vmlinuz-4.15.3-nebula-8.2 root=/dev/sdb3 ro
}
(I named my OS Nebula for funsies.)
So I guess my question is, what's going on, and how do I get everything to their right places?

Last edited by Ultranaut; 04-25-2018 at 06:59 PM.
 
Old 04-25-2018, 07:46 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
If this is a uefi computer, mixing legacy booting with efi booting can cause this. Check your boot order in your bios.
at the lfs grub prompt hit c and then ls to see what the grub sees as the lfs drive/partition and change accordingly for lfs menu
 
Old 04-25-2018, 09:03 PM   #3
Nobutarou
Member
 
Registered: May 2017
Posts: 43

Rep: Reputation: Disabled
I suggest to use Ubuntu grub.

- disallow booting from your LFS disk on BIOS.
- Edit grub.cfg on Ubuntu

Even though LFS guides to install grub, you don't need it. You can use grub on your host system.

Or simply, you can use SG2D,
https://www.supergrubdisk.org/super-grub2-disk/
 
Old 06-13-2018, 09:24 AM   #4
RoLoR
Member
 
Registered: Feb 2018
Posts: 60

Rep: Reputation: Disabled
Most easy way to go if you get to the end of (any) lfs-book at chapter 9.1

Code:
cat > /etc/lsb-release << "EOF"
LSB_VERSION="5.0"
DISTRIB_ID="Linux From Scratch"
...
Add the LSB_VERSION line and let update-grub of Ubuntu do your job of adding the lfs boot, it will be recognized and perfectly added to your grub boot menu

Doing the mentioned version number with respect to chapter LFS and Standards in the start of used lfs-book.

Note: you can skip all instructions about making a grub.cfg file in the lfs-book

Reference

Last edited by RoLoR; 06-13-2018 at 10:16 AM. Reason: Added reference about Linux Standard Base
 
Old 06-13-2018, 09:37 AM   #5
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
If you have a grub.cfg file on your LFS partition you can boot lfs from Ubuntu with a menu entry in ubuntu /etc/grub.d/40_custom and run update-grub

Code:
menuentry  LFS{
set root=(hd1,3)
configfile /boot/grub/grub.cfg
}
 
Old 06-21-2018, 01:04 AM   #6
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by Ultranaut View Post
when I booted, the GRUB had somehow taken up the /dev/sda drive, and Ubuntu on /dev/sdb.
From GRUB's perspective, "sda" (hd0) is the drive on which the bootloader is installed so that would be the expected behaviour.

Quote:
Originally Posted by Ultranaut View Post
Booting into /dev/sda got me to the GRUB login, but when clicking my LFS distro, it says that the partition is not found.
That's because you have told GRUB to look on the disk from which it has not been booted (hd1,3) so try this instead:
Code:
set root=(hd0,3)

menuentry "GNU/Linux, Linux 4.15.3-nebula-8.2" {
        linux   /boot/vmlinuz-4.15.3-nebula-8.2 root=/dev/sda3 ro
}
With this for Ubuntu:
Code:
menuentry "Ubuntu" {
        set root=(hd1,1)
        linux /vmlinuz root=/dev/sdb1 ro quiet
        initrd /initrd.img
}
But I do agree that using Ubuntu's GRUB would be simpler
 
Old 06-21-2018, 04:10 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,571
Blog Entries: 19

Rep: Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451
I would like to add that Debian-based distros update their grub.cfg files fairly often when they do a general software update. This tends to interfere with the handwritten grub.cfg file that LFS uses. That's why it's probably better not to install GRUB in LFS at all when you have this kind of multiboot setup. The developers suggest that if you do, you should have a separate boot partition and transfer all your kernels and initrds onto it.
 
  


Reply

Tags
grub 2, lfs, lfs error, ubuntu 18.04



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] confusion in LFS 7.5 - 6.10. Adjusting the Toolchain Roy_SRC Linux From Scratch 4 01-14-2015 10:36 AM
[SOLVED] [LFS 7.4] Confusion after chapter III [Ubuntu13.04] mayur_ Linux From Scratch 11 12-13-2013 11:22 PM
[SOLVED] LFS chroot enviroment user confusion.... dwmolyneux Linux From Scratch 1 06-04-2012 01:20 AM
grub confusion, not automatically loading (always goes back to grub prompt) spyghost Linux - Software 2 01-23-2012 07:00 PM
LFS-book vs LiveCD-hints Chapter 6.2 confusion AkBrian Linux From Scratch 2 03-04-2007 09:03 PM

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

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