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 01-18-2014, 03:47 PM   #1
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Rep: Reputation: Disabled
grub-install: "source_dir doesn't exist..."


All,

I'm working on booting a recently compiled/installed LFS system using UEFI. The reason for choosing UEFI versus Legacy is that the system currently has both Win7 (on a separate SATA Harddrive 0) and RHEL 6.5 (separate SATA Harddrive 1) installed; each of which boots via UEFI, and as I understand UEFI/Legacy boot operations, I must choose one or the other for all OSes on the system (do correct me if I am in error). At any rate, if I can get it to run UEFI or Legacy, I'm open to either, but as the system current stands, on all occasions I seem to be unable to install GRUB2 on the chrooted LFS system (installed on SATA Harddrive 4):

Code:
root:/# grub-install /dev/sdb
source_dir doesn't exist. Please specify --target or --directory
Seeing no other recourse, I then attempted research into using UEFI:

https://wiki.archlinux.org/index.php/GRUB2
http://wiki.gentoo.org/wiki/GRUB2
https://help.ubuntu.com/community/UEFIBooting
http://www.mailinglistarchive.com/ht.../msg00268.html

However, grub-install still seems to fall short of expected operations:

Code:
root:/# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=squeektoy --recheck --debug
source_dir doesn't exist. Please specify --target or --directory
root:/# grub-install --target=grub-efi-i386 --efi-directory=/boot/efi --bootloader-id=squeektoy --recheck --debug
source_dir doesn't exist. Please specify --target or --directory
Verifying releavant kernel configuration options:

Code:
CONFIG_CMDLINE_BOOLEAN=y
CONFIG_CMDLINE="root=/dev/sda2"
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_FB_EFI=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_RELOCATABLE=y
CONFIG_EFI_VARS=y
CONFIG_EFIVAR_FS=y
Parted (excerpt):

Code:
[root@localhost alpo]# parted -l

. . .

Model: ATA Hitachi HTS72505 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  211MB   210MB   fat16                 boot   #flagged as EFI System Partition
 2      211MB   735MB   524MB   ext4
 3      735MB   22.2GB  21.5GB  ext4
 4      22.2GB  130GB   107GB   ext4
 5      130GB   147GB   17.2GB  linux-swap(v1)

. . .
The corresponding fstab file (from chrooted LFS system):

Code:
root:/# cat /etc/fstab
# Begin /etc/fstab
# file system mount-point type options dump fsck
# order

/dev/sdb3  /         ext4  defaults 1 1
/dev/sdb4  /home     ext4  defaults 1 1
/dev/sdb2  /boot     ext4  defaults 1 1
/dev/sdb1  /boot/efi vfat  defaults 1 1
/dev/sdb5  swap swap pri=1 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 devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab
Any ideas/input would be greatly appreciated!

Last edited by alpo85; 01-18-2014 at 04:13 PM.
 
Old 01-18-2014, 07:43 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
hi

My understanding is that if you have enforced UEFI in the bios, you must have
/boot/efi
on each disk, but you don't appear to show that?

2) according to https://wiki.archlinux.org/index.php/GRUB2#UEFI_systems
you are supposed to have that partition formatted as fat32 and your output suggest fat16 altho you have tried to create an fstab using fat32.

3) I am not an expert in this area but if you have not enforced UEFI in bios then it is still possible to use normal grub or normal grub2
with a chainloader entry to get windows to boot.

so for example

set boot order to sdb.....and assumes you can do that or swap cables if you can't

grub to MBR of sdb

windows entry for grub legacy something like

Quote:
title chainload
root (hd1)
chainloader +1
for grub2 something like

Quote:
menuentry "chainload" {
insmod ntfs
set root='hd1'
chainloader +1
)
if of course you find you are forced to use UEFI then maybe another link might help?
http://www.linux.com/learn/tutorials...e-ancient-mbr-

other than that I shall slink away
 
1 members found this post helpful.
Old 01-18-2014, 08:20 PM   #3
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
Apparently (and unfortunately) UEFI with LFS is allegedly a "bleeding-edge" issue: https://www.mail-archive.com/lfs-sup.../msg20974.html

