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 07-02-2020, 09:32 AM   #1
srirev
LQ Newbie
 
Registered: Jul 2020
Posts: 2

Rep: Reputation: Disabled
LFS multi booting with Grub and UEFI


My goal was to get LFS 9.1 (http://www.linuxfromscratch.org/lfs/...S-BOOK-9.1.pdf ) running with multi boot option in my personal laptop along with current ubuntu setup.

Finally I am able to get LFS booted, but have lots of questions on booting sequence. Let me explain the steps performed.


My Host laptop setup as follows:
Dell laptop ; it came with WIN 7; but later uninstalled WIN7 and installed Ubuntu 18 from a live USB stick;Single HDD of 1TB with 2 partitions.

In my host Ubuntu apart from loopX( 0 – 17) partitions the 2 HDD partitions are,


/dev/sda1 mounted on => /boot/efi

/dev/sda2 mounted on /

Boot mode : set to UEFI with secure ON ( this could be due to old windows installation ); it was also confirmed with command => ‘ls /sys/firmware/efi’ returning directory listing as available.

LFS build + configuration: Created a new partition on my HDD as /dev/sda3 for lfs root partition and followed the instructions as per the book, until chapter #7 end without any glitches.

Chapter #8 was a bit tough due to my limited knowledge on boot options. Before getting to chapter #8 instructions, I executed the “ mount –bind /boot /mnt/lfs/boot” as per chroot prerequsites. I am not clear is this really required for my setup?


LFS’s /etc/fstab looks as below: [ in the fstab, swap was ignored as
----------------------------------------------
root@srinivas-Inspiron-5567:/mnt/lfs/etc# cat fstab
# Begin /etc/fstab
# file system mount-point type options dump fsck
# order
/dev/sda3 / ext4 defaults 1 1
/dev/sda1 /boot/efi vfat defaults 0 1
/swapfile none swap sw 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 devtmpf mode=0755,nosuid 0 0
#End /etc/fstab

root@srinivas-Inspiron-5567:/mnt/lfs/etc#
----------------------



For the 8.3 section in the book, first “make defconfig” was issued , followed by “make menuconfig” with default options, make modules_install. Also copied the bZImage, System.map, config files to /boot folder. I could see CONFIG_EFI_STUB=y in my .config file, which confirms that kernel is enabled with UEFI.

As the mount bind is done for /boot with /mnt/lfs/boot, I see the files of my host ubuntu’s /boot inside chroot of LFS’s /boot. Is this ok?


8.4 section was complete overwhelming as I was not clear about Grub and UEFI. I executed the command "grub-install /dev/sda –target i386-pc", but it failed.


After few attempts of googling, I tried grub-update from my Ubuntu host. This has updated my ubuntu’s grub.cfg file with entries from lfs also. Fortunately I had taken backup of my original ubuntu’s grub.cfg.


Original-grub.cfg file:
-------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_IN
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=hidden
set timeout=0
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep --interruptible 0 ; then
set timeout=0
fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=1
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
linux /boot/vmlinuz-5.3.0-61-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro quiet splash $vt_handoff
initrd /boot/initrd.img-5.3.0-61-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
menuentry 'Ubuntu, with Linux 5.3.0-61-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-61-generic-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.3.0-61-generic ...'
linux /boot/vmlinuz-5.3.0-61-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-5.3.0-61-generic
}
menuentry 'Ubuntu, with Linux 5.3.0-61-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-61-generic-recovery-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.3.0-61-generic ...'
linux /boot/vmlinuz-5.3.0-61-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-5.3.0-61-generic
}
menuentry 'Ubuntu, with Linux 4.18.0-15-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 4.18.0-15-generic ...'
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.18.0-15-generic
}
menuentry 'Ubuntu, with Linux 4.18.0-15-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-recovery-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 4.18.0-15-generic ...'
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.18.0-15-generic
}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


