LinuxQuestions.org
Visit Jeremy's Blog.
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, 09:33 AM   #16
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77

Quote:
Originally Posted by Petri Kaukasoina View Post
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.
Ah, okay. That makes sense, I'll try that. Thanks.
 
Old 02-12-2022, 09:42 AM   #17
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
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.
As I said I don't use initrd, but the boot manager should be able to boot another kernel with another initrd. In most distroes I have tried, initrd also takes on a version number corresponding with the relevant Kernel, and that initrd is used in the boot manager to boot the Kernel with that particular initrd.

You could replicated that process, probably by doing like was said in a previous thread and back up your old initrd.
 
1 members found this post helpful.
Old 02-12-2022, 09:44 AM   #18
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Removing the -c option from the command below seems to have fixed my issue and I can now boot from both kernels. Thank you all for your help.

Code:
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
This brings up another question, though. What does geninitrd do? I read that this is new to 15, but I am not sure what it does exactly and if it's something that I need to use.
 
1 members found this post helpful.
Old 02-12-2022, 09:50 AM   #19
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
As I said I don't use initrd, but the boot manager should be able to boot another kernel with another initrd. In most distroes I have tried, initrd also takes on a version number corresponding with the relevant Kernel, and that initrd is used in the boot manager to boot the Kernel with that particular initrd.

You could replicated that process, probably by doing like was said in a previous thread and back up your old initrd.
I wonder if making a new initrd file (/boot/initrd.gz) would be a better way to go?
 
Old 02-12-2022, 09:53 AM   #20
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Petri Kaukasoina View Post
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.
Removing the -c option did fix my problem. Thanks. This made me think if creating a new initrd file (/boot/initrd01.gz) for each kernel would be a better way to go, or would using the -c option complicate things for that as well?
 
