package linux-image-4.15.0-24-generic (not installed) failed to install/upgrade: run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1

Bug #1786244 reported by Coreigh Utegaard
32
This bug affects 3 people
Affects Status Importance Assigned to Milestone
grub-legacy-ec2 (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Incomplete
Medium
Unassigned

Bug Description

boot time in ecess of 10 minutes
problem started Monday Aug 6 2018

ProblemType: Package
DistroRelease: Ubuntu 18.04
Package: linux-image-4.15.0-24-generic (not installed)
ProcVersionSignature: Ubuntu 4.15.0-29.31-generic 4.15.18
Uname: Linux 4.15.0-29-generic x86_64
NonfreeKernelModules: kpatch_livepatch_Ubuntu_4_15_0_29_31_generic_41 nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
Date: Wed Aug 8 14:40:30 2018
ErrorMessage: run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1
HibernationDevice: RESUME=UUID=b77bdeec-5a6e-451f-bffe-f472f3de696d
InstallationDate: Installed on 2018-04-17 (113 days ago)
InstallationMedia: Ubuntu-Server 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
IwConfig:
 enp3s0 no wireless extensions.

 lo no wireless extensions.
MachineType: Gigabyte Technology Co., Ltd. B85M-D3H
ProcFB: 0 VESA VGA
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-29-generic root=UUID=ccf40719-b29e-46cb-b266-ad7842050287 ro quiet splash vt.handoff=1
PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No PulseAudio daemon running, or not running as session daemon.
Python3Details: /usr/bin/python3.6, Python 3.6.5, python3-minimal, 3.6.5-3ubuntu1
PythonDetails: /usr/bin/python2.7, Python 2.7.15rc1, python-minimal, 2.7.15~rc1-1
RelatedPackageVersions:
 dpkg 1.19.0.5ubuntu2
 apt 1.6.3
RfKill:
 0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no
SourcePackage: grub-legacy-ec2
Title: package linux-image-4.15.0-24-generic (not installed) failed to install/upgrade: run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1
UpgradeStatus: Upgraded to bionic on 2018-04-27 (104 days ago)
dmi.bios.date: 09/19/2014
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: F14
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: B85M-D3H
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: Gigabyte Technology Co., Ltd.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrF14:bd09/19/2014:svnGigabyteTechnologyCo.,Ltd.:pnB85M-D3H:pvrTobefilledbyO.E.M.:rvnGigabyteTechnologyCo.,Ltd.:rnB85M-D3H:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.family: To be filled by O.E.M.
dmi.product.name: B85M-D3H
dmi.product.version: To be filled by O.E.M.
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Related branches

Revision history for this message
Coreigh Utegaard (coreigh) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
from your log:
[...]
Searching for GRUB installation directory ... found: /boot/grub
Testing for an existing GRUB menu.lst file ...
Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub-legacy-ec2: line 1101: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1

The code there is:
        else
                echo -n "Would you like $menu_file generated for you? " >&2
                echo -n "(y/N) " >&2
                read answer <&2
        fi

That would usually work fine, example:
$ cat test.sh
#!/bin/bash
answer="foo"
read answer <&2
echo ${answer}

$ ./test.sh
asd
asd

But when run withou disconnected stdin/out it will fail like that.
$ nohup ./test.sh
nohup: ignoring input and appending output to 'nohup.out'
$ cat nohup.out
./test.sh: line 3: read: read error: 0: Bad file descriptor
foo

I must admit I never have seen ain input &2 so far.
So I wonder what it does in that case
  read answer <&2
@smoser - do you know?

In any case it should probably be more resilent against stdin missing.
As it already has a default value and my test showed that with the error it is kept we might just add "|| true" to make a fail to read non-fatal for the overall execution.
@smoser - opinion on this suggestion?

I subscribed smoser for his experience on this.

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

'read <&2' seems like its probably a bug.
unless something else

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

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

Changed in grub-legacy-ec2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub-legacy-ec2 - 1:1ubuntu1

---------------
grub-legacy-ec2 (1:1ubuntu1) disco; urgency=medium

  * Fix a bug occuring from postinst if /boot/grub/menu.lst did
    not exist (LP: #1786244).

 -- Scott Moser <email address hidden> Mon, 17 Dec 2018 16:33:02 -0500

Changed in grub-legacy-ec2 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
ethan.hsieh (ethan.hsieh) wrote :

@Christian
This issue also happens to bionic. (LP: #1844738)
Could you help to backport the patch to binoic?

Bryce Harrington (bryce)
Changed in grub-legacy-ec2 (Ubuntu Bionic):
status: New → Confirmed
tags: added: server-next
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Lets continue on your new bug then as the cases might slightly differ IMHO.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Note: we can come back here once we are convinced it is the same bug.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI: discussions are going on on the other bug atm.

Changed in grub-legacy-ec2 (Ubuntu Bionic):
assignee: nobody → Christian Ehrhardt  (paelzer)
importance: Undecided → Medium
Revision history for this message
ethan.hsieh (ethan.hsieh) wrote :

@Christian
LP: #1844738 doesn't happen to Bionic, it only happens to customized Bionic server image.
Thanks for your help. It has been fixed by new customized image.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

If I understood this correctly, the bionic task is then invalid? Setting to "incomplete" for now.

Changed in grub-legacy-ec2 (Ubuntu Bionic):
status: Confirmed → Incomplete
Changed in grub-legacy-ec2 (Ubuntu Bionic):
assignee: Christian Ehrhardt  (paelzer) → nobody
tags: removed: server-next
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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