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 03-14-2022, 09:14 PM   #1
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 228

Rep: Reputation: 45
How to upgrade kernels & its assundary other packages WITHOUT removing the old kernels ?


Hello All , The subject pretty much describes the dilemna .
ie: How to upgrade kernels & its associated (@GazL was: assundary) other packages WITHOUT removing the old kernels ?

Tia , JimL

Last edited by babydr; 03-15-2022 at 08:19 PM. Reason: A change , JUst a little too late , already flogged by all the criticism ;-)
 
Old 03-14-2022, 09:40 PM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
Use installpkg and not upgradepkg to have multiple kernels installed
 
Old 03-14-2022, 09:40 PM   #3
slac
Member
 
Registered: May 2019
Posts: 265

Rep: Reputation: Disabled
Using the command "installpkg" could be a good start. If you use "upgradepkg" then the pŕevious kernel package is going to be removed and replaced by package specified, but the command "installpkg" is not supposed to be remove anything so you will end up having two kernel images installed.
 
Old 03-14-2022, 09:57 PM   #4
zrdc28
Member
 
Registered: Dec 2007
Location: Alabama USA
Distribution: Slackware current
Posts: 309

Rep: Reputation: 55
When you do an upgrade-all go over and uncheck kernels, do the upgrade and see if it works. Then do a " slackpkg download kernels.* ", the new kernel will be downloaded, go to the location where the new kernel is located /var/cache/packages/slackware64/a and do a installpkg *.txz. That put the new kernel in the /boot directory copy it to lilo and leave the old one just in case.when you run lilo look for errors.if no errors you will have the old and the new.
 
1 members found this post helpful.
Old 03-15-2022, 01:16 AM   #5
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,972

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
This is what I normally have (sometimes a testing will be installed):
Code:
System.map -> System.map-generic-5.16.13
System.map-generic-5.16.12
System.map-generic-5.16.13
config -> config-generic-5.16.13.x64
config-generic-5.16.12.x64
config-generic-5.16.13.x64
initrd-tree/
initrd.gz
vmlinuz -> vmlinuz-generic-5.16.13
vmlinuz-generic -> vmlinuz-generic-5.16.13
vmlinuz-generic-5.16.12
vmlinuz-generic-5.16.13
vmlinuz-generic-stock -> vmlinuz-generic-5.16.13
vmlinuz-generic-working -> vmlinuz-generic-5.16.12
Kernel is blacklisted in /etc/slackpkg/blacklist:
Code:
kernel-generic
kernel-huge
kernel-modules
kernel-source
This is what I will be doing today to upgrade to kernel 5.16.14 after I run 'slackpkg update', 'slackpkg upgrade-all' (I use slackpkg with slackpkg+):

Code:
# From root.
# Uninstall two programs. This may be overkill but it is what I do based on experiences I have had.
bash /opt/VirtualBox/uninstall.sh
bash /home/non-slack/other/nvidia/NVIDIA-Linux-x86_64-390.147.run --uninstall.
# Now for the kernel.
cd /boot
USEBL=off slackpkg download kernel
# Deselect from the dialog, kernel-firmware, kernel-headers (already installed) and kernel-huge.
installpkg /var/cache/packages/slackware64/*/*.txz
rm /var/cache/packages/slackware64/*/*
mkinitrd -F -k 5.16.13:5.16.14
### Added this, forgot in my original post. I normally use mc to edit the syslink vice ln.
ln -sf vmlinuz-generic-5.16.14 vmlinuz-generic-stock
ln -sf vmlinuz-generic-5.16.13 vmlinuz-generic-working
lilo
reboot
After the reboot, log in as root, install both VirtualBox and the NVIDIA driver again and reboot again. I don't necessarily have to reboot here, but it is what I do.

If interested here is the relative section from my lilo.conf, this setup saves from having to edit lilo every time I install a new kernel, I just change symlinks in /boot/:
Code:
## kernel images
image=/boot/vmlinuz-generic-stock
  initrd=/boot/initrd.gz
  label=Slackware64
