LinuxQuestions.org
Visit Jeremy's Blog.
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 09-05-2022, 09:24 AM   #1
the_penguinator
Member
 
Registered: Jan 2009
Location: Canada
Distribution: slackware, OpenBSD, OSX
Posts: 233

Rep: Reputation: 25
didn't update initrd before rebooting....I know...


Dumbass needs help. Did the latest kernel upgrade, didn't update the initrd, got busy...forgot, rebooted and you know the rest...I've tried to get access to the hard drive by booting a live disk but I can't seem to get access to the HD via the terminal once the live disk has fully booted. doing #fdisk -l only shows me the partitions on the disk not the HD so mounting anything is not possible. Using thunar to mount / gives an authorization error and blocks access. Can someone walk this old fart through the process or provide a link to the steps. Google has been no help. TIA
 
Old 09-05-2022, 10:15 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 14,244

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
Ok, you're locked out of your pc? What else have you got access to?
  • Alternative boot entry?
  • Other linux pc?
  • USB key?
  • Floppy Disk?
  • Windows PC?

Otherwise, I'd join a library .
 
1 members found this post helpful.
Old 09-05-2022, 10:23 AM   #3
giomat
Member
 
Registered: Jul 2017
Posts: 248

Rep: Reputation: Disabled
If you have a disk or USB key with the slackware installation iso, I suggest you to use it to chroot.
You can follow instructions in this page https://docs.slackware.com/howtos:sl...oot_from_media.

For my simple case (one root partition in /dev/sda1 and one swap partition in /dev/sda2), i just boot from the usb key, login as root (no passwd needed), then I execute the following:
Code:
 
mount /dev/sda1 /mnt
mount -o bind  /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys  /mnt/sys
chroot /mnt /bin/bash
Once you do this, you are effectively running on your original system and can issue commands to fix the initrd (run lilo etc.)

EDIT: it's strange though that thunar from the livecd does not allow you to mount the system partition. Did you have some kind of disk encryption set up?

Last edited by giomat; 09-05-2022 at 10:25 AM.
 
3 members found this post helpful.
Old 09-05-2022, 10:50 AM   #4
the_penguinator
Member
 
Registered: Jan 2009
Location: Canada
Distribution: slackware, OpenBSD, OSX
Posts: 233

Original Poster
Rep: Reputation: 25
update:
booted 15.0 install disk to command prompt
created and mounted the directories as suggested
did #chroot /mnt /bin/bash
got chroot: can't execute '/bin/bash': no such file or directory

call me puzzled...

check that: call me an idiot, / was /dev/sda2 not /dev/sda1
thanks for your help.

Last edited by the_penguinator; 09-05-2022 at 11:22 AM. Reason: updating seen errors
 
Old 09-06-2022, 08:25 PM   #5
truepatriot76
Member
 
Registered: Apr 2014
Location: California, USA
Distribution: slackware64-current
Posts: 205

Rep: Reputation: 169Reputation: 169
I think anyone that has used slackware for any length of time, has done this (followed by the customary forehead slap). If you use slackpkg and are adventuresome, you could modify

/usr/libexec/slackpkg/functions.d/post-functions.sh

to have it automatically generate the initrd for you upon a new kernel upgrade. Then, forget no more.... at least until the next slackpkg release/upgrade. I use it to call a kernel management script I'm testing, which among other things, creates an initrd.
 
4 members found this post helpful.
Old 09-17-2022, 07:18 AM   #6
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
To not forget it again you can use slackpkg+ and set PLUGIN_ZLOOKKERNEL=enable in slackpkgplus.conf

also you should configure 2 o 3 entry in boot loader:

1) kernel generic: the default, working with initrd
2) kernel huge: to use if you forgot to generate initrd after upgrading kernel
3) kernel safe: an old release of kernel huge that you will never upgrade, to use if you forgot to run lilo after upgrading kernel

However if you do not have particular lilo configuration, slackpkg+ is able to automatically rebuild initrd and run lilo.
 
3 members found this post helpful.
Old 09-18-2022, 09:22 AM   #7
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 198

Rep: Reputation: 109Reputation: 109
Quote:
Originally Posted by zerouno View Post
3) kernel safe: an old release of kernel huge that you will never upgrade, to use if you forgot to run lilo after upgrading kernel
I would like to take this precaution because I sometimes forget to run lilo.

I have a couple of questions about how to do it though.

Do I just have to copy vmlinuz-huge-5.19.9 to something like vmlinuz-safe? Or do I need to make copies of System.map-huge-5.19.9 or anything else?

I have no experience of doing this, so please assume you are explaining this to a complete novice. I would be very grateful for any tips.
 
Old 09-18-2022, 10:25 AM   #8
garpu
Senior Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 1,109

