LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-08-2013, 06:49 PM   #1
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
Exclamation Dual Booting LFS with os-prober + grub2.


If you install LFS usually you'll find that Grub2 out-of-the-box doesn't detect any other Operating systems making dual-booting rather problematic:

To solve this problem you'll need OS-Prober. Here's how to install it using the LFS standard install methods:

Source: http://ftp.de.debian.org/debian/pool...er_1.42.tar.gz

MD5SUM: 8c208654327df559884a54b69d840219

Code:
make &&
mkdir -p /var/lib/os-prober &&
mkdir -p /usr/bin &&
cp linux-boot-prober /usr/bin &&
cp os-prober /usr/bin &&
mkdir -p /usr/lib/os-prober &&
cp newns /usr/lib/os-prober &&
mkdir -p /usr/lib/linux-boot-probes/mounted &&
cp linux-boot-probes/common/* /usr/lib/linux-boot-probes &&
cp linux-boot-probes/mounted/common/* /usr/lib/linux-boot-probes/mounted &&
cp linux-boot-probes/mounted/x86/* /usr/lib/linux-boot-probes/mounted &&
mkdir -p $PKG/usr/lib/os-probes/mounted &&
cp os-probes/common/* /usr/lib/os-probes &&
cp os-probes/mounted/common/* /usr/lib/os-probes/mounted &&
cp os-probes/mounted/x86/* /usr/lib/os-probes/mounted &&
mkdir /usr/lib/os-probes/init &&
cp os-probes/init/common/* /usr/lib/os-probes/init &&
mkdir -p /usr/share/os-prober &&
cp common.sh /usr/share/os-prober &&
chmod +x /usr/share/os-prober/common.sh
To install the documentation:

Code:
mkdir -p /usr/doc/os-prober-1.42
cp -a README TODO debian/{copyright,changelog} /usr/doc/os-prober-1.42
Afterwards re-run:

Code:
grub-mkconfig -o /boot/grub/grub.cfg
And if you have any BSD, Linux, or Windows partitions they will be detected and added to the boot menu.

Enjoy.

Edit (10-09-2013)

Just realized that LFS's Grub's installation lacks a key recommended file:

Grub defaults (reflecting my personal /etc/defaults/grub)
Code:
cat > /etc/default/grub << "EOF"
# If you change this file, run grub-mkconfig -o /boot/grub/grub.cfg
# afterwards to update /boot/grub/grub.cfg.

GRUB_DEFAULT="0"
GRUB_SAVE_DEFAULT="true"
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET="false"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo LFS`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# Select the terminal output device. You may select multiple devices here,
# separated by spaces.
# Valid terminal output names depend on the platform, but may include ‘console’
# (PC BIOS and EFI consoles), ‘serial’ (serial terminal), ‘gfxterm’ (graphics-mode
# output), ‘ofconsole’ (Open Firmware console), or ‘vga_text’ (VGA text output,
# mainly useful with Coreboot).
# The default is to use the platform's native terminal output. 
GRUB_TERMINAL_OUTPUT="gfxterm"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE="1024x768x32"

# If graphical video support is required, either because the ‘gfxterm’ graphical
# terminal is in use or because ‘GRUB_GFXPAYLOAD_LINUX’ is set, then grub-mkconfig
# will normally load all available GRUB video drivers and use the one most
# appropriate for your hardware. If you need to override this for some reason,
# then you can set this option. After grub-install has been run, the available
# video drivers are listed in /boot/grub/video.lst. 
GRUB_VIDEO_BACKEND="vbe"

# Uncomment to select a font to use
GRUB_FONT_PATH="/boot/grub/DejaVuSansMono.pf2"

# Set a background image for use with the ‘gfxterm’ graphical terminal. The value
# of this option must be a file readable by GRUB at boot time, and it must end
# with .png, .tga, .jpg, or .jpeg. The image will be scaled if necessary to fit
# the screen.
#GRUB_BACKGROUND="/usr/share/grub_backgrounds/magnetar_1024x768.jpg"

# Set to ‘text’ to force the Linux kernel to boot in normal text mode, ‘keep’ to
# preserve the graphics mode set using ‘GRUB_GFXMODE’, ‘widthxheight’[‘xdepth’] to
# set a particular graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence. See gfxpayload.
#
# Depending on your kernel, your distribution, your graphics card, and the phase of
# the moon, note that using this option may cause GNU/Linux to suffer from various 
# display problems, particularly during the early part of the boot sequence. If you
# have problems, set this option to ‘text’ and GRUB will tell Linux to boot in
# normal text mode. 
GRUB_GFXPAYLOAD_LINUX="keep"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"
EOF
This was also used to load a font:

Code:
grub2-mkfont --output=/boot/grub/DejaVuSansMono.pf2 --size=24 /usr/share/fonts/dejavu/DejaVuSansMono.ttf

Last edited by ReaperX7; 10-10-2013 at 12:25 AM.
 
Old 10-09-2013, 05:53 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Thanks for this I keep my grub on a separate partition and usually edit it by hand ( I'm a glutton for punishment! ), but this looks useful, the next time I fiddle with grub I will give it a look.
 
Old 10-09-2013, 03:45 PM   #3
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
This was basically stripped from a SlackBuild and reworked for LFS.

I did come across a few issues where an existing file MIGHT pop up when attempting to create a directory during installation, but those are easily taken care of with a quick rm -rf <path/file_name> command.

I am having an issue with Grub not finding a symbol table (non-critical error) currently.

Wondering if this is from the lack of packages gnu-unifont and help2man... but not quite sure.

Last edited by ReaperX7; 10-10-2013 at 12:33 AM.
 
Old 04-28-2014, 07:02 AM   #4
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Is it certain, that BSD is detected and correctly included and really bootable from the GRUB2-screen? From open SuSE 12.3 / 13.1 only chainloading FreeBSD from ufs2 works. Do you have more information on that os-prober?

Last edited by JZL240I-U; 04-28-2014 at 09:29 AM.
 
Old 04-28-2014, 09:08 AM   #5
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Not at the moment, but I can check it out. Are you using ZFS?
 
Old 04-28-2014, 09:35 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
No, ufs2 (see my post). I tried with some "kfreebsd" commands and such, but no luck. So I'm chainloading the btx loader currently, but I'd like to find a direct way.
 
Old 04-29-2014, 02:02 AM   #7
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
OS-Prober 1.63 should detect any modern OS and provide a boot loader for it when used with Grub2.

You can get it here but you'll have to rebuild Grub2 also.

https://packages.debian.org/unstable/utils/os-prober

Other than checking for newer versions that have updated scripting, there's not much else I can recommend.

Last edited by ReaperX7; 04-29-2014 at 02:03 AM.
 
Old 04-29-2014, 09:24 AM   #8
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by ReaperX7 View Post
OS-Prober 1.63 should detect any modern OS and provide a boot loader for it when used with Grub2.
...
Regrettably not. Ubuntu's os-prober 1.63ubuntu1 output is:

Code:
/dev/sda3: unknown Linux distribution:Linux:linux
Whereas FreeBSD 10.0 resides on that /dev/sda3.
 
Old 04-29-2014, 10:11 PM   #9
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
You can always rename the output of grub-mkconfig in /boot/grub/grub.cfg in the quoted OS name. I've had to do it several times, there is a possibility you could search Google on setting up a custom script for this system as well.
 
Old 04-30-2014, 01:32 AM   #10
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by ReaperX7 View Post
You can always rename the output of grub-mkconfig in /boot/grub/grub.cfg in the quoted OS name...
Yes, I do that quite regularly when I add a new system. No reason to do all that scripting by hand, is there, when you can get it automated.

Quote:
Originally Posted by ReaperX7 View Post
...there is a possibility you could search Google on setting up a custom script for this system as well.
There are loads of descriptions, but none worked so far. And since GRUB2 is nor really good at producing informative error messages I'm quite lost.
 
  


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] Booting LFS 7.0 with grub2 ubuntudude12 Linux From Scratch 11 09-12-2016 07:14 PM
Slackware Console Resolution when Dual Booting with Another Distro's GRUB2? haziz Slackware 1 03-15-2013 03:12 AM
Dual booting ( Grub vs grub2 ) Alexvader General 2 04-16-2011 04:30 PM
Problems with dual boot, grub2 auto os prober mhbell Ubuntu 2 11-04-2009 10:11 AM

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

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