How to really, truly remove old kernels? [duplicate]
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
This question already has an answer here:
Why are old initrd files of uninstalled kernels filling up /boot partition?
1 answer
I've read many answers on this site answering this question. I'm on 16.04, so the following should take care of old kernels:
sudo apt-get autoremove
Failing that, I can remove old ones manually (keeping recent kernels as backup):
sudo apt-get remove linux-image-3.*
sudo apt-get remove linux-image-extras-3.*
sudo apt-get remove linux-headers-3.*
sudo apt-get remove linux-image-4.0.0-x*
sudo apt-get remove linux-image-extras-4.0.0-x*
sudo apt-get remove linux-headers-4.0.0-x*
where I performed the last three commands for x
= 3
, 4
, 5
, 6
, 7
, 8
. This did result in disk space being cleared, up to ~500M
in some cases. However, I still see many MB of disk space being used on these old kernels in /boot
:
ls -lh /boot
...
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-33-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-61-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-64-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-65-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-66-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-68-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-74-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-75-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-77-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 28 09:41 initrd.img-4.4.0-101-generic
-rw-r--r-- 1 root root 15M Dec 17 2016 initrd.img-4.4.0-31-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-57-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-59-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-62-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-64-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-71-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-72-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-75-generic.old-dkms
-rw-r--r-- 1 root root 18M Sep 23 11:33 initrd.img-4.4.0-78-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 4 17:00 initrd.img-4.4.0-98-generic
...
and also, the old kernels are still listed as large installed packages by dpkg
:
dpkg-query -W --showformat='$Installed-Size $Packagen' | sort -nr | less
...
158659 linux-image-extra-4.4.0-47-generic
158555 linux-image-extra-4.4.0-36-generic
158443 linux-image-extra-4.4.0-34-generic
158201 linux-image-extra-4.4.0-31-generic
157559 linux-image-extra-4.4.0-53-generic
157559 linux-image-extra-4.4.0-51-generic
156386 linux-image-extra-3.19.0-77-generic
156386 linux-image-extra-3.19.0-75-generic
156385 linux-image-extra-3.19.0-74-generic
156384 linux-image-extra-3.19.0-68-generic
156384 linux-image-extra-3.19.0-66-generic
156384 linux-image-extra-3.19.0-65-generic
156383 linux-image-extra-3.19.0-64-generic
156380 linux-image-extra-3.19.0-61-generic
156178 linux-image-extra-3.19.0-33-generic
150341 linux-image-extra-4.4.0-57-generic
150205 linux-image-extra-4.4.0-62-generic
150198 linux-image-extra-4.4.0-59-generic
149214 linux-image-extra-4.4.0-101-generic
149191 linux-image-extra-4.4.0-98-generic
149156 linux-image-extra-4.4.0-96-generic
148953 linux-image-extra-4.4.0-72-generic
148953 linux-image-extra-4.4.0-71-generic
148940 linux-image-extra-4.4.0-64-generic
148663 linux-image-extra-4.4.0-87-generic
148621 linux-image-extra-4.4.0-78-generic
148598 linux-image-extra-4.4.0-75-generic
...
How can I fully clean my system of these old kernels?
16.04 apt kernel disk-usage disk-management
marked as duplicate by N0rbert, karel, Eric Carvalho, WinEunuuchs2Unix, Charles Green Feb 7 at 13:53
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Why are old initrd files of uninstalled kernels filling up /boot partition?
1 answer
I've read many answers on this site answering this question. I'm on 16.04, so the following should take care of old kernels:
sudo apt-get autoremove
Failing that, I can remove old ones manually (keeping recent kernels as backup):
sudo apt-get remove linux-image-3.*
sudo apt-get remove linux-image-extras-3.*
sudo apt-get remove linux-headers-3.*
sudo apt-get remove linux-image-4.0.0-x*
sudo apt-get remove linux-image-extras-4.0.0-x*
sudo apt-get remove linux-headers-4.0.0-x*
where I performed the last three commands for x
= 3
, 4
, 5
, 6
, 7
, 8
. This did result in disk space being cleared, up to ~500M
in some cases. However, I still see many MB of disk space being used on these old kernels in /boot
:
ls -lh /boot
...
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-33-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-61-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-64-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-65-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-66-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-68-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-74-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-75-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-77-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 28 09:41 initrd.img-4.4.0-101-generic
-rw-r--r-- 1 root root 15M Dec 17 2016 initrd.img-4.4.0-31-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-57-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-59-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-62-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-64-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-71-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-72-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-75-generic.old-dkms
-rw-r--r-- 1 root root 18M Sep 23 11:33 initrd.img-4.4.0-78-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 4 17:00 initrd.img-4.4.0-98-generic
...
and also, the old kernels are still listed as large installed packages by dpkg
:
dpkg-query -W --showformat='$Installed-Size $Packagen' | sort -nr | less
...
158659 linux-image-extra-4.4.0-47-generic
158555 linux-image-extra-4.4.0-36-generic
158443 linux-image-extra-4.4.0-34-generic
158201 linux-image-extra-4.4.0-31-generic
157559 linux-image-extra-4.4.0-53-generic
157559 linux-image-extra-4.4.0-51-generic
156386 linux-image-extra-3.19.0-77-generic
156386 linux-image-extra-3.19.0-75-generic
156385 linux-image-extra-3.19.0-74-generic
156384 linux-image-extra-3.19.0-68-generic
156384 linux-image-extra-3.19.0-66-generic
156384 linux-image-extra-3.19.0-65-generic
156383 linux-image-extra-3.19.0-64-generic
156380 linux-image-extra-3.19.0-61-generic
156178 linux-image-extra-3.19.0-33-generic
150341 linux-image-extra-4.4.0-57-generic
150205 linux-image-extra-4.4.0-62-generic
150198 linux-image-extra-4.4.0-59-generic
149214 linux-image-extra-4.4.0-101-generic
149191 linux-image-extra-4.4.0-98-generic
149156 linux-image-extra-4.4.0-96-generic
148953 linux-image-extra-4.4.0-72-generic
148953 linux-image-extra-4.4.0-71-generic
148940 linux-image-extra-4.4.0-64-generic
148663 linux-image-extra-4.4.0-87-generic
148621 linux-image-extra-4.4.0-78-generic
148598 linux-image-extra-4.4.0-75-generic
...
How can I fully clean my system of these old kernels?
16.04 apt kernel disk-usage disk-management
marked as duplicate by N0rbert, karel, Eric Carvalho, WinEunuuchs2Unix, Charles Green Feb 7 at 13:53
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Why are old initrd files of uninstalled kernels filling up /boot partition?
1 answer
I've read many answers on this site answering this question. I'm on 16.04, so the following should take care of old kernels:
sudo apt-get autoremove
Failing that, I can remove old ones manually (keeping recent kernels as backup):
sudo apt-get remove linux-image-3.*
sudo apt-get remove linux-image-extras-3.*
sudo apt-get remove linux-headers-3.*
sudo apt-get remove linux-image-4.0.0-x*
sudo apt-get remove linux-image-extras-4.0.0-x*
sudo apt-get remove linux-headers-4.0.0-x*
where I performed the last three commands for x
= 3
, 4
, 5
, 6
, 7
, 8
. This did result in disk space being cleared, up to ~500M
in some cases. However, I still see many MB of disk space being used on these old kernels in /boot
:
ls -lh /boot
...
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-33-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-61-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-64-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-65-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-66-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-68-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-74-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-75-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-77-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 28 09:41 initrd.img-4.4.0-101-generic
-rw-r--r-- 1 root root 15M Dec 17 2016 initrd.img-4.4.0-31-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-57-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-59-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-62-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-64-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-71-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-72-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-75-generic.old-dkms
-rw-r--r-- 1 root root 18M Sep 23 11:33 initrd.img-4.4.0-78-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 4 17:00 initrd.img-4.4.0-98-generic
...
and also, the old kernels are still listed as large installed packages by dpkg
:
dpkg-query -W --showformat='$Installed-Size $Packagen' | sort -nr | less
...
158659 linux-image-extra-4.4.0-47-generic
158555 linux-image-extra-4.4.0-36-generic
158443 linux-image-extra-4.4.0-34-generic
158201 linux-image-extra-4.4.0-31-generic
157559 linux-image-extra-4.4.0-53-generic
157559 linux-image-extra-4.4.0-51-generic
156386 linux-image-extra-3.19.0-77-generic
156386 linux-image-extra-3.19.0-75-generic
156385 linux-image-extra-3.19.0-74-generic
156384 linux-image-extra-3.19.0-68-generic
156384 linux-image-extra-3.19.0-66-generic
156384 linux-image-extra-3.19.0-65-generic
156383 linux-image-extra-3.19.0-64-generic
156380 linux-image-extra-3.19.0-61-generic
156178 linux-image-extra-3.19.0-33-generic
150341 linux-image-extra-4.4.0-57-generic
150205 linux-image-extra-4.4.0-62-generic
150198 linux-image-extra-4.4.0-59-generic
149214 linux-image-extra-4.4.0-101-generic
149191 linux-image-extra-4.4.0-98-generic
149156 linux-image-extra-4.4.0-96-generic
148953 linux-image-extra-4.4.0-72-generic
148953 linux-image-extra-4.4.0-71-generic
148940 linux-image-extra-4.4.0-64-generic
148663 linux-image-extra-4.4.0-87-generic
148621 linux-image-extra-4.4.0-78-generic
148598 linux-image-extra-4.4.0-75-generic
...
How can I fully clean my system of these old kernels?
16.04 apt kernel disk-usage disk-management
This question already has an answer here:
Why are old initrd files of uninstalled kernels filling up /boot partition?
1 answer
I've read many answers on this site answering this question. I'm on 16.04, so the following should take care of old kernels:
sudo apt-get autoremove
Failing that, I can remove old ones manually (keeping recent kernels as backup):
sudo apt-get remove linux-image-3.*
sudo apt-get remove linux-image-extras-3.*
sudo apt-get remove linux-headers-3.*
sudo apt-get remove linux-image-4.0.0-x*
sudo apt-get remove linux-image-extras-4.0.0-x*
sudo apt-get remove linux-headers-4.0.0-x*
where I performed the last three commands for x
= 3
, 4
, 5
, 6
, 7
, 8
. This did result in disk space being cleared, up to ~500M
in some cases. However, I still see many MB of disk space being used on these old kernels in /boot
:
ls -lh /boot
...
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-33-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-61-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-64-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-65-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-66-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-68-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-74-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-75-generic.old-dkms
-rw-r--r-- 1 root root 14M Dec 17 2016 initrd.img-3.19.0-77-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 28 09:41 initrd.img-4.4.0-101-generic
-rw-r--r-- 1 root root 15M Dec 17 2016 initrd.img-4.4.0-31-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-57-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:51 initrd.img-4.4.0-59-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-62-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:52 initrd.img-4.4.0-64-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-71-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-72-generic.old-dkms
-rw-r--r-- 1 root root 18M Aug 27 18:53 initrd.img-4.4.0-75-generic.old-dkms
-rw-r--r-- 1 root root 18M Sep 23 11:33 initrd.img-4.4.0-78-generic.old-dkms
-rw-r--r-- 1 root root 39M Nov 4 17:00 initrd.img-4.4.0-98-generic
...
and also, the old kernels are still listed as large installed packages by dpkg
:
dpkg-query -W --showformat='$Installed-Size $Packagen' | sort -nr | less
...
158659 linux-image-extra-4.4.0-47-generic
158555 linux-image-extra-4.4.0-36-generic
158443 linux-image-extra-4.4.0-34-generic
158201 linux-image-extra-4.4.0-31-generic
157559 linux-image-extra-4.4.0-53-generic
157559 linux-image-extra-4.4.0-51-generic
156386 linux-image-extra-3.19.0-77-generic
156386 linux-image-extra-3.19.0-75-generic
156385 linux-image-extra-3.19.0-74-generic
156384 linux-image-extra-3.19.0-68-generic
156384 linux-image-extra-3.19.0-66-generic
156384 linux-image-extra-3.19.0-65-generic
156383 linux-image-extra-3.19.0-64-generic
156380 linux-image-extra-3.19.0-61-generic
156178 linux-image-extra-3.19.0-33-generic
150341 linux-image-extra-4.4.0-57-generic
150205 linux-image-extra-4.4.0-62-generic
150198 linux-image-extra-4.4.0-59-generic
149214 linux-image-extra-4.4.0-101-generic
149191 linux-image-extra-4.4.0-98-generic
149156 linux-image-extra-4.4.0-96-generic
148953 linux-image-extra-4.4.0-72-generic
148953 linux-image-extra-4.4.0-71-generic
148940 linux-image-extra-4.4.0-64-generic
148663 linux-image-extra-4.4.0-87-generic
148621 linux-image-extra-4.4.0-78-generic
148598 linux-image-extra-4.4.0-75-generic
...
How can I fully clean my system of these old kernels?
This question already has an answer here:
Why are old initrd files of uninstalled kernels filling up /boot partition?
1 answer
16.04 apt kernel disk-usage disk-management
16.04 apt kernel disk-usage disk-management
asked Feb 7 at 5:28
Anonymous
1013
1013
marked as duplicate by N0rbert, karel, Eric Carvalho, WinEunuuchs2Unix, Charles Green Feb 7 at 13:53
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by N0rbert, karel, Eric Carvalho, WinEunuuchs2Unix, Charles Green Feb 7 at 13:53
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
You need to purge
the kernels instead of just remove
.
A handy tool is purge-old-kernels
which is shipped with the byobu
package on Ubuntu 16.04.
add a comment |Â
up vote
0
down vote
Get a list of all kernel-related packages with apt list --installed | grep linux
, and apt remove
those you don't want. It's that simple. You cab use --purge
if you want, but it should not have any significant effect in that case.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You need to purge
the kernels instead of just remove
.
A handy tool is purge-old-kernels
which is shipped with the byobu
package on Ubuntu 16.04.
add a comment |Â
up vote
2
down vote
You need to purge
the kernels instead of just remove
.
A handy tool is purge-old-kernels
which is shipped with the byobu
package on Ubuntu 16.04.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You need to purge
the kernels instead of just remove
.
A handy tool is purge-old-kernels
which is shipped with the byobu
package on Ubuntu 16.04.
You need to purge
the kernels instead of just remove
.
A handy tool is purge-old-kernels
which is shipped with the byobu
package on Ubuntu 16.04.
answered Feb 7 at 8:41
marcolz
1214
1214
add a comment |Â
add a comment |Â
up vote
0
down vote
Get a list of all kernel-related packages with apt list --installed | grep linux
, and apt remove
those you don't want. It's that simple. You cab use --purge
if you want, but it should not have any significant effect in that case.
add a comment |Â
up vote
0
down vote
Get a list of all kernel-related packages with apt list --installed | grep linux
, and apt remove
those you don't want. It's that simple. You cab use --purge
if you want, but it should not have any significant effect in that case.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Get a list of all kernel-related packages with apt list --installed | grep linux
, and apt remove
those you don't want. It's that simple. You cab use --purge
if you want, but it should not have any significant effect in that case.
Get a list of all kernel-related packages with apt list --installed | grep linux
, and apt remove
those you don't want. It's that simple. You cab use --purge
if you want, but it should not have any significant effect in that case.
answered Feb 7 at 9:16
![](https://i.stack.imgur.com/H7iAA.png?s=32&g=1)
![](https://i.stack.imgur.com/H7iAA.png?s=32&g=1)
fkraiem
8,49121727
8,49121727
add a comment |Â
add a comment |Â