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 08-26-2021, 06:56 AM   #1
khathumusekwa
LQ Newbie
 
Registered: Aug 2021
Location: Pretoria, South Africa
Distribution: Linux From Scratch, Arch, Debian
Posts: 1

Rep: Reputation: Disabled
Unhappy GRUB displays with blinking cursor and no menu entries


TL;DR - I recently got my very first LFS system working (whoop whoop!) but my GRUB won't display any menu entries and only displays "GRUB" with a blinking cursor.

Firstly, I'd like to mention that I've tried using both ext2 and vfat file systems for my GRUB partition, and I've also tried both legacy and UEFI versions of GRUB. Neither of the two work, however I am able to boot into my LFS from the GRUB command line from a live USB with no file system, or partition mounting issues. Everything works as expected so I assume it has something to do with an incorrectly configured grub.cfg?

When setting up the legacy option as presented in the LFS handbook and using the vfat file system for the GRUB partition, I end up getting the "Welcome to GRUB" message but that will quickly be followed by "Unknown file system" right below it. I then tried using an ext2 file system on the GRUB partition and I wouldn't get the file system error, but instead my PC would fall into an endless loop at boot where the "GRUB loading..." message would display followed by the PC rebooting itself.

I then switched to using the UEFI mode for my GRUB as detailed in the BLFS handbook and I don't get any file system or looping reboots (regardless of whether I choose vfat or ext2 for my EFI partition) when I reboot the PC. All that is displayed is "GRUB" with a blinking cursor. When I hit enter it would then go to the next available bootloader instead (in my case the live USB.)

I've searched the internet high and low for solutions and none of them work. I've read through all the GRUB man documentation as well as documentation provided from various sites, and yet nothing solves my problem.

Like I said, I'm able to boot with absolutely no errors from the live USB GRUB command line.

I'm using a GPT partition table on an SSD and HDD and this is the setup:
Code:
| Partition | Mount point | File system |
| ------------------------------------- |
| /dev/sda1 | /boot       | ext2        |
| /dev/sda2 | /boot/efi   | vfat/efi    |
| /dev/sda3 | swap        | sw          |
| /dev/sda4 | /           | ext4        |
| /dev/sda5 | /usr        | ext4        |
| /dev/sda6 | /usr/src    | ext4        |
| /dev/sda7 | /opt        | ext4        |
| /dev/sda8 | /tmp        | ext4        |
| /dev/sda9 | (Reserved   | ext4        |
|           | for Debian) |             |
| /dev/sdb1 | /home       | ext4        |
| ------------------------------------- |
My grub.cfg is setup as:
Code:
set default=0
set timeout=0

insmod part_gpt
insmod ext2
set root=(hd0,gpt1)

menuentry "GNU/Linux LFS (5.13.4)" {
    linux /vmlinuz-5.13.4-lfs-10.1 root=/dev/sda4 ro
}
This is my output when running efibootmgr:
Code:
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0001,0005,0004,0003,0002
Boot0001* Hard Drive
Boot0002* CD/DVD Drive
Boot0003* USB HDD
Boot0004* UEFI: SanDisk
Boot0005* UEFI: SanDisk, Partition 1
This is my output when running efibootmgr -v:
Code:
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0001,0005,0004,0003,0002
Boot0001* Hard DriveCould not parse device path: Invalid argument
Side note: when I install Debian 11 at /dev/sda9 it uses the same efi and swap partitions as laid out in /dev/sda2 and /dev/sda3 but somehow I'll get a working GRUB menu but only with Debian's menu entry displayed. When I run grub-install --bootloader-id=lfs --recheck /dev/sda from my LFS system my GRUB breaks again.
 
Old 08-30-2021, 04:34 PM   #2
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Hi
If your using a GPT partition with legacy grub you will need a small bios partition at the begining of the drive not sure how big 8mb maybe.
 
Old 08-30-2021, 05:29 PM   #3
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
Quote:
GRUB" with a blinking cursor
at the grub prompt post the output of
Code:
grub>set
wanting to know root= and prefix=
lines.
post the contents of /boot/efi/EFI and subdirectories.
where is the location of lfs grub.cfg?

Last edited by colorpurple21859; 08-30-2021 at 05:58 PM.
 
Old 08-30-2021, 07:43 PM   #4
lovemeslk
Member
 
Registered: Feb 2020
Location: Rantoul IL
Distribution: Slackware
Posts: 350

