LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-25-2023, 09:31 AM   #1
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Rep: Reputation: 52
UEFI and a New BIOS


Hi all!

I recently built a new computer with an MSI B550-A Pro motherboard. Everything has been working great. Recently, a new BIOS for the mobo was released. Normally I wouldn't mess with it except it fixed a security problem. Naturally, after flashing it it resets the BIOS settings. I did the usual stuff of turning off Secure Boot, etc., but I still couldn't get it to boot Slackware off my NVME drive. If I put it on CSM instead of UEFI, it would see the disk as something you could boot to, but it couldn't boot because it was set up with elilo.

I ended up doing the nuclear option and reinstalled Slackware 15. At the end of the installation process eliloconfig set up an EFI boot entry. That apparently was what I was missing because it got erased when the BIOS was updated. Is there a simpler way that I can restore that information if a future BIOS update is needed without reinstalling Slackware? eliloconfig did not seem to be available to me when I booted to my Slackware install USB drive.

Last edited by marnold; 03-25-2023 at 09:32 AM.
 
Old 03-25-2023, 10:28 AM   #2
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by marnold View Post
Is there a simpler way that I can restore that information if a future BIOS update is needed without reinstalling Slackware?
Learn how to use the "efibootmgr" command. It has a man page too. Here's a sample command:
Code:
efibootmgr -c -d /dev/nvme0n1p1 -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware"
Have fun!
 
4 members found this post helpful.
Old 03-26-2023, 09:07 PM   #3
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,781

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
I find it very surprising that your EFI partition was erased just from updating BIOS/UEFI firmware unless Windows has built in means to restore/rebuild it available for every boot, which seems unlikely but then I don't use Windows so I could just be ignorant of what value this could possibly have. Additionally I have read that Windows keeps a backup copy of EFI in some directory where it can be restored but because it would be identical to the one erased, what's the point?

In any case one can backup EFI in Linux as well whether manually, or by a script to regularly handle any changes. Regardless of the bootloader you choose, direct from BIOS Boot Order Menu, Grub, elilo, rEFInd... whatever, it is a good idea to backup EFI. Another method would be to use a Live GParted disk to backup to an image, as well as restore if needed.

I would still like to know if and why yours was erased, marnold. Is this a mutiboot system?
 
Old 03-26-2023, 10:25 PM   #4
nhattu1986
LQ Newbie
 
Registered: Dec 2005
Distribution: slackware
Posts: 20

Rep: Reputation: 13
^ I think his esp partition is in fact, still intact.
When he upgrade the bios (using built in or usb boot), after the upgrade, the upgrade process also clear all the previous bios setting, which include the custom boot menu that is added by efibootmgr.
So the simple solution is just boot the usb installer in uefi and using efibootmgr as post #2 indicate
 
Old 03-27-2023, 02:55 AM   #5
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,781

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
^ That certainly is a possibility especially considering the oddity that only when CSM was enabled did BIOS apparently finally find the NVME drive as bootable. It's also a bit weird that if, as said, it had been configured with elilo, not lilo, that it didn't detect it would boot with EFI under CSM which isn't a substitute but an addon. That said, you're right, USB drives must have the boot method manually chosen if the support both Legacy CSM and EFI boots. When I insert a bootable USB drive like the Installer, I must hit an F Key to access the "Boot Order Menu" and choose which I prefer, Legacy or EFI. However marnold must know that, or at least turned CSM off or he wouldn't have gotten a prompt for eliloconfig.

This could be a good example why it might be a good idea to also run "efibootmgr" at the end of the Installer process.

Last edited by enorbet; 03-27-2023 at 02:57 AM.
 
1 members found this post helpful.
Old 03-27-2023, 03:13 AM   #6
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
Quote:
Originally Posted by enorbet View Post
When I insert a bootable USB drive like the Installer, I must hit an F Key to access the "Boot Order Menu" and choose which I prefer, Legacy or EFI. However marnold must know that, or at least turned CSM off or he wouldn't have gotten a prompt for eliloconfig.
Mine defaults to EFI for these hybrid boot drives, even if CSM is set to legacy only. but also makes legacy available and selectable.
Note that it also requires usb-storage to be enabled, or else it will not even boot from usb.
My internal drives are always legacy MBR, since I don't even have nvme or windows or other distributions installed.