That in mind, I can now boot into GRUB2, but I am unable to tell whether the kernel image is loaded:

Code:
grub > linux (hd2,gpt2)/vmlinuz-3.10.26-lfs-7.4 root=/dev/sdb3
error: no suitable video mode found.
Booting in blind mode.
After that, the computer seems to sit idle. More to the method of how this was resolved later, but first...

Thanks for the feedback, aus9. As you mentioned,

Quote:
My understanding is that if you have enforced UEFI in the bios, you must have
/boot/efi on each disk, but you don't appear to show that?
Recall from fstab above,

Code:
/dev/sdb2  /boot     ext4  defaults 1 1
/dev/sdb1  /boot/efi vfat  defaults 1 1
...the EFI system partitions seem to be mounted appropriately:

Code:
root:/boot# find
.
./config-3.10.26
./System.map-3.10.26
./lost+found
./grub
./efi
./efi/EFI
./efi/EFI/grub
./efi/EFI/grub/grub_x64.efi
./efi/EFI/grub/grub.cfg
./vmlinuz-3.10.26-lfs-7.4
...and there is an UEFI partition on my RHEL6 drive:

Code:
Model: ATA WDC WD5000AZLX-0 (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  211MB  210MB  fat16              boot         <--Right here.
 2      211MB   735MB  524MB  ext4
 3      735MB   500GB  499GB                     lvm
That said, converting the partition from the current fat16 to fat32 is an option, but since I can boot to grub; for the time being I may forgo such a conversion. Also, my current RHEL6 is partitioned with fat16 and UEFI works like a bandit.

Also per your suggestion:

Quote:
if you have not enforced UEFI in bios then it is still possible to use normal grub or normal grub2
Unfortuately for this new LFS system, UEFI is enabled and is the current method for booting into Win7 or RHEL6, with which I will remain.

Lastly, thanks for the link - you have indeed been helpful.

* * *

As to the matter of still not being able to boot, the additional steps taken were the following:

1) Uninstalled and recompiled GRUB2 with "--with-platform=efi" option:

Code:
root:/# time { clear && echo Extracting and Compiling GRUB2... && tar -xvJf grub-2.00.tar.xz >> ./logs/grub-install.log && \
cd grub-2.00 && sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h && echo Configuring... && \
./configure --with-platform=efi \
--prefix=/usr \
--sysconfdir=/etc \
--disable-grub-emu-usb \
--disable-efiemu \
--disable-werror >> ../logs/grub-install.log 2>> ../logs/grub-install.log && echo Make... && \
make -j32 >> ../logs/grub-install.log 2>> ../logs/grub-install.log && echo Make Install... && \
make -j32 install >> ../logs/grub-install.log 2>> ../logs/grub-install.log; }
2) Ran grub-mkimage and grub-mkconfig and copied the files to the EFI partition:

Code:
root:/# cd /sources/grub-2.00/grub-core
root:/# /usr/bin/grub-mkimage -p=/boot/efi/EFI/grub -d /usr/lib/grub/x86_64-efi \
		-O x86_64-efi -o grub_x64.efi boot linux part_gpt fat ext2 normal \
		configfile lspci ls reboot datetime loadenv search lvm help
root:/# cp grub_x64.efi /boot/efi/EFI/grub
root:/# grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
Configured UEFI through the host machine:

Code:
[root@localhost ~]# efibootmgr --create --disk /dev/sdb --part 1 \
--write-signature --loader "\EFI\grub\grub_x64.efi" \
--label "SqueekToy Linux"
Once I saw the "no suitable video mode found" error, I recompiled the kernel with these options:

Code:
CONFIG_VGA_ARB=y
CONFIG_FB_VGA16=y
CONFIG_FB_UVESA=y
CONFIG_FB_VESA=y
CONFIG_FB_EFI=y
Then, uninstalled, recompiled, and re-installed GRUB2; re-ran grub-mkimage and grub-mkconfig; all to no avail.

So, here I sit, stuck with "no suitable video mode found."

Thanks in advance for your input and wisdom.

