Note:

I suspect that issue is related to the fact that some 'package(s)'
(virtualbox in your case) are simply 'removed' (letting their settings
still active).

Myself always 'purge' the package when removing them. Virtualbox is also
install on a few machines here; and never had  apt refusing the
autoremoval. That it.

Also seen many users reporting against 'dpkg' (apport choice) most of
the time, with a title such "package xxxx failed to install, package is
already installed and configured" . I also never had such an issue; so
also suspecting old settings left behind, disturbing the autoremoval
process.

That said, "apt-get autoremove" should really 'purge' not only 'remove'
to avoid a durty system.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1636203

Title:
  apt-get autoremove not removing old kernels when package
  virtualbox-5.1 is installed

Status in apt package in Ubuntu:
  New

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_RELEASE=16.04
  DISTRIB_CODENAME=xenial
  DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

  % lsb_release -rd
  Description:  Ubuntu 16.04.1 LTS
  Release:      16.04

  % apt-cache policy apt
  apt:
    Installed: 1.2.12~ubuntu16.04.1
    Candidate: 1.2.12~ubuntu16.04.1

  
  There are 7 different kernel versions installed
  ===============================================

  % dpkg -l | grep linux-im | cut -c 1-80
  ii  linux-image-4.4.0-31-generic                4.4.0-31.50                   
  
  ii  linux-image-4.4.0-34-generic                4.4.0-34.53                   
  
  ii  linux-image-4.4.0-36-generic                4.4.0-36.55                   
  
  ii  linux-image-4.4.0-38-generic                4.4.0-38.57                   
  
  ii  linux-image-4.4.0-42-generic                4.4.0-42.62                   
  
  ii  linux-image-4.4.0-43-generic                4.4.0-43.63                   
  
  ii  linux-image-4.4.0-45-generic                4.4.0-45.66                   
  
  ii  linux-image-extra-4.4.0-43-generic          4.4.0-43.63                   
  
  ii  linux-image-extra-4.4.0-45-generic          4.4.0-45.66                   
  
  ii  linux-image-generic                         4.4.0.45.48

  % ls -1 /boot/vmlinuz-*     
  /boot/vmlinuz-4.4.0-31-generic
  /boot/vmlinuz-4.4.0-34-generic
  /boot/vmlinuz-4.4.0-36-generic
  /boot/vmlinuz-4.4.0-38-generic
  /boot/vmlinuz-4.4.0-42-generic
  /boot/vmlinuz-4.4.0-43-generic
  /boot/vmlinuz-4.4.0-45-generic

  
  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/apt.conf.d/01autoremove-kernels 
  // DO NOT EDIT! File autogenerated by /etc/kernel/postinst.d/apt-auto-removal
  APT::NeverAutoRemove
  {
     "^linux-image-4\.4\.0-43-generic$";
     "^linux-image-4\.4\.0-45-generic$";
     "^linux-headers-4\.4\.0-43-generic$";
     "^linux-headers-4\.4\.0-45-generic$";
     "^linux-image-extra-4\.4\.0-43-generic$";
     "^linux-image-extra-4\.4\.0-45-generic$";
     "^linux-signed-image-4\.4\.0-43-generic$";
     "^linux-signed-image-4\.4\.0-45-generic$";
     "^kfreebsd-image-4\.4\.0-43-generic$";
     "^kfreebsd-image-4\.4\.0-45-generic$";
     "^kfreebsd-headers-4\.4\.0-43-generic$";
     "^kfreebsd-headers-4\.4\.0-45-generic$";
     "^gnumach-image-4\.4\.0-43-generic$";
     "^gnumach-image-4\.4\.0-45-generic$";
     "^.*-modules-4\.4\.0-43-generic$";
     "^.*-modules-4\.4\.0-45-generic$";
     "^.*-kernel-4\.4\.0-43-generic$";
     "^.*-kernel-4\.4\.0-45-generic$";
     "^linux-backports-modules-.*-4\.4\.0-43-generic$";
     "^linux-backports-modules-.*-4\.4\.0-45-generic$";
     "^linux-tools-4\.4\.0-43-generic$";
     "^linux-tools-4\.4\.0-45-generic$";
  };
  /* Debug information:
  # dpkg list:
  ii  linux-image-4.4.0-31-generic                4.4.0-31.50                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-34-generic                4.4.0-34.53                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-36-generic                4.4.0-36.55                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-38-generic                4.4.0-38.57                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-42-generic                4.4.0-42.62                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-43-generic                4.4.0-43.63                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-4.4.0-45-generic                4.4.0-45.66                   
             amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
  ii  linux-image-extra-4.4.0-43-generic          4.4.0-43.63                   
             amd64        Linux kernel extra modules for version 4.4.0 on 64 
bit x86 SMP
  iF  linux-image-extra-4.4.0-45-generic          4.4.0-45.66                   
             amd64        Linux kernel extra modules for version 4.4.0 on 64 
bit x86 SMP
  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-4.4.0-31
  linux-headers-4.4.0-31-generic
  linux-headers-4.4.0-34
  linux-headers-4.4.0-34-generic
  linux-headers-4.4.0-36
  linux-headers-4.4.0-36-generic
  linux-headers-4.4.0-38
  linux-headers-4.4.0-38-generic
  linux-headers-4.4.0-42
  linux-headers-4.4.0-42-generic
  linux-headers-4.4.0-43
  linux-headers-4.4.0-43-generic
  linux-headers-4.4.0-45
  linux-headers-4.4.0-45-generic
  linux-headers-generic
  linux-image-4.4.0-31-generic
  linux-image-4.4.0-34-generic
  linux-image-4.4.0-36-generic
  linux-image-4.4.0-38-generic
  linux-image-4.4.0-42-generic
  linux-image-4.4.0-43-generic
  linux-image-4.4.0-45-generic
  linux-image-extra-4.4.0-43-generic
  linux-image-extra-4.4.0-45-generic
  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~Ubuntu~xe

  
  Command executed
  ================

  % apt-get autoremove

  
  Expected behaviour
  ==================

  Remove all 'linux-image-X-generic` packages
  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::pkgAutoRemove=true autoremove > autoremove_debug.txt 2>&1
  (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-4.4.0-31 linux-headers-4.4.0-31-generic 
linux-headers-4.4.0-34 linux-headers-4.4.0-34-generic linux-headers-4.4.0-36
    linux-headers-4.4.0-36-generic linux-headers-4.4.0-38 
linux-headers-4.4.0-38-generic linux-headers-4.4.0-42 
linux-headers-4.4.0-42-generic
    linux-image-4.4.0-31-generic linux-image-4.4.0-34-generic 
linux-image-4.4.0-36-generic linux-image-4.4.0-38-generic 
linux-image-4.4.0-42-generic
  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~Ubuntu~xenial
  Architecture: amd64
  Maintainer: Oracle Corporation <i...@virtualbox.org>
  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-generic | linux-headers-generic-pae | 
linux-headers-686-pae | linux-headers-amd64 | linux-headers-2.6-686 | 
linux-headers-2.6-amd64 | linux-headers, linux-image, gcc, make | 
build-essential | dpkg-dev, binutils, pdf-viewer, libgl1
  Conflicts: virtualbox, virtualbox-guest-additions-iso, virtualbox-ose
  Replaces: virtualbox
  Provides: virtualbox
  Priority: optional
  Section: contrib/misc
  Filename: 
pool/contrib/v/virtualbox-5.1/virtualbox-5.1_5.1.8-111374~Ubuntu~xenial_amd64.deb
  Size: 65225770
  SHA256: 66d8900d5428aad7e7c955971153d45a2ddb65c113002c33dfa31f80b7f92ec0
  SHA1: 78648eb646b0488c01f69f52be89e04e80541db2
  MD5sum: ad328e1a7fb5f1e087b145dbcaff7f4e
  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: 914c1338bb9a4b67fae39e48412d76f8
  Python-Version: 2.7

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1636203/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to