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
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub-legacy-ec2 (Ubuntu)
Undecided
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.

Coreigh Utegaard (coreigh) 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.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers