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
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1440608

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/hundredpapercuts/+bug/1440608/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to