What is Ubuntu's policy on keeping old kernels


I have often ran into the trouble of not enough space in my /boot directory when I am processing updates. For others who have run into this issue here is how to purge old kernels from your system and grub configuration.

While updating servers you may run into an error like this

Errors were encountered while processing:



E: Sub-process /usr/bin/dpkg returned an error code (1)

Usually this means the /boot partition is full of old kernels you can check by doing:

#> df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/backups–vg-root 133G 35G 92G 28% /

udev 747M 4.0K 747M 1% /dev

tmpfs 151M 452K 151M 1% /run

none 5.0M 0 5.0M 0% /run/lock

none 755M 68K 755M 1%...

0 0

IMHO if you think manually removing kernels is too difficult, you should not trust an automated script either,, there are cases where even the last 2 versions are bad for specific hardware configurations, especially people who rely on 3rd party drivers.

Centos/Redhat has a strong/ adherence to ABI/API stability, but in the Debian world (and as Ubuntu imports from Debian and adds it own patches to further complicate things) there are official versions that do not have the guarantee (testing/unstable/experimental) of ABI/API stability, so its harder to have a keep the most recent 3 kernel versions (espcially as you can upgrade between stable to testing and testing to unstable).

The script may work for you, but definitely not good advice to use for anyone who does not have the understanding to know a good kernel from a bad one.

Click to...

0 0

Every month are new kernel updates, bug fixes and patches security system. If you regularly update your system, then your system gradually accumulates more the number of unused old kernels.

Thus, it is likely that the boot partition /boot on the hard drive will be filled in a certain period of time. If your /boot partition is full, you will not be able to upgrade, or can't even do a kernel upgrade to any latest available version. In this case, it is very important to regularly update the kernel and software. For this you must have enough free space in the /boot partition. To system to function correctly, you must have enough free space on the /boot and /root partitions.

We can easily remove the accumulated system cache, unwanted packages and dependencies using the following commands:

sudo apt-get autoremove sudo apt-get autoclean

But the problem is that this works only if the kernel was installed automatically, or if you installed them using the Update...

0 0
Post by Ralf Mardorf

It's not a problem, but removing outdated kernels has to be done

manually on my install from the server image. I suspect that if dkms is

involved, then there also is the need to run dkms and to rm -r what is

kept in /lib/modules, at least if you not only want to tidy up /boot.

Description: Ubuntu 15.10

Codename: wily

linux" /root/.bash_history|tail -n3 apt-get purge

linux-{headers,image}-4.2.0-14-lowlatency linux-headers-4.2.0-14

apt-get purge linux-{headers,image}-4.2.0-15-lowlatency

linux-headers-4.2.0-15 apt-get purge

linux-{headers,image}-4.2.0-18-lowlatency linux-headers-4.2.0-18

I keep my Rt kernel(s) and the latest lowlatency.

total 8.0K

drwxr-xr-x 3 root root 4.0K Aug 23 09:25 3.10.61-rt65-1-moonstudio

drwxr-xr-x 5 root root 4.0K Dec 1 14:45 4.2.0-19-lowlatency

Perhaps my install is missing a script, since at least one kernel

0 0

For LVM, encrypted, or limited-storage systems, you need to regularly remove old kernels to prevent your computer (/boot partition) from running out of storage space.

Removing old kernels is easy. You can do it manually, or set unattended-upgrades to do it automatically. For details, open terminal from App Launcher or via Ctrl+Alt+T shortcut keys, and follow the steps below:

Remove Automatically Installed Kernels:

1. To remove the kernels that were automatically installed via regular system updates, open terminal and run:

sudo apt autoremove --purge

It will ask you to type in user password and then remove old kernels as well as other automatically installed packages that are no longer needed.

2. To enable automatic removing of old kernels:

Enable Kernel autoremoving may cause problems if your package management is broken, see

this bug


Run command to enable unattended upgrades. For Desktop Ubuntu 16.04, this...
0 0