Rep: Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597
Just keep at least one other known good kernel installed. I generally keep the former version installed, then remove it when I install the next version. The one that I'm booting when I install the new one becomes my new backup. Make sense? Like 5.19.8 is my backup. This was the version I was booted from when I installed 5.19.9. When 5.19.10 comes, 5.19.9 will be my backup. I've got kernel-modules and kernel-huge blacklisted. (Or kernel-generic, if that's what you use.)

I've forgotten to copy the new kernel to /boot/efi before, while changing the default kernel to the new one, which I neglected to copy. No problem. Boot the old kernel, mount /boot/efi, copy the new one, make sure I got everything correct, then reboot. I've also forgotten to install modules. You find out quickly that you screwed that one up, if you don't have USB for your keyboard. (Huge will boot without the module package installed. You just can't do much after it boots.)

Also, if you're using nvidia binaries, you can do -K to the installer to just install the kernel modules for the new kernel. That way you have the old modules for your old kernel.

If you're using an initrd, don't forget to keep the initrd for the old kernel around, too. When I was using them, I'd name them something like initrd9.gz for 5.19.9.
 
3 members found this post helpful.
Old 09-18-2022, 01:37 PM   #9
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Originally Posted by amikoyan View Post
Do I just have to copy vmlinuz-huge-5.19.9 to something like vmlinuz-safe?
exactly

optionally you may keep a copy of kernel modules. It is not needed but if you don't do it you may miss some driver (usually you are unable to running a graphical enviroment)
For this, simply edit /var/log/packages/kernel-modules-5.19.9-x86_64-1
and remove all lib/modules rows, so next upgrade will not remove it.

If you want you can use the same way for the vmlinuz in /var/log/packages/kernel-huge-5.19.9-x86_64-1
 
1 members found this post helpful.
Old 09-18-2022, 02:39 PM   #10
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 198

Rep: Reputation: 109Reputation: 109
Quote:
Originally Posted by zerouno View Post
exactly

optionally you may keep a copy of kernel modules. It is not needed but if you don't do it you may miss some driver (usually you are unable to running a graphical enviroment)
For this, simply edit /var/log/packages/kernel-modules-5.19.9-x86_64-1
and remove all lib/modules rows, so next upgrade will not remove it.

If you want you can use the same way for the vmlinuz in /var/log/packages/kernel-huge-5.19.9-x86_64-1
Is it okay to edit /var/log/packages/kernel-modules-5.19.9-x86_64-1 now? I will not need it unedited again?

Also I do not have any kernel entries blacklisted in slackpkg.conf. I prefer to just let slackpkg handle the upgrade - laziness!
 
Old 09-18-2022, 03:02 PM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 10,531

Rep: Reputation: Disabled
Quote:
Originally Posted by zerouno View Post
For this, simply edit /var/log/packages/kernel-modules-5.19.9-x86_64-1
and remove all lib/modules rows, so next upgrade will not remove it.

If you want you can use the same way for the vmlinuz in /var/log/packages/kernel-huge-5.19.9-x86_64-1
So putting the packages' database out of sync with what is actually installed? I would never give such an advice.
 
1 members found this post helpful.
Old 09-18-2022, 03:51 PM   #12
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 5,942
Blog Entries: 23

Rep: Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922Reputation: 3922
Post #8 by garpu is the way to go in my opinion.

Whether Lilo or now EFI, simply keep a working kernel stanza always installed. Then almost no matter what else you do, you will have something bootable.

Then to install a new kernel and initrd use installpkg to install it and create or update a corresponding boot stanza. Only after it is working use removepkg to remove the previous main kernel, or leave it in place and make it the new fallback.
 
1 members found this post helpful.
Old 09-18-2022, 04:29 PM   #13
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 198

Rep: Reputation: 109Reputation: 109
Quote:
Originally Posted by astrogeek View Post
Post #8 by garpu is the way to go in my opinion.

Whether Lilo or now EFI, simply keep a working kernel stanza always installed. Then almost no matter what else you do, you will have something bootable.

Then to install a new kernel and initrd use installpkg to install it and create or update a corresponding boot stanza. Only after it is working use removepkg to remove the previous main kernel, or leave it in place and make it the new fallback.
Yes, after thinking about this for a while, this does make sense. So if I understand correctly: blacklist kernel entries in slackpkg.conf, use installpkg to manually install a new kernel, check it works and then relegate the old kernel to the fallback, use removepkg to get rid of redundant fallback kernels.
Thanks for the advice everyone
 
Old 09-18-2022, 04:44 PM   #14
truepatriot76
Member
 
Registered: Apr 2014
Location: California, USA
Distribution: slackware64-current
Posts: 205

Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by amikoyan View Post
Yes, after thinking about this for a while, this does make sense. So if I understand correctly: blacklist kernel entries in slackpkg.conf, use installpkg to manually install a new kernel, check it works and then relegate the old kernel to the fallback, use removepkg to get rid of redundant fallback kernels.
Thanks for the advice everyone
No need - just install one of the previous kernel packages here --> https://slackware.uk/cumulative/

