LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-30-2022, 12:52 PM   #1
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,352

Rep: Reputation: 75
Kernel upgrade 'Gotcha'


I ran into a problem today upgrading my kernel which I had not encountered before and which required the help of a live slackware drive to fix.
My PC is over 8 years old and back then the way I found to set up dual booting was to have the vmlinuz kernels on the EFI partition itself. This requires mounting the EFI partition to copy over the files; I do not have the partition mounted by default.
This time round I found that after I had installed the kernel using slackpkg I could not mount the EFI drive. I was getting an error that vfat was an unknown type. I don't really understand why that should have happened (perhaps some kernel module has to be loaded)but in future I will make sure the EFI drive is mounted before upgrading the kernel. If I haven't upgraded my PC by then.
 
Old 11-30-2022, 01:30 PM   #2
JayByrd
Member
 
Registered: Aug 2021
Location: Seattle, WA
Distribution: Slackware
Posts: 302

Rep: Reputation: 310Reputation: 310Reputation: 310Reputation: 310
Quote:
Originally Posted by arubin View Post
I ran into a problem today upgrading my kernel which I had not encountered before and which required the help of a live slackware drive to fix.
My PC is over 8 years old and back then the way I found to set up dual booting was to have the vmlinuz kernels on the EFI partition itself. This requires mounting the EFI partition to copy over the files; I do not have the partition mounted by default.
This time round I found that after I had installed the kernel using slackpkg I could not mount the EFI drive. I was getting an error that vfat was an unknown type. I don't really understand why that should have happened (perhaps some kernel module has to be loaded)but in future I will make sure the EFI drive is mounted before upgrading the kernel. If I haven't upgraded my PC by then.
I've experienced this before, but with ext2 vs. ext4 file systems.

What happens is that since the EFI hasn't been mounted, the running kernel hasn't loaded the vfat module. Then when you "slackpkg upgrade," it removes the module tree from /lib/modules/{RUNNING KERNEL VERSION}. When you try to mount the EFI partition, the kernel can't find its own vfat module.

For everything to go smoothly, you must either A) mount your vfat partition (or any other file system of a type different from your main partition) before performing the upgrade, or B) re-install the kernel-modules package that corresponds to the version of the un-updated running kernel. (If you haven't rebooted yet, option B should allow you to go ahead and mount the vfat and proceed normally.)

EDIT:
Technically speaking, you don't have to mount the partition before upgrading the kernel--as long as the vfat module is loaded before you upgrade. (E.g., via modprobe.) In my case, I just include the vfat module in the initrd, then EFI is always available to mount, before or after the upgrade...

Last edited by JayByrd; 11-30-2022 at 01:37 PM. Reason: Second thoughts...
 
2 members found this post helpful.
Old 11-30-2022, 02:38 PM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,474
Blog Entries: 7

Rep: Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573
The way to prevent this from happening next time is to include the vfat module in your initrd.

Last edited by rkelsen; 11-30-2022 at 02:40 PM.
 
2 members found this post helpful.
Old 11-30-2022, 04:42 PM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,920

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
Yeah, I've done that before.

I mount /boot/efi 'ro' on boot to make sure the vfat module is loaded, and then just flip it rw while it is updated.

For my custom kernels, I always build vfat in.
 
Old 11-30-2022, 05:37 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,078

Rep: Reputation: Disabled
I was about to suggest again dracut (associated with GRUB of course) but I know, NIH syndrome et all. And we would miss all these "I can't reboot after a kernel upgrade" threads...

@GazL: no port of lilo or elilo for CRUX? What a shame!

Last edited by Didier Spaier; 11-30-2022 at 05:59 PM.
 
Old 11-30-2022, 06:50 PM   #6
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,474
Blog Entries: 7

Rep: Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573
Quote:
Originally Posted by Didier Spaier View Post
but I know, NIH syndrome et all
Well, perhaps NAN syndrome? (Not absolutely necessary) I mean:

Code:
# mkinitrd -c -k 5.15.80 -m ext4:vfat
is not really rocket science, is it?
 
Old 11-30-2022, 09:01 PM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Or installpkg the new kernel instead of upgradepkg so current kernel modules files are still present in the hard drive
 
Old 12-01-2022, 01:11 AM   #8
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,352

Original Poster
Rep: Reputation: 75
I do like rkelsen's approach.
 
Old 12-01-2022, 01:23 PM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,920

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
Quote:
Originally Posted by Didier Spaier View Post
I was about to suggest again dracut (associated with GRUB of course) but I know, NIH syndrome et all. And we would miss all these "I can't reboot after a kernel upgrade" threads...

@GazL: no port of lilo or elilo for CRUX? What a shame!
No, no elilo/lilo in CRUXland. Initially I borrowed Slackware's elilo and mkinitrd to boot CRUX, but later moved away from that. I boot CRUX using the kernel's EFI_STUB direct from the EFI firmware boot menu, with no additional boot-manager at all. As for the initrds, CRUX doesn't officially support one, and that sort of thing is left to the user/admin to sort out ( There's a lot of that with CRUX! ).