image=/boot/vmlinuz-generic-working
  optional
  initrd=/boot/initrd.gz
  label=LastWorking
image=/boot/vmlinuz-generic-testing
  optional
  initrd=/boot/initrd.gz
  label=Testing
Note: I normally remove the oldest "working" kernel, in this case 5.16.12 before I start or after I am done. Just depends on mode I guess.
Code:
removepkg /var/lib/pkgtools/packages/kernel*-5.16.12-*

Last edited by chrisretusn; 03-15-2022 at 05:19 AM. Reason: Add Note: - Edited added missed steps
 
3 members found this post helpful.
Old 03-15-2022, 02:14 AM   #6
andrew.46
Senior Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 1,365

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
You could compile and install the kernel manually and simply add the required entries into /etc/lilo.conf. On my own system:

Code:
andrew@ilium~$ cat /etc/lilo.conf | grep image
image = /boot/vmlinuz-5.16.7-ads
image = /boot/vmlinuz-generic-5.16.13
image = /boot/vmlinuz-huge-5.16.13
andrew@ilium~$
Works well enough here...
 
Old 03-15-2022, 02:39 AM   #7
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by chrisretusn View Post
This is what I normally have (sometimes a testing will be installed):
Code:
System.map -> System.map-generic-5.16.13
System.map-generic-5.16.12
System.map-generic-5.16.13
config -> config-generic-5.16.13.x64
config-generic-5.16.12.x64
config-generic-5.16.13.x64
initrd-tree/
initrd.gz
vmlinuz -> vmlinuz-generic-5.16.13
vmlinuz-generic -> vmlinuz-generic-5.16.13
vmlinuz-generic-5.16.12
vmlinuz-generic-5.16.13
vmlinuz-generic-stock -> vmlinuz-generic-5.16.13
vmlinuz-generic-working -> vmlinuz-generic-5.16.12
Kernel is blacklisted in /etc/slackpkg/blacklist:
Code:
kernel-generic
kernel-huge
kernel-modules
kernel-source
This is what I will be doing today to upgrade to kernel 5.16.14 after I run 'slackpkg update', 'slackpkg upgrade-all' (I use slackpkg with slackpkg+):

Code:
# From root.
# Uninstall two programs. This may be overkill but it is what I do based on experiences I have had.
bash /opt/VirtualBox/uninstall.sh
bash /home/non-slack/other/nvidia/NVIDIA-Linux-x86_64-390.147.run --uninstall.
# Now for the kernel.
cd /boot
USEBL=off slackpkg download kernel
# Deselect from the dialog, kernel-firmware, kernel-headers (already installed) and kernel-huge.
installpkg /var/cache/packages/slackware64/*/*.txz
rm /var/cache/packages/slackware64/*/*
mkinitrd -F -k 5.16.13:5.16.14
### Added this, forgot in my original post. I normally use mc to edit the syslink vice ln.
ln -sf vmlinuz-generic-5.16.14 vmlinuz-generic-stock
ln -sf vmlinuz-generic-5.16.13 vmlinuz-generic-working
lilo
reboot
After the reboot, log in as root, install both VirtualBox and the NVIDIA driver and reboot again. I don't necessarily have to reboot here, but it is what I do.

If interested here is the relative section from my lilo.conf:
Code:
## kernel images
image=/boot/vmlinuz-generic-stock
  initrd=/boot/initrd.gz
  label=Slackware64
image=/boot/vmlinuz-generic-working
  optional
  initrd=/boot/initrd.gz
  label=LastWorking
image=/boot/vmlinuz-generic-testing
  optional
  initrd=/boot/initrd.gz
  label=Testing
Note: I normally remove the oldest "working" kernel, in this case 5.16.12 before I start or after I am done. Just depends on mode I guess.

It is helpful to see how other people do this. Thanks chrisretusn

Last edited by amikoyan; 03-15-2022 at 08:02 AM.
 
2 members found this post helpful.
Old 03-15-2022, 04:05 AM   #8
twy
Member
 