Old 02-12-2022, 10:15 AM   #21
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,938

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
Or you could clean old stuff and add modules for two kernel versions in one go:
Code:
mkinitrd -c -k 5.15.19:5.16.8 -f ext4 -r /dev/sda2 -m ext4 -o /boot/initrd.gz
(mkinitrd_command_generator.sh makes a long list of modules but usually it's enough to include the module for the root file system. YMMV.)
 
4 members found this post helpful.
Old 02-12-2022, 10:23 AM   #22
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,938

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
Quote:
Originally Posted by Bertman123 View Post
This brings up another question, though. What does geninitrd do? I read that this is new to 15, but I am not sure what it does exactly and if it's something that I need to use.
It seems to me that it automatically looks which generic kernels you have installed and builds an initrd which contains the needed modules for all of them in one initrd, just like what you did, but automatically. No manual mkinitrd_command_generator.sh or mkinitrd commands needed.
 
Old 02-12-2022, 10:29 AM   #23
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Petri Kaukasoina View Post
It seems to me that it automatically looks which generic kernels you have installed and builds an initrd which contains the needed modules for all of them in one initrd, just like what you did, but automatically. No manual mkinitrd_command_generator.sh or mkinitrd commands needed.
That's what I thought as well. Must be more useful for grub, I would think. Otherwise how would you update lilo if you use the geninitrd command?
 
Old 02-12-2022, 10:34 AM   #24
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Petri Kaukasoina View Post
Or you could clean old stuff and add modules for two kernel versions in one go:
Code:
mkinitrd -c -k 5.15.19:5.16.8 -f ext4 -r /dev/sda2 -m ext4 -o /boot/initrd.gz
(mkinitrd_command_generator.sh makes a long list of modules but usually it's enough to include the module for the root file system. YMMV.)
That's a good idea as well. Thanks.
 
Old 02-12-2022, 10:41 AM   #25
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,938

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
You can edit /etc/lilo.conf using a text editor. It's simple to change the 'image' lines to point to the file names of the correct kernels, and to change 'label' lines to contain suitable labels for them.
 
2 members found this post helpful.
Old 02-12-2022, 10:59 AM   #26
JayByrd
Member
 
Registered: Aug 2021
Location: Seattle, WA
Distribution: Slackware
Posts: 302

Rep: Reputation: 310Reputation: 310Reputation: 310Reputation: 310
Quote:
Originally Posted by Petri Kaukasoina View Post
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.
Thanks for this, Petri. Even after all these years, I had never even considered this! I guess I had always just assumed that building a distinct initrd was required for each kernel installed.

On the few boxes where I actually keep multiple kernels, I've always done something like this:
Code:
NEW_KERN=5.16.5
mkinitrd -c -k $NEW_KERN -m ext4 -o /boot/initrd-$NEW_KERN.gz
and then edited lilo.conf accordingly.

Both methods you describe--specifying multiple kernels with the "-k" or running mkinitrd without "-c" so as to add modules to the existing initrd-tree--sound great! A single initrd.gz image that handles all the installed kernels? Awesome.

Last edited by JayByrd; 02-12-2022 at 11:23 AM. Reason: correction.
 
Old 02-12-2022, 11:18 AM   #27
Bertman123
Member
 
Registered: Jun 2010
Distribution: Slackware Current 64 bit KDE 5
Posts: 380

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Petri Kaukasoina View Post
You can edit /etc/lilo.conf using a text editor. It's simple to change the 'image' lines to point to the file names of the correct kernels, and to change 'label' lines to contain suitable labels for them.
Okay, I tested this out on my laptop, also running 15.0 stable.

I used the geninitrd command instead of mkinitrd.sh command and then just had to add the entry in lilo.conf for the 5.15.19 kernel (copied from my tower) and everything works nicely. I haven't tried installing a new kernel yet, I'll try that next and will see if the geninitrd command is enough for the new kernel as well.
 
Old 02-12-2022, 11:43 AM   #28
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
Okay, I tested this out on my laptop, also running 15.0 stable.

I used the geninitrd command instead of mkinitrd.sh command and then just had to add the entry in lilo.conf for the 5.15.19 kernel (copied from my tower) and everything works nicely. I haven't tried installing a new kernel yet, I'll try that next and will see if the geninitrd command is enough for the new kernel as well.
When installing a new kernel geninitrd will just generate the initrd for the new kernel only. The mkinitrd command is still needed, but without the -c option. Once I used the mkinitrd command for both kernels I could log into both of them. Though I cannot boot into the huge kernel as I am getting kernel panic (on my laptop), but as long as the generic kernels work I will be uninstalling the huge kernel on my laptop, I already uninstalled it on my tower.
 
Old 02-12-2022, 12:08 PM   #29
fourtysixandtwo
Member
 
Registered: Jun 2021
Location: Alberta
Distribution: Slackware...mostly
Posts: 328

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Bertman123 View Post
When installing a new kernel geninitrd will just generate the initrd for the new kernel only. The mkinitrd command is still needed, but without the -c option. Once I used the mkinitrd command for both kernels I could log into both of them. Though I cannot boot into the huge kernel as I am getting kernel panic (on my laptop), but as long as the generic kernels work I will be uninstalling the huge kernel on my laptop, I already uninstalled it on my tower.
The other option is to just modify grub.cfg. I do the following and this only makes changes to the first menuentry section.

Code:
#modify as needed for specific kernel
/usr/sbin/grub-mkconfig | sed '/^menuentry/,/^}/{s/5.15.19/5.16.8/; s/vmlinuz\-huge\-/vmlinuz\-generic\-/}' > /boot/grub/grub.cfg
 
Old 02-12-2022, 12:36 PM   #30
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,938

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
It's also possible to 'cp /etc/mkinitrd.conf.sample /etc/mkinitrd.conf' and then just once edit /etc/mkinitrd.conf to contain the list of module names and other unchanging options and then simply run 'mkinitrd -F -k 5.16.8' to make initrd after kernel upgrades. (-F for using values from mkinitrd.conf).
 
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
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 12:09 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