Hi all,

sorry, the apt-auto-removal script attached above contained some debug
echo statements. Which were harmless, but unnessecary.

Testing and thinking a bit more about the problem I have come to the
conclusion, that upon removal of a linux-image-extra package the only
right thing to do is not to touch the list of kernels not for auto-
remove (/etc/apt/apt.conf.d/01autoremove-kernels) at all. We should just
leave it the way it is.

Reasoning: consider the following example:
- We have linux-image{,-extra}-1, linux-image{,-extra}-2 and 
linux-image{,-extra}-3 installed.
- We now remove linux-image-extra-2 ; now we have two possible cases:
  - a) linux-image-2 is not going to be removed, so we should not remove it 
from the list
  - b) linux-image-2 is removed afterwards, in which case it would not matter, 
if we had removed it from the list.
Either way we have no way of knowing what will happen to the linux-image-2 
package, while we are removing the linux-image-extra-2 package. So the only 
sensible thing is imho not touching the list in this case at all.
This is what the updated script in my attachment does now.

Moreover, looking at this case from another perspective, it looks like
it would be a good thing to recreate the list at the time of the removal
of the linux-image-2 package! At this point it would be nice to prevent
linux-image-3 AND linux-image-1 from being auto-removed later on.   ....
but this would be another bug report, I guess.

Even even updating this list upon installation of an linux-image-extra
package is questionable, since again we have no way of knowing, what the
user had in mind. Of course, the linux-image needs to be installed
(since it is a dependency), but maybe we are just installing all the
-extra packages for all the installed kernels? It probably doesn't do
too much harm in this case, but it is not very useful either.

I think, that this shows again, that executing all of the kernel-post-
install hooks while acting on the rather unrelated -extra package is not
the best way. Since recreating the initrd is the only thing we need,
this is the only thing we should do on installation and removal of the
-extra package!

So I see the updated /etc/kernel/postinst.d/apt-auto-removal script in
the attachment not really as a solution to this problem, but more as a
workaround for the broken linux-image-extra package install- and remove-
hooks.

Regards,
Robert.

** Attachment added: "updated /etc/kernel/postinst.d/apt-auto-removal script to 
exit on removal of image-extra package"
   
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1440608/+attachment/4551880/+files/apt-auto-removal

-- 
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/1440608

Title:
  /etc/kernel/postinst.d/apt-auto-removal wants to remove all kernels
  except the latest one

Status in One Hundred Papercuts:
  Triaged
Status in apt package in Ubuntu:
  Triaged
Status in linux package in Ubuntu:
  Triaged

Bug description:
  After installing a 3rd kernel currently 3.19.0-12-generic, the
  /etc/apt/apt.conf.d/01autoremove-kernels file looks normal listing the
  3.19.0-11-generic and 3.19.0-12-generic with 3.19.0-10-generic listed
  to be autoremoved. But once autoremove is completed the machine
  requests to be rebooted and at that time the /etc/apt/apt.conf.d
  /01autoremove-kernels file lists the 3.19.0-12-generic and
  3.19.0-10-generic kernels. So upon rebooting the 3.19.0-11-generic is
  requested to be autoremoved leaving only one kernel the latest one
  3.19.0-12-generic.

  ProblemType: Bug
  DistroRelease: Ubuntu 15.04
  Package: apt 1.0.9.7ubuntu3
  ProcVersionSignature: Ubuntu 3.19.0-12.12-generic 3.19.3
  Uname: Linux 3.19.0-12-generic x86_64
  NonfreeKernelModules: nvidia
  ApportVersion: 2.17-0ubuntu1
  Architecture: amd64
  CurrentDesktop: MATE
  Date: Sun Apr  5 17:03:01 2015
  InstallationDate: Installed on 2015-04-02 (3 days ago)
  InstallationMedia: Ubuntu-MATE 15.04 "Vivid Vervet" - Beta amd64 (20150401)
  SourcePackage: apt
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/hundredpapercuts/+bug/1440608/+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