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 02-12-2022, 07:46 AM   #1
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Rep: Reputation: 77
How to Install A New Kernel


I have a fully updated slackware 15.0 and I've been working on my procedures for installing a new kernel.

-I have the following blacklisted in slackpkg:

Code:
kernel-generic.*
kernel-huge.*
kernel-modules.*
kernel-source
-I downloaded the following packages from current (more so to make sure that I can successfully install a new kernel, rather than letting them upgrade through slackpkg):

Code:
kernel-firmware-20220124_eb8ea1b-noarch-1.txz
kernel-generic-5.16.8-x86_64-1.txz
kernel-modules-5.16.8-x86_64-1.txz
kernel-source-5.16.8-noarch-1.txz
-I installed the new packages.

-Ran command: geninitrd

-Ran command: (/usr/share/mkinitrd/mkinitrd_command_generator.sh -r)

-Ran command: usr/share/mkinitrd/mkinitrd_command_generator.sh -l /boot/vmlinuz-generic-4.4.172 >> /etc/lilo.conf (changing the kernel version to match the kernel I was installing).

-Ran command: lilo -v

-Rebooted.

I could successfully boot into the new kernel without a problem. The issue is that I can't boot into the old 5.15.19 kernel as I get a message saying that the kernel modules for that kernel aren't installed, even though I never uninstalled them and used installpkg to install the modules for the new kernel.

I'm sure that I'm missing something, but I'm not sure what.

Last edited by Bertman123; 02-12-2022 at 08:16 AM.
 
Old 02-12-2022, 07:58 AM   #2
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 462

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Was the old initrd moved out of the way before generating the new one? It would get overwritten otherwise.
 
Old 02-12-2022, 08:04 AM   #3
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by pghvlaans View Post
Was the old initrd moved out of the way before generating the new one? It would get overwritten otherwise.
I don't think so. How do I do that?
 
Old 02-12-2022, 08:05 AM   #4
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,834
Blog Entries: 17

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by Bertman123 View Post
I'm sure that I'm missing something, but I'm not sure what.
Code:
ls /lib/modules/
 
Old 02-12-2022, 08:07 AM   #5
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 462

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I like to copy it to initrd-old.gz for safekeeping beforehand; nothing too fancy.

Anyway, mkinitrd-command-generator.sh can take a kernel command to regenerate it: $(/usr/share/mkinitrd/mkinitrd_command_generator.sh -r /boot/vmlinuz-generic-5.15.19).

Last edited by pghvlaans; 02-12-2022 at 08:26 AM. Reason: wrong syntax
 
Old 02-12-2022, 08:14 AM   #6
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by zeebra View Post
Code:
ls /lib/modules/
Code:
ls /lib/modules
5.15.19  5.16.8
I even reinstalled the modules just to make sure, but I made sure they were blacklisted before installing the new modules.
 
Old 02-12-2022, 08:15 AM   #7
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by pghvlaans View Post
I like to copy it to initrd-old.gz for safekeeping beforehand; nothing too fancy.

Anyway, mkinitrd-command-generator.sh can take a kernel command to regenerate it: $(/usr/bin/mkinitrd/mkinitrd-command-generator.sh -r -k /boot/vmlinuz-generic-5.15.19).
Can we have more that one initrd? If I do remake the initrd for the old kernel, how do I make it and keep the one for the new kernel?
 
Old 02-12-2022, 08:26 AM   #8
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 462

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Sorry, I got the syntax wrong: it should be $(/usr/share/mkinitrd/mkinitrd_command_generator.sh -r /boot/vmlinuz-generic-5.15.19).

I don't use lilo, but I imagine you'd need a separate entry for each kernel. As far as keeping the new kernel's initrd is concerned, maybe move it somewhere else, generate the 5.15 initrd, move that one somewhere else, and move the current initrd back.
 
Old 02-12-2022, 08:53 AM   #9
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,834
Blog Entries: 17

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by Bertman123 View Post
Can we have more that one initrd? If I do remake the initrd for the old kernel, how do I make it and keep the one for the new kernel?
I don't know about the initrd as I don't use it myself aside from with the Slackware Kernel, but doing what pghvlaans said, and always backing up your old initrd first seems like a good procedure in general.
 
Old 02-12-2022, 09:08 AM   #10
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
It looks like I can either boot into the old kernel or the new one. I re-ran the mkinitrd.sh command below for the 5.15.19 kernel and was able to boot into it, but then I was unable to boot into the 5.16.8 kernel so I re-ran the mkinitrd.sh command for the new kernel and was able to boot into the new kernel but unable to boot into the old kernel.

Both entries in lilo point to the same initrd file, so I'm assuming that is the problem. Can lilo be able to boot into two different kernels without re-running mkinitrd commands each time?

Can you have two different generic kernels and be able to boot into them using grub without re-running the commands?