Last edited by alpo85; 01-18-2014 at 08:23 PM.
 
Old 01-19-2014, 12:03 AM   #4
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
So, partially resolved.

Though GRUB now loads the kernel image, the system halts right after an OS selection is made:

Code:
Loading Linux 3.10.26-lfs-7.4...
_
So that GRUB could at least load the image, I reinstalled GRUB, and ran "grub-install" from the /sources/grub-2.00 directory which seemed to have an effect:

Code:
root:/# tar -xvJf grub-2.00.tar.xz >> ../logs/grub-install.log 
root:/# cd grub-2.00
root:/# sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h
root:/# ./configure --with-platform=efi \
> --prefix=/usr \
> --sysconfdir=/etc \
> --disable-grub-emu-usb \
> --disable-efiemu \
> --disable-werror >> ../logs/grub-install.log 2>> ../logs/grub-install.log
root:/# make -j >> ../logs/grub-install.log 2>> ../logs/grub-install.log
root:/# make -j install >> ../logs/grub-install.log 2>> ../logs/grub-install.log
root:/sources/grub-2.00# grub-install --target=x86_64-efi /dev/sda
/usr/sbin/grub-install: line 831: which: command not found
Installation finished. No error reported.
root:/sources/grub-2.00# grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.10.26-lfs-7.4
done
root:/# cp /boot/efi/EFI/grub/grub.cfg /boot/grub
That said, to help alleviate the error, I re-ran the kernel configuration using "make defconfig" and updated a minimal number of specific options through "make menuconfig." After that, I recompiled the kernel and rebooted whereupon GRUB again loaded the correct kernel image, but the system immediately halted.

While the problem with GRUB appears to be resolved, a new problem in loading the kernel looms ahead.

Anyone have any general ideas of why the system is stopping?
 
Old 01-19-2014, 12:58 AM   #5
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
video mode have you considered this link

https://wiki.archlinux.org/index.php...found.22_error

also it might help if you upload your grub.cfg and link to it?

in particular does LFS have this grub.cf snippet?

Quote:
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
lower down you will need
insmod font

instead of a script function you could simply use one line commands and see which one works
try
insmod efi_gop
insmod font
reboot to test and if it fails try
insmod efi_uga
insmod font

I have a 32 systen non-UEFI so I actually lack those modules
 
1 members found this post helpful.
Old 01-19-2014, 10:27 PM   #6
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
It might not be UEFI specific but I posted some info here you might find useful for setting up grub2's default file in /etc/defaults/grub

http://www.linuxquestions.org/questi...ed-4175488179/
 
1 members found this post helpful.
Old 01-20-2014, 01:06 PM   #7
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
aus9,

Thanks for the reply. I apologize for the slight tardiness - I've been working on this quite diligently for the last 24-48 hours.

Reaper7X,

Thank you for your input - I actually don't seem to have that file in /etc/defaults/:

Code:
root:/etc/default# ls -la
total 12
drwxr-xr-x  2 root root 4096 Jan 16 15:25 .
drwxr-xr-x 12 root root 4096 Jan 19 17:03 ..
-rw-r--r--  1 root root  118 Jan 16 15:25 useradd
root:/etc/default#
This missing file may be an clue as to an interesting interaction I'm getting with GRUB. See ****** below...

So, after recompiling and re-installing GRUB, I'm now getting:

Code:
   Booting a command list

Loading Linux 3.10.26-lfs-7.4...
_
The "_" appears to be a non-blinking cursor and again, I have no kernel output.

*********
Here's the really interesting thing, if I copy the LFS Kernel image file and the System Map file to the Red Hat /boot partition, I can boot via UEFI to the Red Hat GRUB, call the LFS Kernel, and the LFS system boots just fine. But, if I try to boot via UEFI directly to the GRUB on my LFS /boot partition, I get the above output and the system halts. Correct me if I'm wrong, but I believe that this tells me that the Kernel is fine. What might this indicate?

It should be noted, however, the RHEL6.5 system is partitioned with LVMs (with the exception of /boot and /boot/efi), whereas LFS is standard partitions (also, I changed /boot/efi to fat32, per the UEFI spec).
*********

