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 on 2018-08-09
This bug affects 3 people
Affects Status Importance Assigned to Milestone
grub-legacy-ec2 (Ubuntu)

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)
 enp3s0 no wireless extensions.

 lo no wireless extensions.
MachineType: Gigabyte Technology Co., Ltd. B85M-D3H
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
 apt 1.6.3
 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) 09/19/2014
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: F14
dmi.board.asset.tag: To be filled by O.E.M. 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.: To be filled by O.E.M. B85M-D3H
dmi.product.version: To be filled by O.E.M.
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Coreigh Utegaard (coreigh) wrote :

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:
                echo -n "Would you like $menu_file generated for you? " >&2
                echo -n "(y/N) " >&2
                read answer <&2

That would usually work fine, example:
$ cat
read answer <&2
echo ${answer}

$ ./

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

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.

Scott Moser (smoser) wrote :

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

Launchpad Janitor (janitor) wrote :

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

Changed in grub-legacy-ec2 (Ubuntu):
status: New → Confirmed
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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers