2

(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
10
  • Hi @guiverc I just moved from ubuntu 18.04 to Ubuntu 20.04. (updated my question)
    – newbie
    Sep 9, 2020 at 3:41
  • Can you add a apt-cache policy php7.4-common as it looks like you've added 3rd party sources that weren't built for *focal*/20.04 packages.ubuntu.com/…
    – guiverc
    Sep 9, 2020 at 3:43
  • I just updated my question with the output @guiverc I must say you seem to found out so easily were the problem was!
    – newbie
    Sep 9, 2020 at 3:45
  • I don't think so @karel
    – newbie
    Sep 9, 2020 at 3:55
  • 1
    The results of apt-cache policy php7.4-common clearly show that php7.4-common was not installed from the standard Ubuntu sources.list. It was installed from a PPA , so you must remove php7.4-common and update with sudo apt update.
    – karel
    Sep 9, 2020 at 4:09

1 Answer 1

8

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.

5
  • 1
    FYI: If you look at the apt-cache output you provided, you'd installed a later version back on 18.04, which stopped the official focal (20.04) version from being installed. apt and package tools are built to upgrade to the latest version (7.4.9 > 7.4.3) so the correct 20.04/focal version wouldn't install. The apt-cache you provided didn't include a source for it (so that source had been removed during upgrade probably thus no source is listed in "**" section), thus when removed; and re-installed it installed the latest available (which then was 7.4.3 intended for *focal (20.04).
    – guiverc
    Sep 9, 2020 at 5:09
  • @guiverc what is in "**" section (are we talking about sources.list)? I had the 7.4.9 installed, and are you saying that the latest version for focal is 7.4.3... why is that? so I went backwards to a compatible version and that fixed that part of the issue? I already solved both of the problems and could run $php artisan migrate (I'm really new at laravel, but my db is in production and working alright), I had to do a couple of things, it wasn't easy at all for a newbie like myself! Thanks for all the helped I had no idea about this kind of things...
    – newbie
    Sep 9, 2020 at 5:34
  • 1
    sorry I'm rushed for time (it should have been '***')... In your above post there is "**** 7.4.9-1+ubuntu18.04.1+deb.sury.org+1*" which doesn't include a http: line like following, meaning you have no source for it anymore (ie. it was downloaded & installed manually, OR my guess was the release-upgrade disabled the PPA it came from as it does that). The official package is the 7.4.3 listed in the URL in my now first comment, which matches your apt-cache output too meaning you sources are up-to-date. My prior comment was for information/learning purposes only.
    – guiverc
    Sep 9, 2020 at 5:41
  • @guiverc I asked for information/learning purposes only :-) I actually installed that manually, so you guessed right ;-) THANKS! it was very informative!
    – newbie
    Sep 9, 2020 at 6:15
  • I have also gone through the issue. Now working after applying your solution. Thanks!!
    – Siva
    May 2, 2022 at 10:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.