Why does today's kernel update need half a gigabyte of disk space?
It's not exactly what it looks like. It is showing you that 508MB of the disk would be used, but is it telling you that this storage is permanent? What if I tell you that almost 450MB of them would be freed after running a simple command?
Generally, when a major upgrade occurs, new files and directories have to be placed. However, it won't automatically remove the older ones. Resulting in extended disk usage!
After upgrading your kernel, you can remove those old unsupported kernel modules by running:
sudo apt autoremove
It will remove all the previous kernels and their modules, which will free up almost 450MB of disk space.
Q&A
Why does today's kernel update need half a gigabyte of disk space?
It is because it has to place new files. It won't remove the older files, resulting in extended disk usage.
I've not kept notes, but I thought a kernel update was usually a couple of hundred MBs
Yes, they are, in fact, this upgrade is only 60-80MB.
is there something unusual about today's update?
Yes, this is a major kernel upgrade. You might not know that Ubuntu 20.04 will soon get upgraded to its 4th stage. So you'll get many upgrades like this. Get ready for Ubuntu 20.04.04!!
Why are kernels so big?
Linux kernel manages and controls the hardware resources like I/O (networking, storage, graphics and various user interface devices, etc.), memory and CPU for your device or computer. Each time a new upgrade comes, you get newer drivers and resources for better hardware resources.
If you are using a wireless card with custom-built drivers, then you have to recompile the drivers after the newer kernel kicks in. However, what about the other modules? The modules you do not need are still in your system. Why have iwlwifi
when I use rtw99
? The Linux kernel comes with thousands of different drivers for all kinds of devices. By default, apt
will install ALL of them. This is one of the main reasons, why you should compile the Linux kernel yourself. To compile Linux kernel yourself without unnecessary things refer to this thread, comment #2.
Difference between Download Size and Installed Size.
Why does it show:
Need to get 95.0 MB of archives.
Even though it is saying "508 MB of additional disk space will be used"?
It is because of Compression.
The .deb
also known as the "archive" format uses lossless compression algorithms to fit a huge number of files in a single .deb
without increasing its size. You can run the following command to see the difference between installed size and download size.
apt show linux-generic-hwe-20.04 linux-headers-generic-hwe-20.04 linux-image-generic-hwe-20.04 linux-headers-5.13.0-28-generic linux-hwe-5.13-headers-5.13.0-28 linux-image-5.13.0-28-generic linux-modules-5.13.0-28-generic linux-modules-extra-5.13.0-28-generic | egrep "Size|Package" | grep -v APT
Here is a table showing the difference:
Package |
Installed-Size |
Download-Size |
Package: linux-generic-hwe-20.04 |
Installed-Size: 19.5 kB |
Download-Size: 1,928 B |
Package: linux-headers-generic-hwe-20.04 |
Installed-Size: 19.5 kB |
Download-Size: 2,516 B |
Package: linux-image-generic-hwe-20.04 |
Installed-Size: 19.5 kB |
Download-Size: 2,628 B |
Package: linux-headers-5.13.0-28-generic |
Installed-Size: 24.5 MB |
Download-Size: 2,569 kB |
Package: linux-hwe-5.13-headers-5.13.0-28 |
Installed-Size: 75.9 MB |
Download-Size: 11.8 MB |
Package: linux-image-5.13.0-28-generic |
Installed-Size: 10.2 MB |
Download-Size: 10.0 MB |
Package: linux-modules-5.13.0-28-generic |
Installed-Size: 99.3 MB |
Download-Size: 18.3 MB |
Package: linux-modules-extra-5.13.0-28-generic |
Installed-Size: 298 MB |
Download-Size: 51.1 MB |
Should I remove older kernels?
Yes, you can remove old kernels, but it depends on how you operate your system.
If you have a habit of breaking your system once every week/month then its a good idea to keep multiple kernels.
If you use your system sincerely without doing experiments then its a good idea to remove older kernels.
How do I remove older kernels completely?
To completely purge ALL old kernels:
apt list --installed | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge
To only purge the EoSS kernels:
sudo apt autopurge
Alternatively, as raj commented, you can wait for Software Updater to popup and ask for the removal of older kernels.