LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-19-2021, 04:57 AM   #1
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Confused about UEFI and kernel location when using GRUB


I switched my laptop from Legacy BIOS mode to UEFI, and installed GRUB as the boot loader.
Thus, the GRUB core was copied to the ESP (EFI System Partition).
I installed Slackware (“-current”), and skipped installation of a boot loader.
I created an entry for Slackware in the GRUB configuration file.

Now, I keep reading that you need to copy any kernel that you want to boot, to the ESP, but I can’t imagine why that would be required. What’s more, it obviously isn’t required, because my setup works fine. I really wouldn’t expect anything else, either, because (as I understand it):
  • UEFI finds the GRUB core in the ESP;
  • UEFI loads the GRUB core and passes control to it;
  • GRUB will display its boot menu (or not, as the case may be);
  • When I select the Slackware entry from the GRUB boot menu, GRUB will load the kernel (and the initrd) from the location mentioned in the boot entry;
  • The Slackware Linux system starts up.
This is, in fact, pretty similar to what happens under Legacy BIOS. The underlying architecture may be vastly different, but the process, as seen from this higher level, is quite comparable.

Hence my question: Why would I need, or want, to copy my Linux kernel to the ESP? Surely, UEFI won’t load the kernel directly, will it? Some sort of boot loader will inevitably have to intervene, won’t it?

In other words, no matter what, the sequence will be: UEFI loads the boot loader from the ESP; the boot loader takes control; the boot loader loads the kernel (and the initrd, as required) with the appropriate configuration parameters; the Linux system is started.

If UEFI were to load the Linux kernel directly (from the ESP), then how could the configuration parameters ever get passed to the kernel? And how and why would the boot loader have to intervene if such a setup made sense?

I guess my overall question is: What am I missing here?
 
Old 01-19-2021, 05:23 AM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Quote:
Now, I keep reading that you need to copy any kernel that you want to boot, to the ESP,
This is only required if your using the elilo bootloader. Not required for the grub bootloader.
You will also need to run
Code:
grub-mkconfig -o /boot/grub/grub.cfg
to get the grub menu. Slackware doesn't auto run grub-mkconfig after kernel upgrades unlike other distros. Debian based distros use update-grub which is a wrap-around of this command. Fedora based distros place the grub files in /boot/grub2 and the grub.cfg on the efi partition with the grub efi bootloader.


Quote:
I created an entry for Slackware in the GRUB configuration file.
what configuration file did you create this in? If it was /boot/grub/grub.cfg, running grub-mkconfig will overwrite any changes you make to this file.

Last edited by colorpurple21859; 01-19-2021 at 05:44 AM.
 
2 members found this post helpful.
Old 01-19-2021, 05:37 AM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
grub-install puts the OS loader grubx64.efi in the ESP, and other stuff it needs in /boot/grub.

There is no need to put anything else in the ESP, as grubx64.efi reads /boot/grub/grub.cfg to know what it should do and with the help of grub own file system modules installed in /boot/grub/x86_64-efi is able to look into pretty much any directory to find then load the kernel and the initrd. grub has to use its own file system modules as it can use those from Linux, the kernel being indeed not yet loaded when grubx64.efi runs.

So, to make a long story short, run as root (assuming that the ESP is in /dev/sda):
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Check grub.cfg and edit it if need be before rebooting as I am not sure that the Slackware grub package can identify initrd.gz as a valid name for an initrd.

To know more type:
info grub

Last edited by Didier Spaier; 01-19-2021 at 05:48 AM. Reason: command grub-mkconfig corrected.
 
2 members found this post helpful.
Old 01-19-2021, 05:48 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
Debian based distros use update-grub which is a wrap-around of this command. Fedora based distros place the grub files in /boot/grub2 and the grub.cfg on the efi partition with the grub efi bootloader.
After kernel upgrades Slint build and installs an initrd for each generic kernel in /boot, remove all generic kernels but the one currently running and the new one, runs update-grub if /boot/grub/grub.cf exists else displays a warning:
Code:
It seems that you didn't install grub in Slint. If you installed it from
another distribution you should now run update-grub from this other
distribution, else Slint won't boot from the grub menu. If you used
another boot manager that grub we suggest that you install grub now.

Last edited by Didier Spaier; 01-19-2021 at 05:49 AM.
 
Old 01-19-2021, 05:59 AM   #5
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,372

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Code:
Check grub.cfg and edit it if need be before rebooting as I am not sure that the Slackware grub package can identify initrd.gz as a valid name for an initrd.
The initrd.gz is pickup, but added to the huge kernel menu entries as well as the generic kernel menu entries.
 
Old 01-19-2021, 06:01 AM   #6
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by colorpurple21859 View Post
This is only required if your using the elilo bootloader. Not required for the grub bootloader.
Ah, I see. Sounds like an interesting subject to research, … but that will be something for another day.
Quote:
You will also need to run
Code:
grub-mkconfig -o /boot/grub/grub.cfg
to get the grub menu.
To be honest, I don’t ever run “grub-mkconfig” or “update-grub” or some such, since I edit my GRUB configuration manually. Once it’s in place, there isn’t really that much to edit, anyway.
 
Old 01-19-2021, 06:08 AM   #7
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459

Original Poster
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by colorpurple21859 View Post
What configuration file did you create this in? If it was /boot/grub/grub.cfg, running grub-mkconfig will overwrite any changes you make to this file.
Well, my “grub” directory is on a separate partition that does not even get mounted by default. I did set up a mount point for it at “/mnt/local/GRUB”, where I’ll mount it if I ever need to access it from my running system.
 
Old 01-19-2021, 06:24 AM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,551

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
Quote:
To be honest, I don’t ever run “grub-mkconfig” or “update-grub” or some such, since I edit my GRUB configuration manually. Once it’s in place, there isn’t really that much to edit, anyway
I usually do the same and it works. The one thing is that if you do updates on whatever OS you have Grub one and a new kernel is installed it will probably run grub-mkconfig. Have a backup of the grub.cfg menuentries to get around this.
 
Old 01-19-2021, 06:36 AM   #9
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 460

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
It's actually a good thing that Slackware doesn't run grub-mkconfig automatically. GRUB can be finicky with os-prober sometimes, so entries for any other OS that's mounted when grub-mkconfig is run are liable to have their options overwritten and wind up with incorrect UUIDs. Other than that, GRUB is very dependable once it's up and running and it has convenient password-protection capabilities.
 
  


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
UEFI Class 3 :: To use UEFI, or not to use UEFI? jheengut Slackware 19 12-30-2020 09:24 AM
Can't get dual boot, win 7 uefi and elementary freya os uefi working shywolf Linux - Newbie 4 12-10-2015 06:14 PM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
LXer: Google I/O Android News: Location, Location, Location (Plus Cloud Messaging and Bluetooth) LXer Syndicated Linux News 0 06-05-2013 01:00 PM
location, location, location! mermxx LQ Suggestions & Feedback 9 09-25-2004 03:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:32 PM.

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