Rep: Reputation: 72
Quote:
Originally Posted by spiky0011 View Post
Hi
If your using a GPT partition with legacy grub you will need a small bios partition at the begining of the drive not sure how big 8mb maybe.
I believe 8mb may work best to use 100mb as per documentation. Seems grub is getting rather large Unless you use the patched version. And the kernel vmlinuz and initrd.img seem to be getting bigger

Last edited by lovemeslk; 08-30-2021 at 07:45 PM.
 
Old 08-30-2021, 08:02 PM   #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
Code:
I believe 8mb may work best to use 100mb as per documentation
Need at least a 1mb partition flagged as bios boot/bios grub. It is to replace the 1mb that exist between the mbr and first partition on a mbr drive that doesn't exist on a gpt drive. Grub uses that 1mb to store part of the grub boot code when booting in legacy/csm mode. If you use the lilo bootloader this partition isn't needed.

Last edited by colorpurple21859; 08-30-2021 at 08:22 PM.
 
Old 08-30-2021, 10:09 PM   #6
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Code:
set root=(hd0,gpt1)
Why do you tell it to boot your /boot partition as the / it will never find the files needed there.. Should be 4 perhaps as it does not start the counting at 0 but 1 for the first partition in my memory serves me. And checking the entry I made for memtest on my spare machine which uses the EFI I am correct.

Code:
root@zeus-H370M:~# fdisk -l /dev/sda
Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: KINGSTON SH103S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D8A96088-5191-480A-9498-EE006223808B

Device      Start       End   Sectors   Size Type
/dev/sda1      40    409639    409600   200M EFI System
/dev/sda2  409640 234441614 234031975 111.6G Linux filesystem
root@zeus-H370M:~# cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# 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.


menuentry 'MemTest86' {
	insmod part_gpt
	insmod fat
	set root='hd0,gpt1'
	chainloader ($root)/EFI/memtest86/BOOTX64.efi
}
May want to change that ext2 to ext4 as well.

Edit: perhaps the hd0,gpt2 to be pointing to the /boot/efi as the place to find GRUB with its configuration files.

Code:
root@zeus-H370M:~# ll /boot/efi/EFI/ubuntu/
BOOTX64.CSV  grub.cfg     grubx64.efi  mmx64.efi    shimx64.efi  
root@zeus-H370M:~# cat /boot/efi/EFI/ubuntu/grub.cfg 
search.fs_uuid 8f884461-ca48-4cda-908a-f9d10d9a7a43 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Now I check it. Here is used the UUID of the partition and the location of it as the second one to boot the machine.

Last edited by HappyTux; 08-30-2021 at 10:28 PM.
 
Old 08-30-2021, 11:42 PM   #7
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
Quote:
Why do you tell it to boot your /boot partition as the / it will never find the files needed there..
the "set root=" is normally set within the menu entry for the location of the partition that the kernel is located on, however with just one menu entry setting the "set root=" before the menu entry works just as well, and has nothing to do with the prefix setting that is set when grub-install is invoked that determines where grub looks for the grub.cfg file.

Last edited by colorpurple21859; 08-30-2021 at 11:54 PM.
 
Old 08-30-2021, 11:50 PM   #8
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by colorpurple21859 View Post
the "set root=" is normally set within the menu entry for the location of the partition that the kernel is located on, however with just one menu entry setting the "set root=" before the menu entry works just as well, and has nothing to do with the prefix setting that is set when grub-install is invoked.
Well there we are, something else about GRUB I never wanted to know, Christ I dislike the program if it does not show in my postings about it.
 
Old 08-31-2021, 12:00 AM   #9
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
HappyTux, I have yet to figure out how grub-install sets where it initially looks for the grub.cfg file when grub-install is ran without any flags set.
On legacy systems it is /boot/grub, however on uefi systems some distros it is /boot/grub and others it is the efi partition where as you have pointed out a grub.cfg file is used to set the prefix back to /boot/grub,

Last edited by colorpurple21859; 08-31-2021 at 12:14 AM.
 
Old 08-31-2021, 12:50 AM   #10
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by colorpurple21859 View Post
HappyTux, I have yet to figure out how grub-install sets where it initially looks for the grub.cfg file when grub-install is ran without any flags set.
On legacy systems it is /boot/grub, however on uefi systems some distros it is /boot/grub and others it is the efi partition where as you have pointed out a grub.cfg file is used to set the prefix back to /boot/grub,
Tell it where your files are located with the option passed there is good example in this page showing many options to give to leave it no choice but to use your config files.

