apt-get autoremove takes quadratically long

Bug #1462596 reported by Tom Womack
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Confirmed
Undecided
Unassigned
linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

apt-get autoremove regenerates the initrd after removing each kernel. Since you generally call this command only when your boot volume is full of old kernels, it seems sub-optimal to regenerate the initrd eight times when removing eight kernels. Could something be done with triggers to do a single regeneration of the initrd at the end?

This is in 14.04

Adam Conrad (adconrad)
affects: apt (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: New → Confirmed
Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Jarno Suni (jarnos) wrote :

I think this script runs update-grub after every remove of kernel: /etc/kernel/postinst.d/zz-update-grub. Would it be possible to use an environment variable that makes it possible to skip that post-installation script, and run update-grub manually after last removal, if wanted?

Revision history for this message
Jarno Suni (jarnos) wrote :

Oh, you can do something now: you can set update-grub executable (found by command `which update-grub`) not executable by `sudo chmod -x` temporarily, and then remove the kernels, and then restore the state of the file by `sudo chmod +x` and finally run `sudo update-grub` manually. This is because /etc/kernel/postinst.d/zz-update-grub exits, if the executable is not found (at least in 14.04 and 16.04).

Revision history for this message
Jarno Suni (jarnos) wrote :

Oh, this is the script that is used for updating grub in conjunction with kernel removal: /etc/kernel/postrm.d/zz-update-grub
Anyway, OP meant regenerating the initrd, which is handled by initramfs-tools scripts.

Revision history for this message
Jarno Suni (jarnos) wrote :

The aforementioned `sudo chmod -x` command has the side-effect that update-grub will be left non-executable in case of power cut.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.