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.

** Attachment added: "updated /etc/kernel/postinst.d/apt-auto-removal script"
   
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1440608/+attachment/4551868/+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