0

I recently upgraded Ubuntu 18.04lts to 20.04lts. Now I receive the same error if I am trying to remove, purge, install anything in the terminal. I am at a loss on this, anything I have tried to find online requires some sort of action in the terminal which still gives me the same output.

dpkg: error processing package linux-image-4.15.0-88-generic (--remove):
 installed linux-image-4.15.0-88-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping

Errors were encountered while processing:
 linux-image-4.15.0-88-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

output for sudo apt update:

Get:1 http://us.archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal InRelease     
Hit:4 http://download.opensuse.org/repositories/home:/strycore/Debian_10 ./ InRelease
Hit:5 http://ppa.launchpad.net/lutris-team/lutris/ubuntu focal InRelease       
Get:6 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB]
Hit:7 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:8 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,004 B]
Get:9 http://us.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [648 B]
Fetched 357 kB in 2s (224 kB/s)   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

sudo apt autoremove:

sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.15.0-88-generic
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 8,402 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 211935 files and directories currently installed.)
Removing linux-image-4.15.0-88-generic (4.15.0-88.88) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-88-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: ^x: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-4.15.0-88-generic (--remove):
 installed linux-image-4.15.0-88-generic package post-removal script subprocess 
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-4.15.0-88-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I think I am at the point where I have to format my harddrive and just install a fresh OS. It seems every thread I go to requires some form of work around in the terminal. Nothing I do works in terminal. Unless someone knows a gui rout to fix it.

 cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

^x
x
X
Daniel
  • 19

2 Answers2

0

I ran into the same issue myself. For some reason the initramfs-tools package seems to be either damaged or acting weird after do-release-upgrade. Removing and re-installing the package seems to do the trick, so:

sudo apt remove initramfs-tools
sudo apt install initramfs-tools

Also remember to reinstall the latest kernel or at least in my case ended up with VFS panic:

apt reinstall -f linux-image-5.4.0-26-generic

Taking these steps cleared it for me in our GitLab install.

I normally don't use Ubuntu so there may be better ways to get around this.

Miuku
  • 101
0

Solved the issue after following Kulfy's comment:

Last 3 lines contains illegal entries for a GRUB file. And that's what DPKG was complaining. Run sudo nano /etc/default/grub, remove the last 3 lines and save the file. Run sudo dpkg --configure -a; sudo apt autoremove

Kulfy
  • 18,154
Daniel
  • 19