Tested with 1.1ubuntu1.18.04.7~16.04.2 on Xenial: root@x-uu-lp-1260041:~# apt-mark auto linux-image-extra-4.8.0-56-generic linux-image-extra-4.8.0-58-generic linux-image-extra-4.8.0-54-generic linux-image-extra-4.8.0-53-generic linux-image-extra-4.8.0-56-generic set to automatically installed. linux-image-extra-4.8.0-58-generic set to automatically installed. linux-image-extra-4.8.0-54-generic set to automatically installed. linux-image-extra-4.8.0-53-generic set to automatically installed. root@x-uu-lp-1260041:~# unattended-upgrade --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, o=Ubuntu,a=xenial-updates Removing unused kernel packages: linux-image-extra-4.8.0-54-generic linux-image-4.8.0-54-generic Keeping auto-removable linux-image-extra-4.8.0-54-generic package(s) because it would also remove the following packages which should be kept in this step: libpam-systemd libsystemd0 libudev1 systemd systemd-sysv udev (Reading database ... 53554 files and directories currently installed.) Removing linux-image-extra-4.8.0-54-generic (4.8.0-54.57~16.04.1) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic update-initramfs: Generating /boot/initrd.img-4.8.0-54-generic W: mdadm: /etc/mdadm/mdadm.conf defines no arrays. run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic run-parts: executing /etc/kernel/postinst.d/update-notifier 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic Removing linux-image-4.8.0-54-generic (4.8.0-54.57~16.04.1) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic update-initramfs: Deleting /boot/initrd.img-4.8.0-54-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.8.0-54-generic /boot/vmlinuz-4.8.0-54-generic Packages that were successfully auto-removed: linux-image-4.8.0-54-generic linux-image-extra-4.8.0-54-generic Packages that are kept back: linux-image-extra-4.8.0-54-generic Packages that will be upgraded: libpam-systemd libsystemd0 libudev1 systemd systemd-sysv udev Writing dpkg log to /var/log/unattended-upgrades/unattended-upgrades-dpkg.log (Reading database ... 47681 files and directories currently installed.) Preparing to unpack .../systemd-sysv_229-4ubuntu21.17_amd64.deb ... Unpacking systemd-sysv (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Processing triggers for man-db (2.7.5-1) ... Setting up systemd-sysv (229-4ubuntu21.17) ... Log ended: 2019-03-13 17:17:36
Log started: 2019-03-13 17:17:36 (Reading database ... 47681 files and directories currently installed.) Preparing to unpack .../udev_229-4ubuntu21.17_amd64.deb ... Unpacking udev (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Preparing to unpack .../libudev1_229-4ubuntu21.17_amd64.deb ... Unpacking libudev1:amd64 (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for systemd (229-4ubuntu21.16) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for libc-bin (2.23-0ubuntu11) ... Setting up libudev1:amd64 (229-4ubuntu21.17) ... Setting up udev (229-4ubuntu21.17) ... addgroup: The group `input' already exists as a system group. Exiting. update-initramfs: deferring update (trigger activated) Processing triggers for libc-bin (2.23-0ubuntu11) ... Processing triggers for initramfs-tools (0.122ubuntu8.14) ... update-initramfs: Generating /boot/initrd.img-4.15.0-45-generic W: mdadm: /etc/mdadm/mdadm.conf defines no arrays. Log ended: 2019-03-13 17:17:44 Log started: 2019-03-13 17:17:45 (Reading database ... 47681 files and directories currently installed.) Preparing to unpack .../libpam-systemd_229-4ubuntu21.17_amd64.deb ... Unpacking libpam-systemd:amd64 (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Preparing to unpack .../libsystemd0_229-4ubuntu21.17_amd64.deb ... Unpacking libsystemd0:amd64 (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for libc-bin (2.23-0ubuntu11) ... Setting up libsystemd0:amd64 (229-4ubuntu21.17) ... Processing triggers for libc-bin (2.23-0ubuntu11) ... (Reading database ... 47681 files and directories currently installed.) Preparing to unpack .../systemd_229-4ubuntu21.17_amd64.deb ... Unpacking systemd (229-4ubuntu21.17) over (229-4ubuntu21.16) ... Processing triggers for dbus (1.10.6-1ubuntu3.3) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for ureadahead (0.100.0-19) ... Setting up systemd (229-4ubuntu21.17) ... addgroup: The group `systemd-journal' already exists as a system group. Exiting. [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. Setting up libpam-systemd:amd64 (229-4ubuntu21.17) ... All upgrades installed ** 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 Touch seeded packages, which is subscribed to unattended-upgrades in Ubuntu. https://bugs.launchpad.net/bugs/1624644 Title: By default settings unattended-upgrade does not automatically remove packages that become unused in conjunction with updating by other software Status in apt package in Ubuntu: Confirmed Status in gnome-software package in Ubuntu: Invalid Status in unattended-upgrades package in Ubuntu: Fix Released Status in update-manager package in Ubuntu: Fix Released Status in unattended-upgrades source package in Xenial: Fix Committed Status in update-manager source package in Xenial: Fix Released Status in apt source package in Artful: Confirmed Status in gnome-software source package in Artful: Invalid Status in unattended-upgrades source package in Artful: Won't Fix Status in update-manager source package in Artful: Fix Released Bug description: [Impact] * Update-manager and unattended-upgrades install many kernel packages during the lifetime of a release but does not remove them automatically leading to those packages filling disk space potentially completely filling /boot and making the system unable to install updates or even boot. * Stable release users are impacted by this bug for years and their systems already collected many autoremovable unused kernel packages, thus they would benefit from backporting the fix greatly. * The bug is fixed by removing autoremovable (not currently booted) kernel packages when running unattended-upgrades or update-manager. Update manager offers the kernel removals when there are other updates to be installed. [Test Case] 1. Install kernel packages to be removed, mark them auto-installed and run apt's kernel hook script to make apt consider them autoremovable: sudo apt install -y linux-image-extra-4.4.0-92-generic linux-image-extra-4.4.0-93-generic sudo apt-mark auto linux-image-extra-4.4.0-92-generic linux-image-extra-4.4.0-93-generic sudo /etc/kernel/postinst.d/apt-auto-removal 2. Also downgrade a package to be upgraded: sudo apt-get install -y --allow-downgrades ca- certificates=20160104ubuntu1 3. (update-manager). Run update-manager and observe that kernel packages are offered for removal in Details of updates. sudo update-manager 4. (update-manager) Click on Install Now and observe that the kernel packages are removed. 3. (unattended-upgrades, the fix comes in an update of u-u) Run unattended-upgrades manually and observe the removal of the autoremovable kernel packages: sudo unattended-upgrade -v [Regression Potential] The change may cause update-manager or unattanded-upgrades to remove used kernel packages or fail to install other package updates. [Other Info] The unattended-upgrades fix is uploaded with many other fixes and those may cause regressions in other areas in unattended-upgrades. [Original bug text] When using default settings for unattended-upgrade i.e. Unattended-Upgrade::Remove-Unused-Dependencies "false"; # default "false" Unattended-Upgrade::Remove-New-Unused-Dependencies "true"; # default "true" in configuration file /etc/apt/apt.conf.d/50unattended-upgrades, unattended-upgrade is unable to remove packages that become unused in conjunction with updating by other software such as update-manager or apt full-upgrade. This is because unattended-upgrade compares the list of unneeded packages before and after it upgrades packages to detect which packages are new unused ones. Consequently, if user installs new kernels using e.g. update-manager, the excessive kernels will not be removed by unattended-upgrade, and eventually (small) /boot will become full. Expected behavior: handle removing of unused packages differently at least until other package management software installed by default can handle removing of new unused packages. ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: unattended-upgrades 0.90 ProcVersionSignature: Ubuntu 4.4.0-36.55-generic 4.4.16 Uname: Linux 4.4.0-36-generic i686 ApportVersion: 2.20.1-0ubuntu2.1 Architecture: i386 CurrentDesktop: XFCE Date: Sat Sep 17 11:28:44 2016 InstallationDate: Installed on 2016-09-05 (11 days ago) InstallationMedia: Mythbuntu 16.04.1 LTS "Xenial Xerus" - Release i386 (20160719) PackageArchitecture: all SourcePackage: unattended-upgrades UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1624644/+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