https://askubuntu.com/questions/8312...-efi-partition

On this page is the setting to enable as true to have it not probe other drive and OSs.

https://forum.endeavouros.com/t/os-p...-of-grub/15187

Get it booted to your lfs install and use the settings you want without it probing for other OSs.
 
Old 08-31-2021, 04:59 AM   #11
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
Quote:
Originally Posted by khathumusekwa View Post
TL;DR - I recently got my very first LFS system working (whoop whoop!) but my GRUB won't display any menu entries and only displays "GRUB" with a blinking cursor.

Firstly, I'd like to mention that I've tried using both ext2 and vfat file systems for my GRUB partition, and I've also tried both legacy and UEFI versions of GRUB. d DriveCould not parse device path: Invalid argument
If you are booting a GPT disk in legacy/mbr mode, your BIOS boot partition should not carry a filesystem at all. The GRUB boot stub in the mbr finds the next stage of GRUB by its physical address, which therefore needs to remain constant. Filesystems tend to get fscked and rearranged.
 
Old 08-31-2021, 12:37 PM   #12
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by hazel View Post
If you are booting a GPT disk in legacy/mbr mode, your BIOS boot partition should not carry a filesystem at all. The GRUB boot stub in the mbr finds the next stage of GRUB by its physical address, which therefore needs to remain constant. Filesystems tend to get fscked and rearranged.
So true it is why I like the way my Pi 4 boots, if the named files are there in the EFI partition or simply normal fat partition with them on it, it proceeds to boot. Then it looks for the LABEL of the partitions and loads that for the needed next steps. Great way of doing it any disk I want for a backup it is simply a matter of making sure the labels are set proper and an rsync of two partitions and I have working bootable clone MBR or GPT does not matter, with no damn GRUB to mess it up if you forget to edit them needed files.
 
Old 08-31-2021, 01:00 PM   #13
lovemeslk
Member
 
Registered: Feb 2020
Location: Rantoul IL
Distribution: Slackware
Posts: 350

Rep: Reputation: 72
Quote:
Originally Posted by colorpurple21859 View Post
Code:
I believe 8mb may work best to use 100mb as per documentation
Need at least a 1mb partition flagged as bios boot/bios grub. It is to replace the 1mb that exist between the mbr and first partition on a mbr drive that doesn't exist on a gpt drive. Grub uses that 1mb to store part of the grub boot code when booting in legacy/csm mode. If you use the lilo bootloader this partition isn't needed.
look this is what you need with grub
[CODE]running rhel >= 7.6 on work servers I install linux as follows keeping it as simple as possible.

Say all you want I told you the trueth but does this help the OP. fact is everyone default to 100 mb /boot/UEFI
if it is Slackware elio same thing so grub can fit. if it is /boot/UEFI/grub.cfg
the partition 100 mb is for future reasons. How many Kernel do you want to boot.
Code:
Grub uses that 1mb to store part of the grub boot code when booting
10 years ago with legacy.
You try to install the un patched grub2 with under 100 mb.
https://bbs.archlinux.org/viewtopic.php?id=234954
https://forum.endeavouros.com/t/inst...-install/58355
https://askubuntu.com/questions/1072...stall-error-ef
512 mb for larger systems
https://askubuntu.com/questions/1313...-efi-partition



been there done this a bunch of times.

Last edited by lovemeslk; 08-31-2021 at 01:06 PM.
 
Old 08-31-2021, 01:13 PM   #14
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
Quote:
fact is everyone default to 100 mb /boot/UEFI
that is the efi partition if one is booting in uefi mode, not the partition I'm talking about that is only needed when using the grub bootloader to boot a gpt disk in legacy/csm mode.
Quote:
but does this help the OP.
No it doesn't as the op is setup to boot in uefi mode. Still waiting on input from op about the output of the command set at the grub prompt.
 
  


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] Mint 19 Tara GRUB display blinking cursor MicroSad Linux - Newbie 6 12-03-2018 03:46 PM
Linux Mint 17.1 MATE blinking cursor error, no grub menu bengalman211 Linux - Desktop 2 04-03-2015 11:22 PM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
GRUB Blinking Cursor and can't type anything zlatan Linux - Software 3 01-18-2006 09:45 PM
grub (blinking cursor) - won't boot php4u Fedora - Installation 2 04-04-2005 10:23 AM

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

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