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
  • Did you encounter ANY errors during the upgrade? If so, please detail in your question above. Also, since the normal do-release-upgrade path is not open yet, please detail the method you used to upgrade in your question above. – user535733 Apr 24 '20 at 19:43
  • https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-04-lts-focal-fossa I followed this website for the upgrade. After some research no one doing the upgrade from 18.04 to 20.04 has had any errors yet, and I had no errors during the upgrade. Everything was successful. – Daniel Apr 24 '20 at 20:53
  • I also have been updating my system. Which is what is also confusing me. 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux after running uname -a – Daniel Apr 24 '20 at 20:53
  • every thing I try to install this is the first thing it tries to do and fails........"The following packages will be REMOVED: linux-image-4.15.0-88-generic" – Daniel Apr 24 '20 at 21:42
  • none of those from https://askubuntu.com/questions/438345/how-to-remove-install-a-package-that-is-not-fully-installed helped. anything that uses sudo apt causes the error – Daniel Apr 26 '20 at 21:47
  • Line no. 35 in /etc/default/grub is malformed. – Kulfy May 02 '20 at 21:18
  • what does that mean? – Daniel May 02 '20 at 21:20
  • 1
    Are you able to open Terminal? Run cat /etc/default/grub. Observe line no. 35. It contains some alien entry ^x. Ideally, please [edit] your question and add the output of cat /etc/default/grub. – Kulfy May 02 '20 at 21:23
  • 1
    There you go. 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 May 02 '20 at 21:31
  • That worked! Thank you so much! I have no idea why illegal characters were in there... – Daniel May 02 '20 at 21:38
  • To be noted: If in nano you see ^X to exit the editor, it means Ctrl+X. – Kulfy May 02 '20 at 21:39

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
  • unable to do this. It seems anything I do in the terminal trys to remove the old kernel and quits because of too many errors. – Daniel Apr 26 '20 at 21:41
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
  • 17,696
Daniel
  • 19
  • I'd recommend you to please delete the comments which are outdated/not relevant to the post. Moreover, if possible, try to include essential details from comments into the post. – Kulfy May 03 '20 at 08:27