Unmet dependencies. Try 'apt --fix-broken install'- Conflict in linux-image

I can't install packages with apt. I am using Ubuntu 20.04 Focal.

Some packages require linux-image-5.11.0-38-generic, as seen below.

:~$ sudo apt install <package>

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 linux-image-generic-hwe-20.04 : Depends: linux-image-5.11.0-38-generic but it is not going to be installed
 linux-modules-5.11.0-38-generic : Depends: linux-image-5.11.0-38-generic but it is not going to be installed or
                                            linux-image-unsigned-5.11.0-38-generic but it is not going to be installed
 linux-modules-extra-5.11.0-38-generic : Depends: linux-image-5.11.0-38-generic but it is not going to be installed or
                                                  linux-image-unsigned-5.11.0-38-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

My kernel:

$ uname -r
5.11.0-37-generic

Can I install 5.11.0-38 somehow? Or downgrade these packages so that they will be compatible with 5.11.0-37?


From this tutorial:

Method 1: Reconfigure Package Database

The first method you can try is to reconfigure the package database. Probably the database got corrupted while installing a package. Reconfiguring often fixes the problem.

sudo dpkg --configure -a

Method 2: Use force install

If a package installation was interrupted previously, you may try to do a force install.

sudo apt-get install -f

Method 3: Try removing the troublesome package

If it’s not an issue for you, you may try to remove the package manually. Please don’t do it for Linux Kernels (packages starting with linux-).

sudo apt remove package_name

Method 4: Remove post info files of the troublesome package

This should be your last resort. You can try removing the files associated to the package in question from /var/lib/dpkg/info.


So I found the answer in my case was a bad /etc/default/grub file. I found an extra pair of quotes on my GRUB_CMDLINE_LINUX_DEFAULT= that i had edited a while back.

I fixed the grub file and ran update-grub rebooted, then did an apt --fix-broken install. This fixed my updates and now I'm on 5.11.0-41-generic with no issues.