kittykernel - a little GUI for managing kernels

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Schallaven

kittykernel - a little GUI for managing kernels

Post by Schallaven »

Hello!

I wrote myself a little tool for managing kernels on Mint (and another Ubuntu machine actually) and thought maybe someone else might also find it handy. Thus, I am sharing :) Find the tool at: https://github.com/Schallaven/kittykernel

Features:
  • Manages kernels with a handy GUI
  • Can install all kernels available in repos (e.g. low-latency)
  • Can remove and/or purge multiple kernels to clean up /boot (this was actually the driving point for writing this)
  • If available: scrolls to the currently selected kernel in the changelog
  • Convinces users by using an alliteration for its name
At the moment it uses synaptic for installing packages (it provides a handy interface to have progress-dialogs, etc), but that might change in future.

Impression:
kittykernelimpression.png
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Pjotr
Level 23
Level 23
Posts: 19884
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: kittykernel - a little GUI for managing kernels

Post by Pjotr »

Sounds cool! :)

When it comes to removing old kernels, in what respects does it differ from purge-old-kernels?

Code: Select all

#!/bin/sh
#
#    purge-old-kernels - remove old kernel packages
#    Copyright (C) 2012 Dustin Kirkland <kirkland@ubuntu.com>
#
#    Authors: Dustin Kirkland <kirkland@ubuntu.com>
#             Kees Cook <kees@ubuntu.com>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Ensure we're running as root
if [ "$(id -u)" != 0 ]; then
	echo "ERROR: This script must run as root.  Hint..." 1>&2
	echo "  sudo $0 $@" 1>&2
	exit 1
fi

# NOTE: This script will ALWAYS keep the currently running kernel
# NOTE: Default is to keep 2 more, user overrides with --keep N
KEEP=2
# NOTE: Any unrecognized option will be passed straight through to apt
APT_OPTS=
while [ ! -z "$1" ]; do
	case "$1" in
		--keep)
			# User specified the number of kernels to keep
			KEEP="$2"
			shift 2
		;;
		*)
			APT_OPTS="$APT_OPTS $1"
			shift 1
		;;
	esac
done

# Build our list of kernel packages to purge
CANDIDATES=$(ls -tr /boot/vmlinuz-* | head -n -${KEEP} | grep -v "$(uname -r)$" | cut -d- -f2- | awk '{print "linux-image-" $0 " linux-headers-" $0}' )
for c in $CANDIDATES; do
	dpkg-query -s "$c" >/dev/null 2>&1 && PURGE="$PURGE $c"
done

if [ -z "$PURGE" ]; then
	echo "No kernels are eligible for removal"
	exit 0
fi

apt $APT_OPTS remove --purge $PURGE
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Schallaven

Re: kittykernel - a little GUI for managing kernels

Post by Schallaven »

For me, I moved from 4.4 through 4.8 to 4.10 now, and might in future go to 4.11 (actually waiting for 4.12). I wanted to keep always the last generation/line of kernels, prior to my current one. So, if I want just to purge 4.4-line, I can do that by right clicking on 4.4, choose the respective option, and done. As far as I can see, the script does not do this.

In future, I want to add some handy features like "hiding this line", so I don't see anything from 4.4 anymore, for example. Small, handy things (or look for example that it shows the /boot size and the current kernel above the list, etc.)

But in the end, you can always ask such things as "Why do people use software manager instead of apt-get install?" or similar. Because people differ in taste and requirements. Same here, I think :)
mrmajik45

Re: kittykernel - a little GUI for managing kernels

Post by mrmajik45 »

Cool Program! If you learn a bit more about linux you might be able to use something as than synaptic for the installer
:D :D :D
User avatar
zshlover
Level 1
Level 1
Posts: 31
Joined: Sun Jul 05, 2020 8:34 am

Re: kittykernel - a little GUI for managing kernels

Post by zshlover »

Wow this is pretty neat! I remember Manjaro had something like this, but I'm not to big of a fan of the rolling release model
Learn Python: pythonspot.com, pyqt
User avatar
Pjotr
Level 23
Level 23
Posts: 19884
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: kittykernel - a little GUI for managing kernels

Post by Pjotr »

zshlover wrote: Sun Jul 05, 2020 9:08 am Wow this is pretty neat! I remember Manjaro had something like this, but I'm not to big of a fan of the rolling release model
Why are you drawing attention to software that hasn't been updated in years? Whereas the kernel tool in Mint's very own Update Manager does the same job nowadays?
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Locked

Return to “Programming & Development”