The Ubuntu Kernel team will release new Kernel updates, bug fixes, and security patches every month. If you are a long-time Ubuntu user, and regularly updating your Ubuntu system, then it might be accumulated with lot of unused and old Kernels. So, there are chances that the /boot partition in your hard disk will run out of disk space over a period of time. If your /boot partition is full, you can’t upgrade the system or you can’t even upgrade your Kernel to any latest available version. This is no good, and it is very important to regularly update your Kernel and softwares. To do so, You should have enough free space in the /boot partition. This is why it is always a good practice to remove unused Kernels, unnecessary packages, dependencies, and system cache periodically. Keep in mind that in order to function Ubuntu system properly, you must have enough free space in /boot and /root partitions.

Of course, We can easily wipe out the system cache, unneeded packages and...

0 0

Old Linux kernels can take up a considerable amount of disk space. Apt ("sudo apt-get autoremove") tries to remove uneeded packages, including old Linux kernels, but it may fail to remove all of them.

Apt may fail to remove old Linux kernels when using an Ubuntu version that's under development, if you encounter


bug (which still occurs in Trusty), or if you've installed the kernels manually.

There are various commands out there for mass removing old Linux kernels, but they complicated (and hard to remember), and not all are safe. So what's the safest way of mass purging old Linux kernels in Ubuntu? Well,


to Dustin Kirkland, it's the "purge-old-kernels" command.


purge-old-kernelsman page

mentions that the command will never remove the currently running kernel. Also, by default, it will keep at least the latest 2 kernels, but you can override this using the "--keep" parameter (for instance "--keep 1" to...

0 0

Looking down ftp://ftp.kernel.org/pub/linux/kernel/v3.x , it seems to be 3.8.13.

I've repeated my comment as an answer so I can warn you against this. I do have production systems which use hand-built kernels, because there are compelling business reasons to use them, but they are a huge maintenance overhead. I don't yet understand why you think you need to do this, but I can say with some certainty that it will be a lot of time and effort for you.

I don't know ubuntu's support policies, but my understanding is that as long as 12.04 is in support, you can expect to find any important fixes from later kernels back-ported into the repositories, so just doing an apt-get upgrade should fix any security issues. Once the OS falls out of support, you have bigger problems than the kernel falling out of rev, and need to arrange and upgrade as a matter of priority; just keeping the kernel updated won't keep you secure.

In addition, on some Red Hat systems I've done this...

0 0

I've written a new POST that shows a one-Liner bash command that will remove the kernels from your Old System in one STEP. Co., Food Check it out here .
I wrote an article, shows a bash command line, teach you step delete your system with the old kernel. You can see here .

If you've been using Ubuntu Linux for a while, then you probably have a number of Linux kernel updates that have been installed on your system. (I've got a total of 3 kernels in my Karmic system already.) In all likelihood , these updates get installed and you boot into the latest kernel, never to use the older kernels again. But these old kernels are still hanging around on your system, cluttering up your grub boot screen and taking up space on your hard drive.
If you have been using for some time, Ubuntu Linux, then you might have when updating your system installed on several Linux kernel (in my Karmic version I have a total of three versions of the kernel). A strong possibility that these...

0 0

One of the strengths of Ubuntu is its stability. Each bit of software included inside releases are vigorously tested. They are essentially “snapshots” in time. Everything stays stable. This method has proven to be very effective. Ubuntu is used heavily in work and production environments as a result of this. This is great for most users, but for advanced users looking to get the latest and the greatest, this can be a bit of a drawback.

For the most part, new software can be added to Ubuntu with the help of personal package archives (PPAs). These methods of distribution can cut through Ubuntu’s “snapshot” method and allow newer, more current software to be easily delivered. Power users often turn to this to make their installations more “bleeding edge” than before.

Still, this is not very true for every aspect of Ubuntu, especially when it comes to the Linux kernel. This is because each version of Ubuntu ships with a frozen kernel. This means that during development,...

0 0

On Thu, 6 Oct 2011, Doug Stewart wrote:

> Thanks Gord, I have now done this. but I thought there was a more automatic
> way that when you install a new one it would only keep the latest 2 or 3
> and delete the older ones automatically

I wouldn't recommend doing it automatically. If a system stayed up for a
long time (say a server) it could see many kernel updates while it
continued to run on an old kernel. You could eventually find that the
only verified bootable kernel gets rotated out of the set and that all of
your newer kernels are untested - not a desirable position. This isn't
theoretical - I observed this happen with systems years ago and formed the
opinion that kernel removal should be manual.

