当我尝试
$ sudo apt-get install synaptic
我有这个错误:
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:
mysql-server-8.0 : Depends: mysql-server-core-8.0 (= 8.0.22-
0ubuntu0.20.10.2) but 8.0.23-
0ubuntu0.20.10.1 is to be installed
synaptic : Depends: libept1.6.0 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages
(or specify a solution).
然后我尝试:
$ sudo apt-get -f install
我有这个错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-5.8.0-38 linux-headers-5.8.0-38-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mysql-server-8.0
Suggested packages:
mailx tinyca
The following packages will be upgraded:
mysql-server-8.0
1 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
2 not fully installed or removed.
Need to get 1,324 kB of archives.
After this operation, 14.3 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.ubuntu.com/ubuntu groovy-security/main amd64 mysql-server-8.0 amd64
8.0.23-0ubuntu0.20.10.1 [1,324 kB]
Fetched 1,324 kB in 7s (184 kB/s)
Preconfiguring packages ...
(Reading database ... 251399 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.23-
0ubuntu0.20.10.1_amd64.deb (--unpack):
new mysql-server-8.0 package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-8.0_8.0.23-
0ubuntu0.20.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试这个代码:
$sudo apt update
输出是:
[sudo] password for sara:
Hit:1 http://ir.archive.ubuntu.com/ubuntu groovy InRelease
Hit:2 http://ir.archive.ubuntu.com/ubuntu groovy-updates InRelease
Hit:3 http://ir.archive.ubuntu.com/ubuntu groovy-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu groovy-security InRelease [110
kB]
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 http://archive.canonical.com/ubuntu groovy InRelease
Hit:7 http://archive.canonical.com groovy InRelease
Hit:8 http://archive.canonical.com/ubuntu focal InRelease
Fetched 110 kB in 6s (17.9 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
51 packages can be upgraded. Run 'apt list --upgradable' to see them.
我搜索了很多,但没有找到好的解决方案。你能帮帮我吗?
答案1
最近遇到了类似的问题,在我的例子中,mysql 服务链接似乎已断开。请按照以下步骤操作:
- 检查是否有任何损坏的服务链接 (
/etc/systemd/system/mysql.service
) - 删除所有 MariaDB 内容 (
sudo dpkg --get-selections | grep maria
) - 找到详细信息这里