Quote:
mkinitrd -c -k 5.16.8 -f ext4 -r /dev/sda2 -m usb-storage:ums-realtek:xhci-hcd:xhci-pcihci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz
Quote:
/usr/share/mkinitrd/mkinitrd_command_generator.sh -l /boot/vmlinuz-generic-5.16.8
Quote:
# initrd created with 'mkinitrd -c -k 5.15.19 -f ext4 -r /dev/sda2 -m usb-storage:ums-realtek:xhci-hcd:xhci-pcihci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usb>
image = /boot/vmlinuz-generic-5.15.19
initrd = /boot/initrd.gz
root = /dev/sda2
label = 5.15.19
read-only
# Linux bootable partition config ends
Quote:
# initrd created with 'mkinitrd -c -k 5.16.8 -f ext4 -r /dev/sda2 -m usb-storage:ums-realtek:xhci-hcd:xhci-pcihci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbh>
image = /boot/vmlinuz-generic-5.16.8
initrd = /boot/initrd.gz
root = /dev/sda2
label = 5.16.8
read-only
# Linux bootable partition config ends
 
Old 02-12-2022, 09:10 AM   #11
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Bertman123 View Post
It looks like I can either boot into the old kernel or the new one. I re-ran the mkinitrd.sh command below for the 5.15.19 kernel and was able to boot into it, but then I was unable to boot into the 5.16.8 kernel so I re-ran the mkinitrd.sh command for the new kernel and was able to boot into the new kernel but unable to boot into the old kernel.

Both entries in lilo point to the same initrd file, so I'm assuming that is the problem. Can lilo be able to boot into two different kernels without re-running mkinitrd commands each time?

Can you have two different generic kernels and be able to boot into them using grub without re-running the commands?
And the command from the mkinitrd command turns into emoticons. sigh.
 
Old 02-12-2022, 09:18 AM   #12
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,765

Rep: Reputation: Disabled
Quote:
Originally Posted by Bertman123 View Post
And the command from the mkinitrd command turns into emoticons. sigh.
It's because you're using [quote][/quote] insted of [code][/code].
OT: Sure you can have multiple initrd.gz just rename it initrd-01.gz, initrd-02.gz, etc, and edit boot config file to reflect that.
 
Old 02-12-2022, 09:24 AM   #13
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 462

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by Bertman123 View Post
Can you have two different generic kernels and be able to boot into them using grub without re-running the commands?
It's pretty straightforward with GRUB, but running at least a couple of commands is more or less unavoidable. My basic procedure is:
Code:
cd /boot
ln -sf $(readlink vmlinuz-generic) vmlinuz-old    # make a symlink to the currently-installed kernel
mv initrd.gz initrd-old.gz    # Move the current initrd out of the way
installpkg new-kernel-here    # Installs the new kernel, and makes a new vmlinuz-generic symlink
$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -r vmlinuz-generic)    # generate initrd for the new kernel
And that's pretty much it. The advantage is that there's no need to touch grub.cfg if the "linux" lines in both entries point to symlinks:
Code:
...
linux /boot/vmlinuz-generic root=...
initrd /boot/initrd.gz
...
...
linux /boot/vmlinuz-old root=...
initrd /boot/initrd-old.gz
Putting everything in a script is the way to go. No reason to type out all those commands every single time.
 
1 members found this post helpful.
Old 02-12-2022, 09:28 AM   #14
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,965

Rep: Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574
Quote:
Originally Posted by Bertman123 View Post
Both entries in lilo point to the same initrd file, so I'm assuming that is the problem. Can lilo be able to boot into two different kernels without re-running mkinitrd commands each time?

Code:
mkinitrd -c -k 5.16.8 -f ext4...
The problem is the -c option which clears the modules of the previous kernel from the initrd. If you leave that out, mkinitrd adds modules for the new kernel without removing the old ones.
 
1 members found this post helpful.
Old 02-12-2022, 09:31 AM   #15
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by elcore View Post
It's because you're using insted of [code][/code].
OT: Sure you can have multiple initrd.gz just rename it initrd-01.gz, initrd-02.gz, etc, and edit boot config file to reflect that.
So when I run the command below, this is where I can rename the initrd?

Code:
mkinitrd -c -k 5.16.8 -f ext4 -r /dev/sda2 -m usb-storage:ums-realtek:xhci-hcd:xhci-pci:ohci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz
Instead of:

Code:
/boot/initrd.gz
I'd use something your example:

Code:
initrd-02.gz
and then edit lilo.conf as applicable?
 
  


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
Update to new kernel, do I need to build new kernel headers? deretsigernu Slackware 4 06-27-2017 03:32 AM
passwd.new, shadow.new, group.new and gshadow.new after upgrade to slackware 12.1 rhermsen Slackware 6 11-08-2008 04:59 PM
GRUB won't boot new kernel? Do I have a new kernel? Help! ttnunam Linux - General 8 11-15-2006 09:02 PM
booting new kernel. Booting new kernel dies with INIT: VFS issue, really mus335 Linux - General 0 04-21-2004 11:52 AM
A new kernel is out! A new kernel is out! A new kernel is out! Aussie Linux - General 9 11-29-2002 08:31 AM

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

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