bash syntax error in the postinst script

Bug #1692181 reported by Ankit Pati
232
This bug affects 51 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
Critical
Unassigned

Bug Description

Description: Ubuntu 16.04.2 LTS
Release: 16.04

grub-efi-amd64:
  Installed: 2.02~beta2-36ubuntu3.10
  Candidate: 2.02~beta2-36ubuntu3.10
  Version table:
 *** 2.02~beta2-36ubuntu3.10 500
        500 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     2.02~beta2-36ubuntu3.9 500
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     2.02~beta2-36ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Line 699 of the following post-installation script

/var/lib/dpkg/info/grub-efi-amd64.postinst

reads thus, after the latest update.

      if dpkg --compare-versions "$2" lt-nl 2.02~beta2-36ubuntu3.10 then

Notice the missing semicolon before the then clause of the if statement.

It should really be

      if dpkg --compare-versions "$2" lt-nl 2.02~beta2-36ubuntu3.10 ; then

Fortunately, I noticed the issue from the dist-upgrade output, and fixed it before rebooting the machine as requested by Software Updater, or there is no telling where I could have been stuck.

After patching it, one needs to rerun

sudo apt -y dist-upgrade

so the postinst script is actually correctly run.

This is a major bug for an LTS release.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: grub-efi-amd64 2.02~beta2-36ubuntu3.10
ProcVersionSignature: Ubuntu 4.4.0-79.100-generic 4.4.67
Uname: Linux 4.4.0-79-generic x86_64
NonfreeKernelModules: wl nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.1-0ubuntu2.6
Architecture: amd64
CurrentDesktop: Unity
Date: Sat May 20 12:20:02 2017
InstallationDate: Installed on 2016-05-23 (361 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
JournalErrors:
 Error: command ['journalctl', '-b', '--priority=warning', '--lines=1000'] failed with exit code 1: Hint: You are currently not seeing messages from other users and the system.
       Users in the 'systemd-journal' group can see all messages. Pass -q to
       turn off this notice.
 No journal files were opened due to insufficient permissions.
SourcePackage: grub2
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Ankit Pati (ankitpati) wrote :
description: updated
Ankit Pati (ankitpati)
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "This file has just a single semicolon more than the original shipped with the latest update." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

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

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

Confirmed on multiple machines with -proposed enabled. Please ensure we address before that moves to -updates.

Changed in grub2 (Ubuntu):
importance: Undecided → Critical
Revision history for this message
Simon Déziel (sdeziel) wrote :

I can confirm that the new -proposed package (2.02~beta2-36ubuntu3.11) doesn't have the issue.

Revision history for this message
Steve Langasek (vorlon) wrote :

Sorry for missing this. A new version of grub2 has been uploaded to xenial-proposed that fixes the postinst bug, and has now been published.

Changed in grub2 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1692181] Re: bash syntax error in the postinst script

Phew, thanks. Confirmed fixed on all machines.

Mark

Revision history for this message
Ankit Pati (ankitpati) wrote :

Thank you for the really prompt response.

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.