At any rate, here's the grub.cfg file:

Code:
#
# 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
  load_env
fi
set default="0"

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 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 loadfont unicode ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/vg_sqt-lv_root' {
	load_video
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
	else
	  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
	fi
	echo	'Loading Linux 3.10.26-lfs-7.4 ...'
	linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
}
submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/vg_sqt-lv_root' {
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-advanced-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
	}
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4 (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-recovery-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro single 
	}
}

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

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

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

### 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 ###

### BEGIN /etc/grub.d/i386-00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"

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 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 loadfont unicode ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/i386-00_header ###

### BEGIN /etc/grub.d/i386-10_linux ###
menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/vg_sqt-lv_root' {
	load_video
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
	else
	  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
	fi
	echo	'Loading Linux 3.10.26-lfs-7.4 ...'
	linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
}
submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/vg_sqt-lv_root' {
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-advanced-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
	}
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4 (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-recovery-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro single 
	}
}

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

### BEGIN /etc/grub.d/i386-20_linux_xen ###
### END /etc/grub.d/i386-20_linux_xen ###

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

### BEGIN /etc/grub.d/i386-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/i386-40_custom ###

### BEGIN /etc/grub.d/i386-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/i386-41_custom ###

### BEGIN /etc/grub.d/x86_64-00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"

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 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 loadfont unicode ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/x86_64-00_header ###

### BEGIN /etc/grub.d/x86_64-10_linux ###
menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/vg_sqt-lv_root' {
	load_video
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
	else
	  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
	fi
	echo	'Loading Linux 3.10.26-lfs-7.4 ...'
	linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
}
submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/vg_sqt-lv_root' {
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-advanced-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro  
	}
	menuentry 'GNU/Linux, with Linux 3.10.26-lfs-7.4 (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.26-lfs-7.4-recovery-/dev/mapper/vg_sqt-lv_root' {
		load_video
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  caad3563-6c2c-425a-9c00-aa3563f8388d
		else
		  search --no-floppy --fs-uuid --set=root caad3563-6c2c-425a-9c00-aa3563f8388d
		fi
		echo	'Loading Linux 3.10.26-lfs-7.4 ...'
		linux	/vmlinuz-3.10.26-lfs-7.4 root=/dev/mapper/vg_sqt-lv_root ro single 
	}
}

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

### BEGIN /etc/grub.d/x86_64-20_linux_xen ###
### END /etc/grub.d/x86_64-20_linux_xen ###

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

### BEGIN /etc/grub.d/x86_64-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/x86_64-40_custom ###

### BEGIN /etc/grub.d/x86_64-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/x86_64-41_custom ###
Thank you kindly for both of your input - you continue to be most helpful.

Last edited by alpo85; 01-20-2014 at 01:49 PM.
 
Old 01-20-2014, 03:13 PM   #8
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
Call me crazy, but...

The boot process sequentially loads UEFI first; then GRUB; then the kernel. If that's true, with what I'm seeing above, then...

1) It's not UEFI (UEFI calls LFS's GRUB, and this GRUB loads just fine).
2) It's not the LFS kernel (the LFS kernel boots when called by RHEL's GRUB).

In other words, LFS's GRUB isn't loading the kernel...?
 
Old 01-20-2014, 05:43 PM   #9
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
and AFAIK 64 bit UEFI is supported but have not seen much success with 32 bit

and yet your grub.cfg seems to have a mixture of 32 bit and 64 bit
------is this 2 joined grub.cfgs

otherwise that might be the answer right there?

trivia
I found this link interesting
http://www.rodsbooks.com/linux-uefi/

and I quote from it
Quote:
I have yet to encounter a 32-bit Linux distribution that officially supports EFI,
 
1 members found this post helpful.
Old 01-20-2014, 08:59 PM   #10
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
On some systems EFI booting isn't working still for Linux so you might need this patch:

http://mirrors.slackware.com/slackwa....times.diff.gz

Apply as such:

