need to run update-grub when grub-install

Bug #1373137 reported by Scott Moser
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
Fix Released
High
Unassigned
curtin (Ubuntu)
Fix Released
High
Unassigned
Trusty
Fix Released
High
Unassigned

Bug Description

I noticed this when installing ppc64el, as boot would fail. It would fail because no /boot/grub/grub.cfg existed.
I'm not entirely sure when we need to run update-grub.

I know that the 'install_grub' was choosing to *not* run update-grub because sometimes dpkg-reconfigure would do the same thing, and that was a slow operation.

Its possible there are more complex symantics involved than I understood. But we were not running 'update-grub' in order to save some time.

Basically, as input to 'install_grub', we have:
  * the target to install to (/dev/sda1 or /dev/sda)
  * the dpkg arch
  * the name of the package to 'dpkg-reconfigure' (derived from the dpkg arch and whether or not to use uefi).
    we dpkg-reconfigure because we may change the GRUB_CMDLINE_LINUX_DEFAULT to include additional options such as console=

From my memory, it seemed like on amd64 and i386, running 'dpkg-reconfigure grub-pc' would end up running update-grub. I then chose not to run update-grub because it was slow.

Colin, Is there some simple logic that I can use to determine when running update-grub is needed?

SRU curtin
==========

[Impact]

This bug will make it so boot fails when installing ppc64el. It would fail because no /boot/grub/grub.cfg existed.

This backport is needed so that we can install for ppc64el and any other architectures that were failing because update-grub was not being executed when doing grub-install.

This upload fixes the bug by making sure that update-grub is executed when doing grub-install

[Test Case]

To reproduce this bug you would need to follow what was being done as outlined in the original bug report description. Namely, you would need to do a curtin install for ppc64el.

[Regression Potential]

update-grub can be run multiple times so even in the event that update-grub is executed a second time by some other package, like the original bug reporter mentions in the original bug report description, it is unlikely to cause any regressions.

Scott Moser (smoser)
Changed in curtin (Ubuntu):
status: New → Triaged
Changed in curtin:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → High
Changed in curtin (Ubuntu):
importance: Undecided → High
Revision history for this message
Scott Moser (smoser) wrote :

the 'install_grub' code is at http://bazaar.launchpad.net/~curtin-dev/curtin/trunk/view/head:/helpers/common#L375
I'd love to have something less hueristics and messy.

Attaching a fix that runs update-grub.

Revision history for this message
Ashley Lai (alai) wrote :

Tested it and it works. Thanks.

tags: added: patch
Revision history for this message
Colin Watson (cjwatson) wrote :

The GRUB maintainer scripts won't run update-grub unless /boot/grub/grub.cfg already exists, so your installation script must run it. It shouldn't be particularly slow unless os-prober has to go out to lots of slow disks.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package curtin - 0.1.0~bzr190-0ubuntu1

---------------
curtin (0.1.0~bzr190-0ubuntu1) utopic; urgency=medium

  * New upstream snapshot.
    * add log reporter (LP: #1369129, LP: #1371218)
    * allow debug messages of helper programs to be seen
    * fix 'make check'
    * handle utf-8 output correctly. (LP: #1370249)
    * set root device correctly on ppc64 (LP: #1371133)
    * call update-grub to ensure grub.cfg is written (LP: #1373137)
    * fix dd-tgz mode, only call partprobe on target device.
 -- Scott Moser <email address hidden> Fri, 26 Sep 2014 17:26:34 -0400

Changed in curtin (Ubuntu):
status: Triaged → Fix Released
Scott Moser (smoser)
Changed in curtin (Ubuntu Trusty):
status: New → Confirmed
importance: Undecided → High
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Scott, or anyone else affected,

Accepted curtin into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/curtin/0.1.0~bzr195-0ubuntu1~14.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in curtin (Ubuntu Trusty):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
Andres Rodriguez (andreserl) wrote :

We have tested this, and we can confirm that this issue has been resolved.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for curtin has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package curtin - 0.1.0~bzr195-0ubuntu1~14.04.1

---------------
curtin (0.1.0~bzr195-0ubuntu1~14.04.1) trusty-proposed; urgency=medium

  * New upstream snapshot.
    - hardware enablement: ppc64 support (LP: #1386394)
    - hardware enablement: know kernel mapping for utopic (hwe-u = 3.16)
      (LP: #1386394)
    - feature: support installing disk images including windows. (LP: #1386394)
    - feature: support creating swap file (LP: #1386394)
    - feature: support reporting logs back to MAAS (LP: #1386394)
    - feature: enable logging of installation to /var/log/curtin/install.log
      (LP: #1378910)
    - bug fix: extract tar files with xattr support when available (LP: #1313550)
    - bug fix: fix broken use of os.path.join for curtin hooks (LP: #1328521)
    - bug fix: util.subp to decode command output as utf-8 (LP: #1370249).
    - bug fix: call update-grub to ensure that /boot/grub/grub.cfg is created
      (LP: #1373137)
    - bug fix: do not use '--acl' when extracting tar files (LP: #1382632)
      as it inadvertently writes default directory acls.
    - bug fix: invoke lsblk with '--output' rather than '--out' to avoid
      ambiguity in newer versions of lsblk (LP: #1386275)
    - internal: part2bd helper added in helpers/common
    - internal: helpers: inherit curtin_verbosity (make the helper tools
      verbose if curtin invoked with verbose flags)
 -- Scott Moser <email address hidden> Mon, 27 Oct 2014 20:58:43 -0400

Changed in curtin (Ubuntu Trusty):
status: Fix Committed → Fix Released
Changed in curtin:
status: Triaged → Fix Released
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.