grub-legacy-ec2 installs files in /etc/kernel/kernel/post(inst|rm).d

Bug #1581416 reported by Wolfgang Karall-Ahlborn
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Fix Released
Low
Unassigned
Artful
Fix Released
Medium
Unassigned

Bug Description

=== Begin SRU Template ===
[Impact]
Packaging changes caused grub-legacy-ec2 package to install its
kernel post-install and post-rm hooks into
   /etc/kernel/kernel/postinst.d
   /etc/kernel/kernel/postrm.d
rather than
   /etc/kernel/postinst.d
   /etc/kernel/postrm.d

The result was that kernel package installation or updates
would not execute these scripts and the /boot/grub/menu.lst that
was updated would not get updated.

[Test Case]
if [ ! -f lxc-proposed-snapshot ]; then
  wget https://git.launchpad.net/~smoser/cloud-init/+git/sru-info/plain/bin/lxc-proposed-snapshot
  chmod 755 lxc-proposed-snapshot
fi

$ ./lxc-proposed-snapshot --proposed --publish xenial xenial-proposed
$ lxc launch xenial-proposed test-1581416
$ sleep 10 ; echo wait for boot
$ lxc exec test-1581416 -- apt-get update -q
$ lxc exec test-1581416 -- apt-get install grub-legacy-ec2

## look at files in the package, verify the right directory.
$ lxc exec test-1581416 -- dpkg-query -L grub-legacy-ec2 | grep kernel
/etc/kernel/postinst.d/x-grub-legacy-ec2
/etc/kernel/postrm.d/x-grub-legacy-ec2

## install a kernel make sure it does not fail.
$ lxc exec test-1581416 -- apt-get install linux-image-virtual
...
run-parts: executing /etc/kernel/postinst.d/x-grub-legacy-ec2 4.13.0-32-generic /boot/vmlinuz-4.13.0-32-generic
...

## Now verify that the menu.lst has the expected kernel that was installed.
$ lxc exec test-1581416 -- grep vmlinuz /boot/grub/menu.lst
# kernel /vmlinuz root=/dev/hda2 ro
kernel /boot/vmlinuz-4.13.0-32-generic root=LABEL=cloudimg-rootfs ro console=hvc0
kernel /boot/vmlinuz-4.13.0-32-generic root=LABEL=cloudimg-rootfs ro single

[Regression Potential]
These scripts will now get executed at the times when kernel package
hooks execute. A failure of the script will bubble up and cause failure
of dpkg or apt.

[Other Info]
Upstream commit at
  https://git.launchpad.net/cloud-init/commit/?id=f1246a1f8b

=== End SRU Template ===

Hi,

can't use apport, so reporting this via the web.

$ lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04
$ apt-cache policy grub-legacy-ec2
grub-legacy-ec2:
  Installed: 0.7.7~bzr1212-0ubuntu1
  Candidate: 0.7.7~bzr1212-0ubuntu1
  Version table:
 *** 0.7.7~bzr1212-0ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

The debian/grub-legacy-ec2.install file seems to be wrong, files end up in

$ dpkg -L grub-legacy-ec2 | grep /etc
/etc
/etc/kernel
/etc/kernel/kernel
/etc/kernel/kernel/postinst.d
/etc/kernel/kernel/postinst.d/x-grub-legacy-ec2
/etc/kernel/kernel/postrm.d
/etc/kernel/kernel/postrm.d/x-grub-legacy-ec2

where they will not be picked up by linux-image-* postinst scripts.

Cheers
Wolfgang

Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.8-61-g2d2ec70-0ubuntu1

---------------
cloud-init (0.7.8-61-g2d2ec70-0ubuntu1) zesty; urgency=medium

  * debian/grub-legacy-ec2.install: install post(inst|rm) files correctly.
    [Simon Deziel] (LP: #1581416)
  * New upstream snapshot.
    - OpenStack: extend physical types to include hyperv, hw_veb, vhost_user. [Scott Moser] (LP: #1642679)
    - tests: fix assumptions that expected no eth0 in system. [Scott Moser] (LP: #1644043)
    - net/cmdline: Consider ip= or ip6= on command line not only ip= [Scott Moser] (LP: #1639930)
    - Just use file logging by default [Joshua Harlow] (LP: #1643990)
    - Improve formatting for ProcessExecutionError [Wesley Wiedenmeier]
    - flake8: fix trailing white space [Scott Moser]
    - Doc: various documentation fixes [Sean Bright]
    - cloudinit/config/cc_rh_subscription.py: Remove repos before adding [Brent Baude]
    - packages/redhat: fix rpm spec file. [Scott Moser]
    - main: set TZ in environment if not already set. [Ryan Harper]
    - Azure: No longer rely on walinux agent. [Scott Moser] (LP: #1538522)
    - disk_setup: Use sectors as unit when formatting MBR disks with sfdisk. [Daniel Watkins] (LP: #1460715)

 -- Scott Moser <email address hidden> Mon, 28 Nov 2016 16:08:09 -0500

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
David Bartley (dtbartle) wrote :

Is it possible to get fixed packages for xenial as well? You can see in https://packages.ubuntu.com/xenial-updates/all/grub-legacy-ec2/filelist that the locations are still wrong.

Revision history for this message
Scott Moser (smoser) wrote :

I've just pushed a commit to cloud-init's upstream packaging for this at [1]
It should get pulled into the next ubuntu Stable Release of cloud-init.
A "cloud-init daily" ppa build should occur tonight and arrive at [2].

You can test that PPA with:
  sudo add-apt-repository ppa:cloud-init-dev/daily
  sudo apt-get update

It would be helpful if you provided feedback here that the changes fix the
issue you are having. Also, please provide some info on where you were
seeing an issue. I'm trying to grab information on where this grub-legacy-ec2
code still runs.

Thanks!

[1] https://git.launchpad.net/cloud-init/commit/?h=ubuntu/xenial&id=f12fc84e8bf88b
[2] https://launchpad.net/~cloud-init-dev/+archive/ubuntu/daily

Changed in cloud-init (Ubuntu Artful):
status: New → Fix Released
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Xenial):
status: New → Confirmed
importance: Undecided → Low
Scott Moser (smoser)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Wolfgang, or anyone else affected,

Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/17.2-30-gf7deaf15-0ubuntu1~16.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 on 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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

Changed in cloud-init (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-xenial
Scott Moser (smoser)
description: updated
tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Revision history for this message
Chris Halse Rogers (raof) wrote :

Hello Wolfgang, or anyone else affected,

Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/17.2-35-gf576b2a2-0ubuntu1~16.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 on 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!

tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 17.2-35-gf576b2a2-0ubuntu1~16.04.2

---------------
cloud-init (17.2-35-gf576b2a2-0ubuntu1~16.04.2) xenial-proposed; urgency=medium

  * cherry-pick 40e7738: GCE: fix reading of user-data that is not
    base64 encoded. (LP: #1752711)

cloud-init (17.2-35-gf576b2a2-0ubuntu1~16.04.1) xenial-proposed; urgency=medium

  * New upstream snapshot. (LP: #1747059)
    - tests: add support for logs with lxd from snap and future lxd 3.
    - EC2: Fix get_instance_id called against cached datasource pickle.
    - cli: fix cloud-init status to report running when before result.json
    - net: accept network-config in netplan format for renaming interfaces
    - Fix ssh keys validation in ssh_util [Tatiana Kholkina]

 -- Chad Smith <email address hidden> Thu, 01 Mar 2018 16:05:39 -0700

Changed in cloud-init (Ubuntu Xenial):
status: Fix Committed → 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.