Tadgy has just recently expanded it to include stable

Nowadays, slackpkg allows multiple versions of packages.
 
1 members found this post helpful.
Old 09-18-2022, 05:18 PM   #15
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Originally Posted by amikoyan
Is it okay to edit /var/log/packages/kernel-modules-5.19.9-x86_64-1 now? I will not need it unedited again?

Also I do not have any kernel entries blacklisted in slackpkg.conf. I prefer to just let slackpkg handle the upgrade - laziness!
Quote:
So putting the packages' database out of sync with what is actually installed? I would never give such an advice.

There are the same way to do the same thing. What I explained is the fastest to avoid to explain the manual procedure. Also it preserves custom manually build modules (virtualbox, nvidia, other drivers,...)
However I am going to explain the manual procedure.
Both procedures will allow to use slackpkg without blacklist the kernel.

Note: if you don't need kernel modules (you may have a sufficent working system to repair lilo then restart with the new kernel) you don't need any procedure, just copy vmlinuz-huge as vmlinuz-safe and put an entry in lilo and you will have finished.


In the previous explained procedure you will have as safe kernel the currently installed 5.19.9; in the following procedure you will have as safe kernel a 5.19.8
The reason is that nor the kernel nor the kernel modules will have not to be in /var/log/packages/* to avoid to delete it with an upgrade.

so download the kernel huge 5.19.8 and kernel modules 5.19.8

https://slackware.uk/cumulative/slac...8-x86_64-1.txz
https://slackware.uk/cumulative/slac...8-x86_64-1.txz

expand it in a temporary folder
copy kernel modules in /lib/modules
copy kernel huge in /boot
put an entry in lilo.conf

Code:
### download 5.19.8 packages
# mkdir kerneltemp
# cd kerneltemp
# wget https://slackware.uk/cumulative/slackware64-current/slackware64/a/kernel-huge-5.19.8-x86_64-1.txz
# wget https://slackware.uk/cumulative/slackware64-current/slackware64/a/kernel-modules-5.19.8-x86_64-1.txz
### extract it
# explodepkg kernel-huge-5.19.8-x86_64-1.txz
# explodepkg kernel-modules-5.19.8-x86_64-1.txz
### be sure there are no refused files from precedent package
# rm -rf /lib/modules/5.19.8
### install the modules
# mv lib/modules/5.19.8 /lib/modules
### install the kernel image
# mv boot/vmlinuz-huge-5.19.8 /boot/vmlinuz-safe-5.19.8
### now edit lilo.conf
# vi /etc/lilo.conf
### add
image = /boot/vmlinuz-safe-5.19.8
  root = /dev/XXXX
  label = Safe
  read-only
### run lilo
# lilo -v
when you will upgrade the current kernel, upgradepkg just will remove the 5.19.9 files.
when you will forget to create initrd and run lilo, the /boot/map will contain the physical address of vmlinuz-safe-5.19.8; at boot uname -r will return 5.19.8 so the kernel will load all modules from /lib/modules/5.19.8

alternative procedure if currently /lib/modules/5.19.8 does exists and contain custom modules and you want to preserve it:

Code:
### download 5.19.8 packages
# mkdir kerneltemp
# cd kerneltemp
# wget https://slackware.uk/cumulative/slackware64-current/slackware64/a/kernel-huge-5.19.8-x86_64-1.txz
# wget https://slackware.uk/cumulative/slackware64-current/slackware64/a/kernel-modules-5.19.8-x86_64-1.txz
### extract it
# explodepkg kernel-huge-5.19.8-x86_64-1.txz
# explodepkg kernel-modules-5.19.8-x86_64-1.txz
### install the modules
# cp -auv lib/modules/5.19.8 /lib/modules
# rm -f /lib/modules/5.19.8/modules.dep
### install the kernel image
# mv boot/vmlinuz-huge-5.19.8 /boot/vmlinuz-safe-5.19.8
### now edit lilo.conf
# vi /etc/lilo.conf
### add
image = /boot/vmlinuz-safe-5.19.8
  root = /dev/XXXX
  label = Safe
  read-only
### run lilo
# lilo -v
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] After -current upgrade, I forgot to update lilo before rebooting! textillis Slackware - Installation 2 07-03-2013 02:53 AM
to initrd or not to initrd... svu Slackware 31 10-05-2011 07:17 PM
How to create new initrd.gz (or initrd.img) file? kkpal Programming 2 12-10-2007 08:38 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM
[gentoo[not specific]] didn't manage using initrd MD3 Linux - Distributions 0 07-04-2005 11:04 AM

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

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