所以,我输入“apt install mysql-server-8.0”,它返回:
Building dependency tree
Reading state information... Done
Suggested packages:
tinyca
The following packages will be upgraded:
mysql-server-8.0
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,249 kB of archives.
After this operation, 20.5 kB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 306894 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: warning: old mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb (--unpack):
new mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg: error while cleaning up:
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我试过卸载,重新安装,安装。没有任何效果。我将相关.deb
文件移至/tmp
from /var/cache/apt/archives/
,但仍然无法将其从我的系统中取出。mysql 5.7 似乎仍在这台机器上,尝试删除它会导致相同的错误。我已经束手无策了。谷歌没有帮助(遵循了许多方向,包括这里的一个:https : //itsfoss.com/dpkg-returned-an-error-code-1/ 无济于事)。
所以我做了:dpkg --configure -a
它吐了回来:
dpkg: dependency problems prevent configuration of mysql-server-8.0:
mysql-server-8.0 depends on mysql-server-core-8.0 (= 8.0.20-0ubuntu0.20.04.1); however:
Version of mysql-server-core-8.0 on system is 8.0.21-0ubuntu0.20.04.3.
dpkg: error processing package mysql-server-8.0 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-8.0
Ubuntu 20.04 LTS
我想我解决了这个问题(经过很多小时搜索谷歌):
$
sudo nano /var/lib/dpkg/info/mysql-server-core-8.0.prerm
注释掉命令
if
周围的语句invoke.d
(或其他任何语句),保存并退出 nano。$
sudo apt remove mysql-server-core-8.0
似乎已经成功了...
synaptic
:“图形前端到 apt,Ubuntu 中的包管理系统”Mark All Upgrades
从选项卡中单击。该问题可能是由某些依赖项引起的,这些依赖项未预先安装在您的机器中。