如何解决由于包损坏而导致的未满足的依赖关系?

new*_*bie 2 mysql php laravel

刚刚从 ubuntu 18.04 迁移到 Ubuntu 20.04。

我不明白什么

  • 下面解释了我如何解决问题的过程和细节,但我真的不明白它说的部分

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.
Run Code Online (Sandbox Code Playgroud)
  • 我可以理解该软件包php7.4-mysql依赖on php7.4-common(已安装,所以我没有看到那里的问题),但它也说(= 7.4.3-4ubuntu2.2)然后我迷路了...... 7.4.3-4ubuntu2.2?那是什么?如果这还不够复杂,它会添加......but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1然后我就是不知道如何克服这个问题。

更多见解

  • 我知道有人问过类似的问题,我已经阅读过它们,并且发布的解决方案似乎无法解决我的问题。我正在尝试$ php artisan migrate在自己的生产环境中使用该命令(我雇用了一个托管服务器,我只是在摆弄它),然后我得到了输出......

 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()
Run Code Online (Sandbox Code Playgroud)
  • 我用谷歌搜索了一下,他们说是缺少驱动程序的问题,这是有道理的...它说就在那里缺少驱动程序,所以我尝试安装 php7.4-mysql 驱动程序,但然后...

$ 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.
Run Code Online (Sandbox Code Playgroud)

由于包损坏而导致未满足的依赖关系,如何解决这个问题?

寻求帮助

  • $ apt-cache policy php7.4-common按照@guiverc的建议运行

这是输出

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
Run Code Online (Sandbox Code Playgroud)

new*_*bie 9

我刚刚删除了似乎有问题的包!

$ sudo apt remove php7.4-common 
Run Code Online (Sandbox Code Playgroud)

然后我再次安装了它,之后我再次尝试了相同的命令,

我必须说,我确实检查了@Karel 建议的帖子,并按照这些问题的答案建议的方式创建了一个新的sources.list 文件,并且它有效,它可能也与此有关......老实说,我没有没有尝试之前解决我的问题的方法(即卸载 php7.4-common;因为我并没有真正理解操作系统告诉我的内容),所以我不知道是否使用软件中的更改创建新文件&更新有帮助与否。