Registered: Jun 2004
Distribution: Slackware64
Posts: 99

Rep: Reputation: Disabled
You should generate a different initrd.gz for each installed kernel, not use the same one for each. The kernel modules inside each initrd.gz needs to be kernel modules of the matching kernel.

My procedure for installing a kernel is this:
*) download the kernel tarball from kernel.org.
*) cd /usr/src
*) tar xvf ~/downloads/linux-5.15.28.tar.xz
*) chown -R root:root linux-5.15.28
*) cd linux-5.15.28
*) make mrproper
*) cp ../linux-5.15.27/.config .
# optional: copy .config from the slackware distribution instead
*) make oldconfig
*) optional:"make menuconfig" and say No to all drivers that you do not need to speed up the compile... this may take some time, so after you do it, you want to reuse your .config from then on; Say Yes to compile-in driver modules for important devices like hard drive controller and network card and any other drivers that might be important for booting. I compile-in all mdraid support, lvm support, fat/ext2/3/4 (filesystems) support etc. ALSA audio is fully (M) modules.
*) make -j6 bzImage
*) make -j6 modules
*) make modules_install
# this installs modules to /lib/modules/5.15.28/
# when removing a kernel, you have to remember to remove /lib/modules/x.y.z also
# when generating initrd.gz for a kernel, it copies certain modules from here
# as you list in mkinitrd.conf (modules that you need to boot and mount / (root), if any).
*) cp -a arch/x86/boot/bzImage /boot/vmlinuz-5.15.28
# this is how to install the kernel itself
*) cp -a System.map /boot/System.map-5.15.28
# this is used for debugging or compiling certain other stuff
*) pico /etc/lilo.config
# I use pico or vi editor
### add a lilo entry for the kernel such as
## default kernel slackware64-15.0
# 5.15.28
image = /boot/vmlinuz-5.15.28
root = /dev/ram0
initrd = /boot/initrd.gz-5.15.28
label = 5.15.28
read-only
###
### each kernel has an entry like this and you can have maybe 9 kernels installed

*) optional: mdadm -Es >> /etc/mdadm.conf
# this is if you have configured mdraid, and you need to have correct ARRAY lines in mdadm.conf.
# this only needs to be done once

*) optional: pico /etc/mkinitrd.conf
# this only needs to be done once...
### set options in mkinitrd.conf such as:
# mkinitrd.conf.sample
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
#CLEAR_TREE="0"
#OUTPUT_IMAGE="/boot/initrd.gz"
#KERNEL_VERSION="$(uname -r)"
#KEYMAP="us"
#MODULE_LIST="ext4"
LUKSDEV="/dev/md1"
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
ROOTDEV="/dev/cvg1/root"
ROOTFS="ext4"
#RESUMEDEV="/dev/sda2"
RAID="1"
LVM="1"
UDEV="1"
#MODCONF="0"
## load microcode, starting with linux 4.4.110
## to mitigate MELTDOWN and SPECTRE bugs
## The ASUS BIOS 1005 has microcode version 0x4
## Microcode release 20171117 installs version 0x7
## Microcode release 20180108 installs version 0x7 (no update)
MICROCODE_ARCH="/boot/intel-ucode.cpio"
#WAIT="1"

*) optional: install intel-microcode package from slackbuilds.org

*) cd /boot

*) Run mkinitrd... I use a little script "makeinitrd-kernel 5.15.28" for this:
#!/bin/bash
if [[ $1 = "" ]] ; then
echo "Usage: makeinitrd-kernel <kernel version number M.m.p>"
else
( cd /boot ; mkinitrd -F -c -k $1 -s /boot/initrd-tree-$1 -o /boot/initrd.gz-$1 )
fi
#########
/root/bin/makeinitrd-kernel 5.15.28