Edit:
Also, flashing tools designed for windows may clear and rewrite the esp partition with windows "defaults", for security reasons.
Unlikely to happen if flashed directly from bios menu, i.e. never happened to me, but still possible.

Last edited by elcore; 03-27-2023 at 03:52 AM. Reason: more info
 
Old 03-27-2023, 01:00 PM   #7
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Original Poster
Rep: Reputation: 52
Thanks for all the responses! I was away for a bit. I only run Slackware, no Windows. I used the BIOS' own upgrade functions. I am running UEFI only, no CSM. I had read some people claiming that MSI motherboards would clear the EFI partition on a BIOS update, but when I used the Slackware USB installer, I mounted that partition and it was intact.

I just tried using the Slackware USB installer, and the only way I could find to have access to efibootmgr is to mount my existing root partition and run it from /usr/sbin. Is there another/easier way from the installer stick itself?
 
Old 03-27-2023, 02:04 PM   #8
nhattu1986
LQ Newbie
 
Registered: Dec 2005
Distribution: slackware
Posts: 20

Rep: Reputation: 13
Quote:
Originally Posted by marnold View Post
Thanks for all the responses! I was away for a bit. I only run Slackware, no Windows. I used the BIOS' own upgrade functions. I am running UEFI only, no CSM. I had read some people claiming that MSI motherboards would clear the EFI partition on a BIOS update, but when I used the Slackware USB installer, I mounted that partition and it was intact.

I just tried using the Slackware USB installer, and the only way I could find to have access to efibootmgr is to mount my existing root partition and run it from /usr/sbin. Is there another/easier way from the installer stick itself?
from the installer stick.
you can mount the current root to /mnt
bind mount the /proc, /sys to the /mnt/proc, /mnt/sys
then you can chroot to /mnt
you should be good to use efibootmgr from existing root.
 
Old 03-27-2023, 07:37 PM   #9
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Original Poster
Rep: Reputation: 52
Quote:
Originally Posted by nhattu1986 View Post
from the installer stick.
you can mount the current root to /mnt
bind mount the /proc, /sys to the /mnt/proc, /mnt/sys
then you can chroot to /mnt
you should be good to use efibootmgr from existing root.
Now that I think about it, wouldn't I have to mount the EFI partition too?
 
Old 03-28-2023, 08:29 AM   #10
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,781

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
Quote:
Originally Posted by marnold View Post
Now that I think about it, wouldn't I have to mount the EFI partition too?
I assume it is required to mount any devices required by the system. I experiment with many installs and rather massive multibooting so I always mount the root device, then boot device then EFI device to "/mnt", "/mnt/boot", and "mnt/boot/EFI" respectively for any UEFI system. One must cover one's "boot"
 
Old 03-28-2023, 08:46 AM   #11
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,482

Rep: Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287Reputation: 3287
Quote:
Originally Posted by marnold View Post
Is there a simpler way that I can restore that information if a future BIOS update is needed without reinstalling Slackware? eliloconfig did not seem to be available to me when I booted to my Slackware install USB drive.
IF anything you need is to restore the EFI boot entry removed by whatever reason, there is a script which updates this information:
Code:
!/bin/sh

EFIDISK=${1:-/dev/sda1}

#
EFI_DEVICE=$(sed 's%[0-9]\+$%%;s%\([0-9]\)p%\1%' <<< $EFIDISK)
EFI_PARTITION=$(sed 's%.*[a-z]\([0-9]\+\)$%\1%' <<< $EFIDISK)

echo "Removing the previous eLILO boot entries ..."

efibootmgr -v | rev | cut -f 2- | rev | grep Boot0 | grep Slackware | while read line ; do
  # Reject entries that don't exactly match as not our business
  if [ ! "$(echo $line | cut -f 2- -d ' ')" = "Slackware" ]; then
    continue
  fi
  # Remove the boot entry:
  BOOTENTRY=$(echo $line | cut -b5-8)
  echo "Removing the boot entry: $BOOTENTRY"
  efibootmgr -q -B -b "${BOOTENTRY}"
  sleep 1
done

