2

I am having an error when I was trying to install docker.

I have tried sudo apt-get autoremove but it didn't help.

Here's the output:

sudo apt install docker.io            
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-modules-4.15.0-29-generic
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  bridge-utils cgroupfs-mount containerd pigz runc ubuntu-fan
Suggested packages:
  aufs-tools btrfs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils
The following packages will be REMOVED:
  linux-image-4.15.0-29-generic
The following NEW packages will be installed:
  bridge-utils cgroupfs-mount containerd docker.io pigz runc ubuntu-fan
0 upgraded, 7 newly installed, 1 to remove and 433 not upgraded.
1 not fully installed or removed.
Need to get 0 B/52.2 MB of archives.
After this operation, 249 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 280062 files and directories currently installed.)
Removing linux-image-4.15.0-29-generic (4.15.0-29.31~16.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-29-generic
/etc/kernel/postrm.d/zz-update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
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: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-4.15.0-29-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-29-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
Kulfy
  • 17,696
jonjk
  • 23

2 Answers2

1

sudo apt-get autoremove was for removing a package that was effectively clutter.

The answer to your problem is most likely to be in the last 'paragraph.' The problem looks like it's unable to locate a /boot/grub/menu.lst file. It asks, Would you like /boot/grub/menu.lst generated for you? (y/N)

If you said no (N), you likely need to try again but say yes (y).

If you said yes, I recommend checking if the file exists in your system. If it doesn't, you can create a blank file and see if that works. If it does, you can attempt to read it to see if it has an obvious issue or temporarily rename it for safekeeping and replace it with a blank file.

Here is a question where someone had the same error message and the accepted answer involved creating a blank file by that name: Ubuntu Server 18.04 apt-get Fails

Kai
  • 38
1

The most problematic line in your output is

/usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1

So you need to reinstall GRUB related package with

sudo apt-get install --reinstall grub2-common

first and then retry.

N0rbert
  • 99,918