apt-get autoremove not removing old kernels when package virtualbox-5.1 is installed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apt (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
'apt-get autoremove` does not remove old 'linux-image-*` packages as long as virtualbox-5.1 package is installed on system.
% cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
% lsb_release -rd
Description: Ubuntu 16.04.1 LTS
Release: 16.04
% apt-cache policy apt
apt:
Installed: 1.2.12~
Candidate: 1.2.12~
There are 7 different kernel versions installed
=======
% dpkg -l | grep linux-im | cut -c 1-80
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-generic 4.4.0.45.48
% ls -1 /boot/vmlinuz-*
/boot/vmlinuz-
/boot/vmlinuz-
/boot/vmlinuz-
/boot/vmlinuz-
/boot/vmlinuz-
/boot/vmlinuz-
/boot/vmlinuz-
Running kernel
==============
% uname -r
4.4.0-43-generic
Only 4.4.0-43 and 4.4.0-45 protected from autoremove
=======
% cat /etc/apt/
// DO NOT EDIT! File autogenerated by /etc/kernel/
APT::NeverAutoR
{
"^linux-
"^linux-
"^linux-
"^linux-
"^linux-
"^linux-
"^linux-
"^linux-
"^kfreebsd-
"^kfreebsd-
"^kfreebsd-
"^kfreebsd-
"^gnumach-
"^gnumach-
"^.*
"^.*
"^.*
"^.*
"^linux-
"^linux-
"^linux-
"^linux-
};
/* Debug information:
# dpkg list:
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
ii linux-image-
iF linux-image-
iU linux-image-generic 4.4.0.45.48 amd64 Generic Linux kernel image
# list of installed kernel packages:
4.4.0-31-generic 4.4.0-31.50
4.4.0-34-generic 4.4.0-34.53
4.4.0-36-generic 4.4.0-36.55
4.4.0-38-generic 4.4.0-38.57
4.4.0-42-generic 4.4.0-42.62
4.4.0-43-generic 4.4.0-43.63
4.4.0-45-generic 4.4.0-45.66
# list of different kernel versions:
4.4.0-45.66
4.4.0-43.63
4.4.0-42.62
4.4.0-38.57
4.4.0-36.55
4.4.0-34.53
4.4.0-31.50
# Installing kernel: 4.4.0-45.66 (4.4.0-45-generic)
# Running kernel: 4.4.0-43.63 (4.4.0-43-generic)
# Last kernel: 4.4.0-45.66
# Previous kernel: 4.4.0-43.63
# Kernel versions list to keep:
4.4.0-43.63
4.4.0-45.66
# Kernel packages (version part) to protect:
4\.4\.0-43-generic
4\.4\.0-45-generic
*/
All marked auto
===============
% apt-mark showauto | grep linux
linux-firmware
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-headers-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-
linux-image-generic
linux-libc-dev
linux-sound-base
pptp-linux
syslinux
syslinux-common
syslinux-legacy
% apt-mark showmanual | grep linux
console-setup-linux
libselinux1
linux-base
linux-generic
util-linux
Virtualbox is installed
=======
% dpkg -l virtualbox-5.1
ii virtualbox-5.1 5.1.8-111374~
Command executed
================
% apt-get autoremove
Expected behaviour
==================
Remove all 'linux-
where X not in (4.4.0-43, 4.4.0-45).
What happens instead
=======
% apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Debugging Info
% apt-get -o Debug::
(see attachments below this post)
How to fix this? Remove virtualbox-5.1 package
=======
% apt-get remove virtualbox-5.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libqt5x11extras5 linux-headers-
linux-
linux-
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
virtualbox-5.1
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 158 MB disk space will be freed.
Do you want to continue? [Y/n]
How come apt-get will not autoremove old kernel packages as long as virtualbox is installed?
% apt-cache show virtualbox-5.1
Package: virtualbox-5.1
Version: 5.1.8-111374~
Architecture: amd64
Maintainer: Oracle Corporation <email address hidden>
Installed-Size: 154040
Pre-Depends: debconf (>= 1.1) | debconf-2.0
Depends: libc6 (>= 2.15), libcurl3 (>= 7.16.2), libdevmapper1.02.1 (>= 2:1.02.97), libgcc1 (>= 1:3.0), libgl1-mesa-glx | libgl1, libpng12-0 (>= 1.2.13-4), libpython2.7 (>= 2.7), libqt5core5a (>= 5.5.0), libqt5gui5 (>= 5.3.0) | libqt5gui5-gles (>= 5.3.0), libqt5opengl5 (>= 5.0.2) | libqt5opengl5-gles (>= 5.0.2), libqt5printsupport5 (>= 5.0.2), libqt5widgets5 (>= 5.2.0), libqt5x11extras5 (>= 5.1.0), libsdl1.2debian (>= 1.2.11), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 5.2), libvpx3 (>= 1.5.0), libx11-6, libxcb1, libxcursor1 (>> 1.1.2), libxext6, libxinerama1, libxml2 (>= 2.7.4), libxmu6, libxt6, zlib1g (>= 1:1.1.4), psmisc, adduser
Recommends: libasound2, libpulse0, libsdl-ttf2.0-0, kmod | kldutils | module-init-tools, linux-headers-
Conflicts: virtualbox, virtualbox-
Replaces: virtualbox
Provides: virtualbox
Priority: optional
Section: contrib/misc
Filename: pool/contrib/
Size: 65225770
SHA256: 66d8900d5428aad
SHA1: 78648eb646b0488
MD5sum: ad328e1a7fb5f1e
Description: Oracle VM VirtualBox
VirtualBox is a powerful PC virtualization solution allowing you to run a
wide range of PC operating systems on your Linux system. This includes
Windows, Linux, FreeBSD, DOS, OpenBSD and others. VirtualBox comes with a broad
feature set and excellent performance, making it the premier virtualization
software solution on the market.
Description-md5: 914c1338bb9a4b6
Python-Version: 2.7
There are no dependencies that would prevent removing these old kernel versions when trying to remove them manually:
% apt-get remove linux-headers- 4.4.0-31 linux-headers- 4.4.0-31- generic linux-image- 4.4.0-31- generic headers- 4.4.0-31 linux-headers- 4.4.0-31- generic linux-image- 4.4.0-31- generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 133 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
This issue is a real pain in the a** because we just rolled out new desktop images to all the people in the company with 300 MB of disk space allocated to /boot and with this many old kernel versions around /boot fills up easily.