[Bug 1615381] Re: apt-get autoremove may remove current kernel

Balint Reczey balint.reczey at canonical.com
Mon Apr 8 17:32:14 UTC 2019


Verified 1.1ubuntu1.18.04.7~16.04.2 on Xenial.

Installed a few linux packages, marked them auto-installed, ran /etc/kernel/postinst.d/apt-auto-removal , then booted to a old kernel.
Apt would have removed it, but u-u did not. (The -34- kernel.)

ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ uname -a
Linux ubuntu-Standard-PC-i440FX-PIIX-1996 4.15.0-34-generic #37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ yes no | apt autoremove 
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ yes no | sudo apt autoremove 
[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.15.0-34-generic linux-image-4.15.0-36-generic linux-image-4.15.0-38-generic linux-modules-4.15.0-34-generic linux-modules-4.15.0-36-generic
  linux-modules-4.15.0-38-generic
0 upgraded, 0 newly installed, 6 to remove and 9 not upgraded.
After this operation, 223 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ sudo unattended-upgrade --dry-run --verbose
Initial blacklisted packages: 
Initial whitelisted packages: 
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=xenial, o=Ubuntu,a=xenial-security, o=UbuntuESM,a=xenial
Removing unused kernel packages: linux-modules-4.15.0-36-generic linux-image-4.15.0-36-generic linux-modules-4.15.0-38-generic linux-image-4.15.0-38-generic
Keeping auto-removable linux-modules-4.15.0-36-generic package(s) because it would also remove the following packages which should be kept in this step: libpam-systemd libsmbclient libsystemd0 libudev1 libwbclient0 samba-libs systemd systemd-sysv udev
Packages that were successfully auto-removed: 
Packages that are kept back: linux-modules-4.15.0-36-generic
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ dpkg -l unattended-upgrades  | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version                    Architecture Description
+++-===================-==========================-============-===========================================
ii  unattended-upgrades 1.1ubuntu1.18.04.7~16.04.2 all          automatic installation of security upgrades


** Tags removed: verification-needed verification-needed-xenial
** Tags added: verification-done verification-done-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to unattended-upgrades in Ubuntu.
https://bugs.launchpad.net/bugs/1615381

Title:
  apt-get autoremove may remove current kernel

Status in apt package in Ubuntu:
  Won't Fix
Status in unattended-upgrades package in Ubuntu:
  Fix Released
Status in apt source package in Trusty:
  Won't Fix
Status in unattended-upgrades source package in Trusty:
  New
Status in apt source package in Xenial:
  Won't Fix
Status in unattended-upgrades source package in Xenial:
  Fix Committed
Status in apt source package in Artful:
  Won't Fix
Status in unattended-upgrades source package in Artful:
  Won't Fix

Bug description:
  This may happen, if you boot one of the older kernels, that is not
  protected by /etc/apt/apt.conf.d/01autoremove-kernels

  Workaround: run
  /etc/kernel/postinst.d/apt-auto-removal
  during each boot (e.g. by using cron).
  Note: The workaround breaks autoremoving feature of new unneeded kernels in  unattended-upgrades i.e. the setting 'Unattended-Upgrade::Remove-New-Unused-Dependencies "true"' (which is default in 16.04 unless 'Unattended-Upgrade::Remove-Unused-Dependencies "true"' is set in '/etc/apt/apt.conf.d/50unattended-upgrades'.

  
  In shell:

  $ uname -r
  4.4.0-22-generic
  $ apt-get -s autoremove
  NOTE: This is only a simulation!
        apt-get needs root privileges for real execution.
        Keep also in mind that locking is deactivated,
        so don't depend on the relevance to the real current situation!
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  The following packages will be REMOVED:
    linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic linux-headers-4.4.0-22
    linux-headers-4.4.0-22-generic linux-headers-4.4.0-31-generic
    linux-image-4.4.0-21-generic linux-image-4.4.0-22-generic
    linux-image-4.4.0-31-generic linux-image-extra-4.4.0-21-generic
    linux-image-extra-4.4.0-22-generic linux-image-extra-4.4.0-31-generic
  0 upgraded, 0 newly installed, 11 to remove and 13 not upgraded.

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: apt 1.2.12~ubuntu16.04.1
  ProcVersionSignature: Ubuntu 4.4.0-22.40-generic 4.4.8
  Uname: Linux 4.4.0-22-generic x86_64
  ApportVersion: 2.20.1-0ubuntu2.1
  Architecture: amd64
  CurrentDesktop: XFCE
  Date: Sun Aug 21 16:11:27 2016
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2016-04-28 (114 days ago)
  InstallationMedia: Xubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
  SourcePackage: apt
  UpgradeStatus: No upgrade log present (probably fresh install)
  modified.conffile..etc.kernel.postinst.d.apt-auto-removal: [modified]
  mtime.conffile..etc.kernel.postinst.d.apt-auto-removal: 2016-07-30T12:15:32.706300

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



More information about the foundations-bugs mailing list