无法在 Ubuntu Server 上安装任何内容

无法在 Ubuntu Server 上安装任何内容
whatever7788@ubuntuServer:~$ sudo apt-get install pptpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
pptpd is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.5 (5.5.44-0ubuntu0.14.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
whatever7788@ubuntuServer:~$

我无法在我的 ubuntu 服务器上安装几乎所有东西。它从 3 天前我尝试在服务器上安装 MySQL 时开始。当我尝试安装 MySQL 时,我提示我输入密码,输入密码并继续后,它给了我以下屏幕:

┌───────────────────────Configuring mysql-server-5.5─────────────────────────┐
│ Unable to set password for the MySQL "root" user                           │
│                                                                            │
│ An error occurred while setting the password for the MySQL                 │
│ administrative user. This may have happened because the account already    │
│ has a password, or because of a communication problem with the MySQL       │
│ server.                                                                    │
│                                                                            │
│ You should check the account's password after the package installation.    │
│                                                                            │
│ Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for     │
│ more information.                                                          │
│                                                                            │
│                                                                            │
├────────────────────────────────────────────────────────────────────────────┤
                                 │ < OK > │
└────────────────────────────────────────────────────────────────────────────┘

然后我点击了“确定”。我得到了错误:

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
whatever7788@ubuntuServer:~$

今天当我尝试安装 pptpd 时,我遇到了同样的错误...所以我认为错误是由于 MySQL 服务器安装失败而开始的。

我非常努力地尝试安装 MySQL,并查看了互联网上的所有解决方案,但仍然无法安装它。

我已尝试以下所有方法,但问题仍然存在:

dpkg -S etc/mysql
aptitude purge mysql-server --purge-unused
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg --configure -a
sudo apt-get update 

我也尝试过这个,但没有成功:

sudo apt-get purge mysql-server mysql-client mysql-common mysql-client-5.5 mysql-server-5.5 
sudo dpkg -i mysql-5.6.13-debian6.0-i686.deb 
sudo apt-get install mysql-server

有人能帮帮我吗?提前谢谢了。

答案1

您必须更改postrm以清除包:

  1. 打开文件

    sudo nano /var/lib/dpkg/info/mysql-server-5.5.postrm
    
  2. 查找代码片段

    if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
      stop_server
      sleep 2
    fi
    

    并注释掉这一行stop_server

    if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
      # stop_server
      sleep 2
    fi
    
  3. 保存文件并再次清除

    sudo apt-get purge mysql-server-5.5
    

此后,您就修复了系统,可以再次安装和卸载软件包。

相关内容