*) ls -1 /boot/
# partial listing...
System.map-4.4.302
System.map-5.15.26
System.map-5.15.27
System.map-5.15.28
initrd-tree-4.4.302/
initrd-tree-5.15.26/
initrd-tree-5.15.27/
initrd-tree-5.15.28/
initrd.gz-4.4.302
initrd.gz-5.15.26
initrd.gz-5.15.27
initrd.gz-5.15.28
intel-ucode.cpio
vmlinuz-4.4.302
vmlinuz-5.15.26
vmlinuz-5.15.27
vmlinuz-5.15.28

*) sync
# i tend to run sync to flush disks, just to make sure
*) lilo
# install lilo

My full lilo.conf is
####################
append=" vt.default_utf8=1 "
boot = /dev/md0
lba32
raid-extra-boot = mbr-only
compact
#default = Linux

# Boot BMP Image.
# Bitmap in BMP format: 640x480x8
# bitmap = /boot/slack.bmp
# Menu colors (foreground, background, shadow, highlighted
# foreground, highlighted background, highlighted shadow):
# bmp-colors = 255,0,255,0,255,0
# Location of the option table: location x, location y, number of
# columns, lines per column (max 15), "spill" (this is how many
# entries must be in the first column before the next begins to
# be used. We don't specify it here, as there's just one column.
# bmp-table = 60,6,1,16
# Timer location x, timer location y, foreground color,
# background color, shadow color.
# bmp-timer = 65,27,0,255

# Standard menu.
# Or, you can comment out the bitmap menu above and
# use a boot message with the standard menu:

message = /boot/boot_message.txt

# Wait until the timeout to boot (if commented out, boot the
# first entry immediately):

prompt

# Timeout before the first entry boots.
# This is given in tenths of a second, so 600 for every minute:

timeout = 1200

# Override dangerous defaults that rewrite the partition table:

change-rules
reset

# Normal VGA console

vga = normal

# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769

# End LILO global section
# Linux bootable partition config begins
#


## default kernel slackware64-15.0
# 5.15.28
image = /boot/vmlinuz-5.15.28
# addappend = " spec_store_bypass_disable=on "
root = /dev/ram0
initrd = /boot/initrd.gz-5.15.28
label = 5.15.28
read-only

## backup kernel slackware64-15.0
# 5.15.27
image = /boot/vmlinuz-5.15.27
# addappend = " spec_store_bypass_disable=on "
root = /dev/ram0
initrd = /boot/initrd.gz-5.15.27
label = 5.15.27b
read-only

## slackware kernel slackware64-15.0
# 5.15.27
image = /boot/vmlinuz-5.15.27
# addappend = " spec_store_bypass_disable=on "
root = /dev/ram0
initrd = /boot/initrd.gz-5.15.27
label = 5.15.27s
read-only



## default kernel slackware64-14.2 EOL
# 4.4.302
image = /boot/vmlinuz-4.4.302
# addappend = " spec_store_bypass_disable=on "
root = /dev/ram0
initrd = /boot/initrd.gz-4.4.302
label = 4.4.302
read-only



## notes on mitigations
# Since 4.4.110, we load microcode in initrd, and the kernel
# Linux bootable partition config ends
####################

*) [before rebooting, I uninstall the nvidia driver]
*) reboot
*) [after reboot, install the nvidia driver]
*) [reinstall chrome browser because something is messed up when changing kernels]

To remove a kernel that you are not running anymore (say 5.15.27), you have to remove its entry in lilo, then:
cd /usr/src/
rm -r linux-5.15.27
cd /lib/modules
rm -r 5.15.27
cd /boot
rm vmlinuz-5.15.27 System.map-5.15.27
rm -r initrd-tree-5.15.27
rm initrd.gz-5.15.27
sync
lilo

I think this is everything. Hope that helps.

Last edited by twy; 03-15-2022 at 04:11 AM. Reason: delete old junk
 
1 members found this post helpful.
Old 03-15-2022, 05:15 AM   #9
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,972

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
As I was updating to kernel 5.16.14 I realized I missed a step in my procedure in my post above. I have fixed that.

Last edited by chrisretusn; 03-16-2022 at 05:54 AM.
 
1 members found this post helpful.
Old 03-15-2022, 05:43 AM   #10
twy
Member
 
