Comment 36 for bug 1440608

Revision history for this message
Robert Euhus (euhus-liste1) wrote :

Jarno Suni, thanks for the reply.

First I would like to stress, that I still don't think that running all the KERNELS postINSTALL hooks while REMOVING the -extra package is the right thing todo. The only thing I can see that is really needed is the recreation of the initrd on installation and revmoval of that package (please correct me if I'm wrong!). So I think this is the only thing that should be done. Even recreating the GRUB config is unnessecary and a waste of time.

So working around this in the /etc/kernel/postinst.d/apt-auto-removal script is imho not the right way to do this.

That being said, this seems like the only available option right now.

I have taken a closer look at your "Fixed again" script and made some adjustments (comparing with apt 1.0.1ubuntu2.10 from 14.04):
- The version you have uploaded does not run properly, because some backslash-escapes for line breaks are missing (leading to "broken pipe" error).
- In the check if the kernel given in argument is desired to be removed the "exit" from the awk statement causes another broken pipe if the match is not the last kernel. It is not needed, so I removed it.
- The awk regex for creating the "list" of installed kernel versions is wrong ( only ' ' instead of '[ ]+' ), so the list is always empty. I don't see the advantage of using DPKG_QUERY here compared to the original which just uses DPKG. So to keep changes minimal I have reverted it to the old version.
- The shortened check if we have more than two kernels to keep already may lead to keeping one more kernel (3 in total) than in the original, which is fine by me.
- Again to keep changes (diff) minimal I have reordered the versions for the "kernel" variable like they are in the original.
- The use of dpkg-query looks somehow awkward to me (but maybe it's just me....).

I'll attach my updated version of the /etc/kernel/postinst.d/apt-auto-removal script

I have just run a few tests and it seems to work better than the original for now. I'll do some more testing right now.....

Regards,
Robert.