# Add the new boot entry:
echo "Adding the current eLILO's boot entry ..."
efibootmgr -q -c -d $EFI_DEVICE -p $EFI_PARTITION -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware"
You can save it as install-elilo.sh in a convenient folder, then to use it after mounting properly the root and it's associated filesystems in a chroot where the script is executed.

The interesting part of this script is that it works even from another Linux installation, so effectively I keep it in a Slackware installation on an USB hard drive, which acts like a portable (and bootable) Linux system.

I for one I use something similar but tuned for rEFInd (the original one being this one for ELILO and it was found somewhere), specially for working with some Asrock motherboards of mine, which needs a custom EFI boot entry to boot in EFI mode (and this boot entry is specific to a particular hard drive), which motherboards I use as workbench for various experiments, so the hard drives to them are changed often.

Last edited by LuckyCyborg; 03-28-2023 at 09:41 AM.
 
2 members found this post helpful.
Old 03-28-2023, 10:27 AM   #12
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,682

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
I don't usually comment on posts related to elilo since I don't use it and know very little about installing and configuring it. But I have pretty much the same problem on my Gigabyte B550 Arous Elite. Whenever I flash the bios It will no longer recognize Grub. but like nhattu1986 said the EFI is still intact. All I do is use the Slackware ISO as a rescue to boot the system and just rerun...

Code:
grub-mkconfig -o /boot/grub/grub.cfg
After that Grub will be restored. So It may be similar for elilo, you could try booting the system from the install ISO and use pkgtool to rerun elilo setup, or do it manually.
 
2 members found this post helpful.
Old 03-28-2023, 06:28 PM   #13
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Original Poster
Rep: Reputation: 52
Quote:
Originally Posted by Daedra View Post
I don't usually comment on posts related to elilo since I don't use it and know very little about installing and configuring it. But I have pretty much the same problem on my Gigabyte B550 Arous Elite. Whenever I flash the bios It will no longer recognize Grub. but like nhattu1986 said the EFI is still intact. All I do is use the Slackware ISO as a rescue to boot the system and just rerun...
Stupid question: how do I use the ISO as a rescue? I did some Googling but didn't immediately find anything.
 
Old 03-28-2023, 06:47 PM   #14
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,781

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
As mentioned but perhaps unclearly some installers almost immediately drop you to a "Boot Options" command prompt including examples for how to boot any bootable device that will work with one or more of that version's available kernels, such as huge.s. If that is available the syntax looks like this:

Code:
huge.s root=/dev/sdfoo2 rdinit= ro
If it doesn't boot to the "Boot Options" prompt there may be a menuitem for Boot Options or a "Boot other device" item

If none of those seem available, once the installer asks you to login as root you are dropped to a prompt where you can chroot (change root). That syntax looks like this (generic only)

Code:
mount /dev/sdfoo2 /mnt
mount /dev/sdfoo2/boot /mnt/boot
mount /dev/sdfoo2/boot/EFI /mnt/boot/EFI
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
chroot /mnt /bin/bash
This is just an outline (though quite complete) so it is wise to look at man entries and, of course, you need to specify your root device since n obody has a /dev/sdfoo2
 
2 members found this post helpful.
Old 03-28-2023, 09:15 PM   #15
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,682

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
Quote:
Originally Posted by marnold View Post
Stupid question: how do I use the ISO as a rescue? I did some Googling but didn't immediately find anything.
If it is a UEFI system when you boot the Slackware ISO you should see three options

Code:
Slackware X.X huge.s Kernel
Slackware x.x huge.s kernel (use KMS console)
Detect/boot any installed operating system
The third option "should" be able to find your kernel and boot your system.
 
2 members found this post helpful.
  


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] UEFI BIOS with non-UEFI linux install mfoley Linux - Hardware 31 03-20-2023 01:37 PM
UEFI Class 3 :: To use UEFI, or not to use UEFI? jheengut Slackware 19 12-30-2020 09:24 AM
UEFI and GPT(GUID) and BIOS and drives and partitions SaintDanBert Linux - Hardware 4 05-15-2014 10:05 AM
Help Creating UEFI A MENU For My Bootable (BIOS/UEFI) CDROM ssenuta Linux - Hardware 0 08-27-2012 09:11 PM

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

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