Code:
zcat ../grub.e75fdee420a7ad95e9a465c9699adc2e2e970440.terminate.efi.several.times.diff.gz | patch -p1 --verbose || exit 1
Slackware has a few extra configuration steps for their UEFI booting Grub2 here in the SlackBuild so you might want to see what they're doing and possibly backport it to LFS:

http://mirrors.slackware.com/slackwa...source/a/grub/
 
1 members found this post helpful.
Old 01-21-2014, 06:55 PM   #11
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
aus9 and ReaperX,

Apologies for the tardy post - I finally got this thing working. Unfortunately, UEFI was a no-go, but I did end up getting it to work through a BIOS boot. Of particular note was that the kernel device driver configuration was in need of a major overhaul (perhaps now I can go back and try to do an EFI boot, if I ever feel froggy enough).

Here's how I did it:

1) Create an MBR partition table on the target drive (with fstab), so the table now looks like this:

Code:
[root@localhost ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00082ae8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2000     1026000      512000+  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2         1028160   946340954   472656397+  83  Linux
/dev/sdb3       946340955   976768064    15213555   82  Linux swap / Solaris
Note the boot flag on sdb1 and the start sector of sdb1 at sector 2000 (as opposed to 1 or 63). This decision is based on the GNU GRUB2 User Manual, linked here: http://www.gnu.org/software/grub/man...S-installation

After copying the LFS system files to the new partitions, I uninstalled the current GRUB2 installation; recompiled and re-installed GRUB2 under the i386-pc platform, like so:

Code:
#! /bin/bash
clear && \
cd /sources/grub-2.00 && \
echo Uninstalling Previous Version... && \
make -j uninstall >> ../logs/grub2-install.log 2>> ../logs/grub2-install.log
echo Removing Old Source Directory... && \
cd /sources
rm -rf grub-2.00 && \
echo Extracting Grub2... && \
tar -xvJf grub-2.00.tar.xz > /dev/null && \
cd grub-2.00 && \
sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h && \
echo Configuring... && \
./configure --prefix=/usr \
--with-grub-mkfonts \
--sysconfdir=/etc \
--disable-grub-emu-usb \
--disable-efiemu \
--disable-werror > ../logs/grub2-install.log 2>> ../logs/grub2-install.log && \
echo Running Make... && \
make -j >> ../logs/grub2-install.log 2>> ../logs/grub2-install.log && \
echo Re-Installing... && \
make -j install >> ../logs/grub2-install.log 2>> ../logs/grub2-install.log && \
echo Running grub-install... && \
grub-install --target=i386-pc /dev/sdb
2) Then, I configured the kernel and recompiled...

Step 2.a)

Code:
#! /bin/bash
cd /sources
echo Deleting Logs...
rm -rf /sources/logs/kernel-make-mrproper.log
rm -rf /sources/logs/kernel-make.log
rm -rf /sources/logs/kernel-make-install.log
rm -rf /sources/logs/kernel-make-modules-instal.log
echo Deleting Old Kernel Source...
rm -rf linux-3.10.26
echo Unpacking New Kernel...
tar -xvJf linux-3.10.26.tar.xz
cd /sources/linux-3.10.26/
echo Calling make mrproper...
make mrproper
echo Copying Old .config into /sources/linux-3.10.26... 
cp /sources/.config /sources/linux-3.10.26/.config
echo Bringing Up Kernel Configuration Menu...
make menuconfig
Step 2.b)