Registered: Jun 2004
Distribution: Slackware64
Posts: 99

Rep: Reputation: Disabled
Forgot to mention: I only install kernel-headers and kernel-firmware packages. The other kernel packages are uninstalled and blacklisted in my /etc/slackpkg/blacklist file. If slackware (Pat) upgrades kernel-headers or kernel-firmware then I upgrade them, otherwise I do not try to upgrade those myself.
 
Old 03-15-2022, 06:21 AM   #11
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
A quick and dirty approach would be to just rm /var/lib/pkgtools/packages/kernel-{huge,generic,modules}-$oldversion-* to take it out of package management.

This is particularly useful for the original kernel-modules package that comes with the install dvd. If you ever need to do a recovery by booting from the install-dvd — using root= or chrooting — then it's a good idea to still have present the matching set of kernel modules.

I don't know how slackpkg decides which of two installed same-named packages should be updated when a new package comes along, but my slackscan script will abort if it finds this situation as it's non-interactive and can't ask the user to resolve the ambiguity: so I have to use this approach. Most distro's packaging systems won't allow two packages with the same name to be installed at the same time; Slackware is unusual in that regard.
 
Old 03-15-2022, 07:51 AM   #12
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
As the development cycle for 15.0 dragged on I found that I had to upgrade numerous systems to current before the release of 15.0. That was an exercise in repetitious upgrade routines and lots of kernel upgrades on multiple systems.

I adopted a multi-kernel installation approach focused on leveraging slackpkg & slackpkg+. It started as autoslackpkg and now is named slackupdr, a dialog menu driven suite of bash scripts. https://www.go4it2day.com/news/slackupdr-3.2.html

The concept is similar to what others have already shared. Blacklist the kernel generic, huge, modules & source packages for "slackpkg upgrade-all" followed by "slackpkg download kernel" to install the new kernel files, create a new initrd, modify lilo/elilo config files to have access to the old & new kernels, copy new kernel files to the ESP or run lilo.

I use the scripts on all my slackware systems and each system has access to the latest kernel and at least 1 of the previous kernels. I plan to submit slackupdr to SBo when submissions open up.
 
Old 03-15-2022, 10:03 AM   #13
slackmensch
Member
 
Registered: Apr 2021
Location: hickville
Distribution: Arch, Normal, Poisson, Slackware, Manjaro
Posts: 50
Blog Entries: 7

Rep: Reputation: Disabled
What is "assundary?" Not listed in dict.org or OED. Do you mean "sundry"?
 
Old 03-15-2022, 11:16 AM   #14
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by slackmensch View Post
What is "assundary?" Not listed in dict.org or OED. Do you mean "sundry"?
As opposed to:
"Assundery" (adjective): being positioned below someone's A**
example:
That's one assundery chair.




Nope. "Sundry" would not be correct in this context either as it implies an indeterminate number of non-specific objects of unspecified relation, which is not the case here as the kernel related components are: of a known quantity, specific, and related (or at the very least associated).

I'd suggest "related" or perhaps "associated" would have been more correct if we're going to be pedantic about it.
 
1 members found this post helpful.
Old 03-16-2022, 01:33 AM   #15
truepatriot76
Member
 
Registered: Apr 2014
Location: California, USA
Distribution: slackware64-current
Posts: 231

Rep: Reputation: 195Reputation: 195
Very interesting, reading the many ways to do this above.

I use a backup/restore kernel management script that preserves a "user specified" number of previous, recent kernels - while deleting the old ones. Works seamlessly with slackpkg without the need to blacklist anything or have multiple kernel version packages installed. Can/should be run 'dry' for the initial backup and will accumulate kernels after running for each kernel update until the MAX is reached.

I'm still testing and tweaking it, but it's working well so far on four machines running current & 15.0 stable. Tested and works with minor kernel series change (attached)

