How to solve unmet dependency because of broken package? [duplicate]

(I just moved from ubuntu 18.04 to Ubuntu 20.04.)

What I can't understand

  • The process of how I got to the problem and the detailes are explained below, but I genuinely don't understand the part where it says

php7.4-mysql : Depends: php7.4-common (= 7.4.3-4ubuntu2.2) but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

  • I can understand that the package php7.4-mysql dependes on php7.4-common (which is installed, so I don't see the problem there), but it also says (= 7.4.3-4ubuntu2.2) and then I'm lost... 7.4.3-4ubuntu2.2? WHAT IS THAT? and if that is not complicated enough it adds... but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 and then I just can't figure out how to move past this.

More insight

  • I know a similar questions has been asked, I've read them and the solutions posted don't seem to fix my problem. I'm trying to use the $ php artisan migrate command in a production environment of my own (I hired a hosting and I'm just messing around with it), and I get the output...

 Illuminate\Database\QueryException 

  could not find driver (SQL: select * from information_schema.tables where table_schema = gastigram and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675| 

      +34 vendor frames 
  35  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
  • I googled it and they say is a problem with a missing driver, makes sense... it says right there missing driver, so I tried to install the php7.4-mysql driver but then...

$ sudo apt install php7.4-mysql 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.4-mysql : Depends: php7.4-common (= 7.4.3-4ubuntu2.2) but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I solve this problem with the unmet dependency because of a broken package?

Getting help

  • I run $ apt-cache policy php7.4-common as @guiverc suggested

This is the output

php7.4-common:
  Installed: 7.4.9-1+ubuntu18.04.1+deb.sury.org+1
  Candidate: 7.4.9-1+ubuntu18.04.1+deb.sury.org+1
  Version table:
 *** 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 100
        100 /var/lib/dpkg/status
     7.4.3-4ubuntu2.2 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages
     7.4.3-4ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

I just removed the package that seemed to have problems!

$ sudo apt remove php7.4-common 

Then I installed it again, after that I just tried the same command again, and voila!

I must say that I did check the posts that @Karel suggested and created a new sources.list file the way the answers to those questions suggested, and it worked, it might had something to do with that as well... honestly I didn't try what solved my problem before (that is uninstalling php7.4-common; cause I didn't really understand what the os was telling me), so I don't know if creating the new file with the changes in software & updates helped or not.