Bash script for Ubuntu (and derivatives) to easily (un)install kernels from the Ubuntu Kernel PPA
Switch branches/tags
Nothing to show
Clone or download
Latest commit 266cdb7 Dec 14, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information. fix: use wget to download from https host Dec 14, 2018
UbuntuMainlineKernel.desktop Initial commit Dec 13, 2016 shellcheck: add quotes Dec 14, 2018

Bash script for Ubuntu (and derivatives as LinuxMint) to easily (un)install kernels from the Ubuntu Kernel PPA.


chmod +x
sudo mv /usr/local/bin/
apt install wget

If you want to automatically check for a new kernel version when you login:

mv UbuntuMainlineKernel.desktop ~/.config/autostart/


Use this script at your own risk. You could remove all kernels with this script and leave your system unbootable. There are no safeguards that at least one kernel is installed on your system. Be especially careful with the --yes option.


Usage: ./ -c|-l|-r|-u

Download & install the latest kernel available from

  -c               Check if a newer kernel version is available
  -i [VERSION]     Install kernel VERSION, see -l for list. You dont have to prefix
                   with v. E.g. -i 4.9 is the same as -i v4.9. If version is
                   omitted the latest available version will be installed
  -l [SEARCH]      List locally installedkernel versions. If an argument to this
                   option is supplied it will search for that
  -r [SEARCH]      List available kernel versions. If an argument to this option
                   is supplied it will search for that
  -u [VERSION]     Uninstall the specified kernel version. If version is omitted,
                   a list of max 10 installed kernel versions is displayed
  -h               Show this message

  -p, --path DIR       The working directory, .deb files will be downloaded into 
                       this folder. If omitted, the folder /tmp/ 
                       is used. Path is relative from $PWD
  -ll, --low-latency   Use the low-latency version of the kernel, only for amd64 & i386
  -lpae, --lpae        Use the Large Physical Address Extension kernel, only for armhf
  -do, --download-only Only download the deb files, do not install them
  -ns, --no-signature  Do not check the gpg signature of the checksums file
  -nc, --no-checksum   Do not check the sha checksums of the .deb files
  -d, --debug          Show debug information, all internal command's echo their output
  --rc                 Also include release candidates
  --yes                Assume yes on all questions (use with caution!)

Example output

Install latest version:

 ~ $ ./ -i
Finding latest version available on
Latest version is v4.9.0 but seems its already installed, continue? (y/N) 
Will download 5 files from
Signature of checksum file has been succesfully verified
Checksums of deb files have been succesfully verified with sha256sum
Installing 3 packages
[sudo] password for pimlie: 
Cleaning up work folder

Uninstall a version from a list

 ~ $ ./ -u
Which kernel version do you wish to uninstall?
[0]: v4.8.6-040806
[1]: v4.8.8-040808
[2]: v4.9.0-040900
type the number between []: 0
Are you sure you wish to remove kernel version v4.8.6-040806? (y/N)
The following packages will be removed: 
linux-headers-4.8.6-040806-generic:amd64 linux-headers-4.8.6-040806-generic:all linux-image-4.8.6-040806-generic:amd64
Are you really sure? (y/N)
[sudo] password for pimlie: 
Kernel v4.8.6 succesfully purged


  • bash
  • gnucoreutils
  • dpkg
  • wget (since 2018-12-14 as kernel ppa is now https only)

Optional dependencies

  • libnotify-bin (to show notify bubble when new version is found)
  • bsdmainutils (format output of -l, -r with column)
  • gpg (to check the signature of the checksum file)
  • sha1sum/sha256sum (to check the .deb checksums)
  • sudo


  • Support daily kernel builds (on hold untill there is significant demand for this, PRs are also welcome)