Updated grub.cfg file after update-grub command:
-------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_IN
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=hidden
set timeout=0
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep --interruptible 0 ; then
set timeout=0
fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=1
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda2 ro quiet splash $vt_handoff
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
menuentry 'Ubuntu, with Linux 5.5.3-lfs-9.1' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.5.3-lfs-9.1-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.5.3-lfs-9.1 ...'
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda2 ro quiet splash $vt_handoff
}
menuentry 'Ubuntu, with Linux 5.5.3-lfs-9.1 (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.5.3-lfs-9.1-recovery-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.5.3-lfs-9.1 ...'
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda2 ro recovery nomodeset
}
menuentry 'Ubuntu, with Linux 5.3.0-61-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-61-generic-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.3.0-61-generic ...'
linux /boot/vmlinuz-5.3.0-61-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-5.3.0-61-generic
}
menuentry 'Ubuntu, with Linux 5.3.0-61-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-61-generic-recovery-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 5.3.0-61-generic ...'
linux /boot/vmlinuz-5.3.0-61-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-5.3.0-61-generic
}
menuentry 'Ubuntu, with Linux 4.18.0-15-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-advanced-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 4.18.0-15-generic ...'
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.18.0-15-generic
}
menuentry 'Ubuntu, with Linux 4.18.0-15-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-recovery-7d15f6ce-fd74-42c7-a588-881a391afd77' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 7d15f6ce-fd74-42c7-a588-881a391afd77
else
search --no-floppy --fs-uuid --set=root 7d15f6ce-fd74-42c7-a588-881a391afd77
fi
echo 'Loading Linux 4.18.0-15-generic ...'
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=7d15f6ce-fd74-42c7-a588-881a391afd77 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.18.0-15-generic
}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Linux From Scratch (9.1) (on /dev/sda3)' --class linuxfromscratch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-90a0119c-ef0a-4f33-a9da-ddcb69bb8466' {
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
else
search --no-floppy --fs-uuid --set=root 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda3
}
submenu 'Advanced options for Linux From Scratch (9.1) (on /dev/sda3)' $menuentry_id_option 'osprober-gnulinux-advanced-90a0119c-ef0a-4f33-a9da-ddcb69bb8466' {
menuentry 'Linux From Scratch (9.1) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.5.3-lfs-9.1--90a0119c-ef0a-4f33-a9da-ddcb69bb8466' {
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
else
search --no-floppy --fs-uuid --set=root 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
fi
linux /boot/vmlinuz-5.5.3-lfs-9.1 root=/dev/sda3
}
menuentry 'Linux From Scratch (9.1) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.5.3-lfs-9.1--90a0119c-ef0a-4f33-a9da-ddcb69bb8466' {
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
else
search --no-floppy --fs-uuid --set=root 90a0119c-ef0a-4f33-a9da-ddcb69bb8466
fi
linux /vmlinuz-5.5.3-lfs-9.1 root=/dev/sda3
}
}

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


After reboot I am able to see grub menu options for multi boot and able to choose LFS and it boots as expected with root. That’s cool, but now i am not excited due to below question.


The big question is that, I could not understand how the grub-eufi worked on “update-grub’ command. Please some one help to me to understand the basics here and how it worked in my laptop.


Note:

- My LFS doesn’t shutdown properly when root#shutdown –f now’ command is given. What is missing here?
 
Old 07-02-2020, 02:56 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,371

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Quote:
If the host system has a separate /boot partition,
is when
Quote:
“ mount –bind /boot /mnt/lfs/boot”
is recommended but not necessary. The efi partiiton is not a separate boot partition, I wouldn't recommend running this command even if you do have a separate a /boot partition. At the beginning of chapter 8.4 did you see this for efi systems:
Quote:
see the lfs-uefi.txt hint at http://www.linuxfromscratch.org/hint...s/lfs-uefi.txt.
as the grub built in chapter 6 won't work on an efi system. You don't really need to run grub-install on a system where lfs is duel booting with another linux distro. Running update-grub in your ubuntu should pick up your lfs system. If I was wanting to install lfs grub bootloader to the efi partition I would add the --no-nvram to the grub-install command to keep ubuntu grub in charge of booting the system

Last edited by colorpurple21859; 07-02-2020 at 03:04 PM.
 
  


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
best practice Multihead, multi-screen, multi-display or multi-monitor-Debian 8 lgtrean Linux - Software 1 10-14-2015 09:53 AM
Multi-booting with UEFI Amaranth14 Linux - General 4 12-18-2014 12:41 PM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
[SOLVED] what's the difference between a multi-cpu , multi-core and a multi-thread system ? entz Linux - Hardware 11 12-20-2011 04:49 PM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM

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

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