Code:
#! /bin/bash
clear
cd /sources/linux-3.10.26
echo Backing Up .config File...
cp .config ../.config
echo Removing Old Kernel from /boot...
rm -rfv /boot/config-3.10.26
rm -rfv /boot/vmlinuz-3.10.26-lfs-7.4
rm -rfv /boot/System.map-3.10.26
echo Running Make...
make -j16 > ../logs/01_kernel-make.log 2>> ../logs/01_kernel-make.log
echo Compiling Kernel...
make -j16 modules_install > ../logs/02_kernel-modules-install.log 2>> ../logs/02_kernel-modules-install.log
echo Copying Kernel Image...
cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.10.26-lfs-7.4
cp -v System.map /boot/System.map-3.10.26
cp -v .config /boot/config-3.10.26
echo Installing Documentation...
install -d /usr/share/doc/linux-3.10.26
cp -r Documentation/* /usr/share/doc/linux-3.10.26
chown -R 0:0 /sources/linux-3.10.26
cd /
echo Verifying Install...
find -name config-3.10.26
find -name vmlinuz-3.10.26-lfs-7.4
find -name System.map-3.10.26
Step 3)

Wrote a new grub.cfg file:

Code:
set default=0
set timeout=5
insmod ext2
set root=(hd0,msdos1)
menuentry "SqueekToy, Linux 3.10.26-lfs-7.4" {
linux /vmlinuz-3.10.26-lfs-7.4 root=/dev/sda2 ro
}
Notice the difference between the fdisk command showing that LFS is on sdb (causing much consternation when debugging), whereas GRUB is calling for root on sda. This is the result of a personal choice in that when I boot to the LFS system, I also disable all other SATA drives through the BIOS configuration. Thus, the kernel sees the first BIOS-found drive as sda (the only active drive, sda; which is LFS).

One gotcha was the CONFIG_CMDLINE_BOOL kernel configuration option. Found here: Processor Type and Features --> Built-in kernel command line

Make sure that little guy is turned off - the drives weren't mounting properly because the option was on and overriding any commands sent to the kernel from the bootloader. So, when GRUB specified "root=/dev/sda2," the kernel was using its own built-in commands instead of GRUB's. From what I understand, unless you have weird requirements (an embedded system), the bootloader should be giving all direction that the kernel needs.

Anyways, she seems to be up and running.

Again, thanks for all the help, I really appreciate it and I could not ask for more from the Linux community.
 
Old 01-21-2014, 08:16 PM   #12
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by alpo85

This is the result of a personal choice in that when I boot to the LFS system, I also disable all other SATA drives through the BIOS configuration. Thus, the kernel sees the first BIOS-found drive as sda (the only active drive, sda; which is LFS).
If you ever get tired of doing that, the UUID of the LFS partition can be used in the grub.cfg linux command instead of the device name. And your set root command containing GRUB device syntax can be replaced with the search command containing --fs-uuid --set=root and the UUID. Then it won't matter in what order the kernel discovers and names your drives, and you won't need to disable any of them to boot the LFS system. Anyway, this how I deal with this matter for systems on external USB drives.

P.S.: Using UUIDs (or LABELs) in the grub.cfg file requires that you create an initial ram filesystem. It's a trivial thing to do and explained in the book.

Last edited by stoat; 01-21-2014 at 08:31 PM.
 
1 members found this post helpful.
Old 01-21-2014, 09:02 PM   #13
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
Sounds like the next project. Thanks, stoat.
 
Old 01-22-2014, 01:04 AM   #14
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
Hi

maybe you are using this link for compile grub2
http://www.linuxfromscratch.org/lfs/...er06/grub.html

and it appears to have parameter
--disable-efiemu

and this links claims that might not be right!
http://www.puredarwin.org/developers/booting/grub2
 
Old 01-22-2014, 10:51 AM   #15
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Original Poster
Rep: Reputation: Disabled
http://blog.fpmurphy.com/2010/03/grub2-efi-support.html

This guy seems to have compiled GRUB2 with EFI support using --disable-efimenu. Hmmmm....The only way to find out is to try.
 
  


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
After I complete the compiling of LFS,"Interface eth0 doesn't exist" occurs. riondavid Linux From Scratch 8 02-07-2010 10:38 AM
After I complete the compiling of LFS,"Interface eth0 doesn't exist" occurs. weiguixm Linux From Scratch 1 10-10-2008 11:17 PM
"Interface eth0 doesn't exist. [ WARN ]" on boot-up aleksanteri Linux From Scratch 10 11-07-2007 12:40 PM
Samba shared folder "doesn't exist" under Fedora 7 x86_64 rcx11 Linux - Server 5 10-30-2007 06:22 AM
Sound device "doesn't exist" after program crash oot Linux - General 2 07-30-2004 11:47 PM

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

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