There is a build of dracut in CRUX's "opt" package build collection, and I did try it, and it did indeed work, but I decided to write and use my own, driven by a simple makefile.

In contrast, my Slackware 15.0 install still uses elilo and Slackware's mkinitrd.


P.S. It's never been about NIH for me, it's an aversion to complexity.

Last edited by GazL; 12-01-2022 at 02:06 PM.
 
2 members found this post helpful.
Old 12-01-2022, 03:24 PM   #10
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,078

Rep: Reputation: Disabled
Quote:
Originally Posted by GazL View Post
I boot CRUX using the kernel's EFI_STUB direct from the EFI firmware boot menu, with no additional boot-manager at all.
...
There is a build of dracut in CRUX's "opt" package build collection, and I did try it, and it did indeed work, but I decided to write and use my own, driven by a simple makefile.
Amzingly, there are these two options of dracut:
Code:
--uefi
    Instead of creating an initramfs image, dracut will create an UEFI executable, which can be executed
    by an UEFI BIOS. The default output filename is
    <EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi. <EFI> might be /efi, /boot or /boot/efi
    depending on where the ESP partition is mounted. The <BUILD_ID> is taken from BUILD_ID in
    /usr/lib/os-release or if it exists /etc/os-release and is left out, if BUILD_ID is non-existant or
    empty.

--uefi-stub <FILE>
    Specifies the UEFI stub loader, which will load the attached kernel, initramfs and kernel command line
    and boots the kernel. The default is
     $prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub
I guess you don't need that

Maybe I will try --uefi-stub some day if I am really bored...
 
1 members found this post helpful.
Old 12-01-2022, 05:27 PM   #11
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,474
Blog Entries: 7

Rep: Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573Reputation: 2573
Quote:
Originally Posted by Didier Spaier View Post
Amazingly, there are these two options of dracut:
Code:
--uefi
    Instead of creating an initramfs image, dracut will create an UEFI executable, which can be executed
    by an UEFI BIOS. The default output filename is
    <EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi. <EFI> might be /efi, /boot or /boot/efi
    depending on where the ESP partition is mounted. The <BUILD_ID> is taken from BUILD_ID in
    /usr/lib/os-release or if it exists /etc/os-release and is left out, if BUILD_ID is non-existant or
    empty.
That is good to know.
 
  


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
New (minor) gotcha with the new 4.14.11 kernel and Nvidia driver Lenard Spencer Slackware 32 01-09-2018 08:30 PM
LXer: Avoiding the iCloud storage gotcha LXer Syndicated Linux News 0 10-27-2011 04:30 AM
LXer: A Little VCS NFS Gotcha On Solaris 10 LXer Syndicated Linux News 0 02-05-2009 02:10 PM
a gotcha with the at command? stabu Linux - Software 4 12-25-2008 07:09 AM
SOLVED -- Hard-to-find gotcha in OpenVPN jlinkels Linux - Networking 0 07-30-2007 11:34 AM

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

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