Please use dpkg-triggers for update-grub when installing or removing kernel packages

Bug #1250109 reported by Phillip Susi
106
This bug affects 23 people
Affects Status Importance Assigned to Milestone
grub2 (Debian)
Won't Fix
Unknown
grub2 (Ubuntu)
In Progress
Wishlist
Julian Andres Klode
initramfs-tools (Ubuntu)
Fix Released
Wishlist
Unassigned
linux (Ubuntu)
Invalid
Wishlist
Unassigned

Bug Description

Currently the kernel package runs update-grub every time one is installed or removed. This results in it being run a dozen times during a dist-upgrade, and this is rather time consuming and annoying. Please use a dpkg trigger to cause update-grub to be run only once.

Revision history for this message
Ken Sharp (kennybobs) wrote :

Indeed. I have just removed ten old kernels which could have completed a lot quicker than it did.

Andy Whitcroft (apw)
Changed in linux (Ubuntu):
assignee: nobody → Andy Whitcroft (apw)
Revision history for this message
Andy Whitcroft (apw) wrote :

For clarity, this would be need to be paired grub2 and initramfs-tools triggers, otherwise we really won't reduce the number of updates. Looking at a prototype, likely for V.

Changed in grub2 (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Andy Whitcroft (apw)
Changed in initramfs-tools (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: none → later
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: later → ubuntu-15.02
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.02 → ubuntu-15.03
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.03 → ubuntu-15.08
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.08 → ubuntu-15.09
Revision history for this message
Mörgæs (moergaes) wrote :

The report is getting somewhat old. Is any work being done in this context?

The fix is one of the few that would benefit the entire user group. Would be more than welcome, especially for people using old hardware.

Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.09 → ubuntu-15.10
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.10 → ubuntu-15.11
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.11 → ubuntu-15.12
Revision history for this message
Phillip Susi (psusi) wrote :
tags: added: patch
Mathew Hodson (mhodson)
tags: added: packaging
tags: removed: bot-stop-nagging
Revision history for this message
Phillip Susi (psusi) wrote :

FYI this was a fairly straight forward theft of the code from update-initramfs to do the same and I tested by removing several old kernels and seeing that it only ran update-grub once, then installing ( and reinstalling ) a new kernel and seeing that it still ran once. Also manual invocation of update-grub still works.

Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-15.12 → ubuntu-16.01
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-16.01 → ubuntu-16.02
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
milestone: ubuntu-16.02 → ubuntu-16.03
Mathew Hodson (mhodson)
Changed in linux (Ubuntu):
milestone: ubuntu-16.03 → ubuntu-16.10
Revision history for this message
Mörgæs (moergaes) wrote :

Why is this change postponed again? Please inform us, is it because of difficult coding or because other bugs take precedence?

What is the status of the code contribution in post #5?

Revision history for this message
Phillip Susi (psusi) wrote :

It seems that there were other changes to grub that require the fix to be adjusted to apply properly, and nobody has done so yet ( I've been rather busy at work and with second child lately, but still hope to update this soon ).

Revision history for this message
Martin Pitt (pitti) wrote :

OK, I'll unsubscribe sponsors then. Please re-subscribe once there are updated patches. Thank you!

Changed in grub2 (Debian):
status: Unknown → Won't Fix
Mathew Hodson (mhodson)
summary: - Please use dpkg-triggers
+ Please use dpkg-triggers for update-grub when installing or removing
+ kernel packages
Mathew Hodson (mhodson)
Changed in linux (Ubuntu):
milestone: ubuntu-16.10 → none
Revision history for this message
Julian Andres Klode (juliank) wrote :

@Andy I'm unassigning you and changing the bug status as the initramfs part has been resolved, update-initramfs does

if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] && [ $# = 1 ] && [ "$1" = -u ]; then
        if dpkg-trigger --no-await update-initramfs; then
                echo "update-initramfs: deferring update (trigger activated)"
                exit 0
        fi
fi

We can patch grub to do the same

Changed in initramfs-tools (Ubuntu):
status: Triaged → Fix Released
Changed in linux (Ubuntu):
status: Triaged → Invalid
Changed in initramfs-tools (Ubuntu):
assignee: Andy Whitcroft (apw) → nobody
Changed in linux (Ubuntu):
assignee: Andy Whitcroft (apw) → nobody
Changed in grub2 (Ubuntu):
assignee: Andy Whitcroft (apw) → nobody
Revision history for this message
Julian Andres Klode (juliank) wrote :

Draft fix for update-grub: https://salsa.debian.org/grub-team/grub/-/merge_requests/46

Still need to take care of grub-install at some point, haven't figured out the best approach there yet.

Changed in grub2 (Ubuntu):
assignee: nobody → Julian Andres Klode (juliank)
status: Triaged → In Progress
Revision history for this message
Julian Andres Klode (juliank) wrote :

update-initramfs -c call by kernel postinst hook is not covered, but we need to make sure the initramfs is there at kernel configuration point because we need it to be there when updating boot loaders.

e.g. if we triggered both in that case, update-grub could run before update-initramfs.

if we included an initramfs-tools hook to run update-grub, update-grub could be run twice but update-initramfs only once.

I propose we keep this bug for grub2 change to match upstream, but it may be worth revisiting how we can merge update-initramfs -c and update-initramfs -u calls when updating kernels and other packages touching initramfs in one session.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "use-triggers.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

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

Other bug subscribers

Related blueprints

Remote bug watches

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