It's set for Grub2 & creating versioned initrd's (I use Richard Cranium's grub2 script). Adapting it to lilo/elilo should be straight forward (although you may need to watch your space on the ESP partition with elilo)

If anyone wants to try it out, please see below. However, be warned... (use at your own risk!!!) If I butchered anything (wouldn't be the first time), please let me know.

Code:
#!/bin/bash
# Kernel Upgrade Backup & Restore Script by truepatriot76, in an effort to preserve what slackpkg discards
# when upgrading the kernel packages

VER=$(echo `find /boot/ -type f -iname vmlinuz* | sort -V | tail -n 1` | awk -F- '{print $NF}')
CWV=`uname -r`
MAX=10 #Maximum number of kernels to store

# Create kernel backup directory
if [ -d "/root/tmp-kernel" ]; then
	echo "Kernel backup directory exists"
else
	mkdir /root/tmp-kernel/
fi

# Sanity check
if [ $MAX -lt 2 ]; then
	echo "This is not the script for you"
	exit
fi

# Check if current running kernel has an update pending
if [ $VER = $CWV ]; then
	echo "No kernels to process"
	if [ -d "/root/tmp-kernel/$VER" ]; then
		echo "Backup module directory exists"
	else
		cp -fR /lib/modules/$VER/ /root/tmp-kernel/
	fi
	if [ -s "/root/tmp-kernel/System.map-generic-$VER" ]; then
		echo "Backup System.map exists"
	else
		cp /boot/System.map*$VER /root/tmp-kernel/
	fi
	if [ -s "/root/tmp-kernel/config-generic-$VER.x64" ]; then
		echo "Backup kernel config exists"
	else
		cp /boot/config*$VER* /root/tmp-kernel/
	fi
	if [ -s "/root/tmp-kernel/vmlinuz-generic-$VER" ]; then
		echo "Backup kernels exist"
	else
		cp /boot/vmlinuz*$VER /root/tmp-kernel/
	fi
	if [ -s "/boot/initrd-$VER.gz" ]; then
		echo "Versioned initrd exist"
	else
		$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -k $VER -r -a "-o /boot/initrd-$VER.gz")
	fi
	exit
fi

# restore and backup kernel files and modules
mv /root/tmp-kernel/$CWV/ /lib/modules/
mv /root/tmp-kernel/* /boot/
cp -fR /lib/modules/$VER/ /root/tmp-kernel/
cp /boot/System.map*$VER /root/tmp-kernel/
cp /boot/config*$VER* /root/tmp-kernel/
cp /boot/vmlinuz*$VER /root/tmp-kernel/

# delete oldest version if number of kernels exceeds max
NUM=`find /boot/ -type f -iname vmlinuz-generic* | wc -l`
while [ $NUM -gt $MAX ]; do 
	DELVER=`find /boot/ -type f -iname vmlinuz* | sort -V | head -n 1`
	DELVER=${DELVER#*-}
	DELVER=${DELVER#*-}
	echo "Deleting oldest kernel $DELVER ..."
	rm -fR /lib/modules/$DELVER
	rm /boot/*$DELVER*
	NUM=`find /boot/ -type f -iname vmlinuz-generic* | wc -l`
done

# create versioned initrd
$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -k $VER -r -a "-o /boot/initrd-$VER.gz")

# update grub
grub-mkconfig -o /boot/grub/grub.cfg
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2022-03-15 19-46-18.jpg
Views:	26
Size:	225.8 KB
ID:	38608  

Last edited by truepatriot76; 03-16-2022 at 01:37 AM.
 
  


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
Remove a package and all packages it depends on without breaking other packages? macroron Fedora 2 01-31-2010 05:49 PM
Ph&#7909;c h&#7891;i d&#7919; li&#7879;u b&#7883; m&#7845;t???, c&#7913; pollsite General 1 06-27-2005 12:39 PM
Removing old kernel and other packages installed DriveMeCrazy Red Hat 1 06-05-2004 09:40 PM
Can I remove a program without removing other packages? rykel Linux - Software 0 05-09-2004 03:39 AM
Gotta love those &#1649;&#1649;&#1649;&#1649;&#1649;&#1649;&#1649;&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

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

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