In any case the kernels and their associated files take up little room so
there is little practical reason for removing them.



Email: [hidden email] Linux...

0 0

standard ubuntu trusty 14.04 has overlayfs support, with the standard 3.13 kernel and the utopic backport kernel 3.16 (which is available in trusty).

affected: change that caused the regression: Commit c573178 (30 Nov 2014) changed the probing of overlayfs to overlay, which fails on kernels < 3.18 reproduction: install standard ubuntu trusty, set docker to use overlay expected: look for the running version of linux, and change name of overlayfs according to kernel version
(overlayfs < 3.18-rc6 > overlay) rationale: by supporting stock ubuntu lts and stock kernels < 3.18 for testing docker on overlayfs, a lot of more people and machines are available for testing the overlay driver with docker. #more /proc/version Linux version 3.16.0-29-generic (buildd@brownie) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #39-Ubuntu SMP Tue Dec 16 20:54:13 UTC 2014 #modinfo overlayfs filename: /lib/modules/3.16.0-29-generic/kernel/fs/overlayfs/overlayfs.ko alias: fs-overlayfs...
0 0

For Ubuntu, Grub2 automatically display the latest kernel and hides the older kernels. If you want to see them, you can press Shift while booting.

So, before deleting older kernels, boot with the latest available kernel (grub2 load it by default in booting). To check which kernel you are using you can use the command:

uname -r

The recommendation is to keep at least two or preferably three kernels including the latest. The reason is that you will have at least one/two other kernels to boot with if it occurs that you are unable to boot with the latest kernel.

To remove the older kernels, open terminal and check your current kernel:

uname -r

Then to list all installed kernels on your system.

dpkg --list | grep linux-image

Find all the kernels that lower than your current kernel. Run the commands below to remove the kernel you selected:

sudo apt-get purge linux-image-x.x.x.x-generic

Finally, run the commands below to update grub2

0 0
On 2012-09-05 23:46, icekool wrote:

> also the old/previous config files, or does this
> distro just replace them without the user having to bother with this?,

Some config files are replaced, some remain for you to handle manually. Sometimes the old config is
renamed as .rpmorig, sometimes the new one is renamed as .rpmnew. In both cases you have to decide
what to do, manually.

There is a service, rcrpmconfigcheck, that runs on every boot and lists the files needing attention
- however, you do not see it with a graphical boot.

> would also like to apply the exact same question to the rpm package
> cache, does YaST/Zypper keep a cache in the same way as Synaptic in
> Ubuntu? (which always seems to need deleting even when the "auto delete
> after 1 day" option is checked)

You mean the rpm database cache, or the packages themselves? There is a 5 days backup copy handled
by a cron job.

Cheers /...

0 0

Normally Linux distribution ISOs work perfectly when written to a USB for booting as a 'Live USB' allowing both usage and installation of the distro. Unfortunately with the introduction of Intel Atom based mini PCs and tablets the issue of requiring a 32-bit bootloader to boot a 64-bit OS arose. Further complications were caused by the initial lack of 'mainline' support for HDMI audio and wifi/bluetooth resulting in either the need for custom kernels or for one of the more recent 'mainline' kernels. However because Ubuntu is not a 'rolling release' it is not possible to try the latest kernel or a specific kernel with a 'Live USB'. Now with the introduction of Intel Apollo Lake based mini PCs a new issue has arisen where GRUB simply fails to boot unless the device is one of the few with a BIOS option to select Linux as the OS. Whilst some Linux distros can work OOTB regardless of architecture and bootloader I found that for Ubuntu it wasn't that simple.

To solve the limitations...

0 0


It wasn't trendy, funny, nor was it coined on Twitter, but we thought change told a real story about how our users defined 2010. Unlike in 2008, change was no longer a campaign slogan. But, the term still held a lot of weight. Here's an excerpt from our Word of the Year announcement in 2010:

The national debate can arguably be summarized by the question: In the past two years, has there been enough change? Has there been too much? Meanwhile, many Americans continue to face change in their homes, bank accounts and jobs. Only time will tell if the latest wave of change Americans voted for in the midterm elections will result in a negative or positive...

0 0