2016-10-10 208 views
0

我在Raspberry Pi上运行lighttpd web服务器,我试图添加php和mysql支持。我目前正试图安装mysql服务器用命令Raspbian - 尝试安装mysql服务器时出现dpkg错误

'sudo apt-get install mysql-server'

这将导致以下错误:

[my user name]@raspberrypi:~ $ sudo apt-get install mysql-server 
Reading package lists... Done 
Building dependency tree 
Reading state information... Done 
The following extra packages will be installed: 
    libaio1 libhtml-template-perl mysql-server-5.5 mysql-server-core-5.5 
Suggested packages: 
    libipc-sharedcache-perl mailx tinyca 
The following NEW packages will be installed: 
    libaio1 libhtml-template-perl mysql-server mysql-server-5.5 
    mysql-server-core-5.5 
0 upgraded, 5 newly installed, 0 to remove and 15 not upgraded. 
Need to get 0 B/4,938 kB of archives. 
After this operation, 46.0 MB of additional disk space will be used. 
Do you want to continue? [Y/n] y 
WARNING: The following packages cannot be authenticated! 
    libaio1 mysql-server-core-5.5 mysql-server-5.5 libhtml-template-perl 
    mysql-server 
Install these packages without verification? [y/N] y 
Preconfiguring packages ... 
Selecting previously unselected package libaio1:armhf. 
(Reading database ... 121517 files and directories currently installed.) 
Preparing to unpack .../libaio1_0.3.110-1_armhf.deb ... 
Unpacking libaio1:armhf (0.3.110-1) ... 
Selecting previously unselected package mysql-server-core-5.5. 
Preparing to unpack .../mysql-server-core-5.5_5.5.52-0+deb8u1_armhf.deb ... 
Unpacking mysql-server-core-5.5 (5.5.52-0+deb8u1) ... 
Preparing to unpack .../mysql-server-5.5_5.5.52-0+deb8u1_armhf.deb ... 
Aborting downgrade from (at least) 10.0 to 5.5. 
If are sure you want to downgrade to 5.5, remove the file 
/var/lib/mysql/debian-*.flag and try installing again. 
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.52-0+deb8u1_armhf.deb (--unpack): 
subprocess new pre-installation script returned error exit status 1 
Selecting previously unselected package libhtml-template-perl. 
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ... 
Unpacking libhtml-template-perl (2.95-1) ... 
Selecting previously unselected package mysql-server. 
Preparing to unpack .../mysql-server_5.5.52-0+deb8u1_all.deb ... 
Unpacking mysql-server (5.5.52-0+deb8u1) ... 
Processing triggers for man-db (2.7.0.2-5) ... 
Errors were encountered while processing: 
/var/cache/apt/archives/mysql-server-5.5_5.5.52-0+deb8u1_armhf.deb 
E: Sub-process /usr/bin/dpkg returned an error code (1) 

我知道同样的问题被报告在这里: https://raspberrypi.stackexchange.com/questions/28312/raspberry-pi-2-installing-mysql-server

但在这种情况下,解决方案似乎启用了回送接口。在我的情况下,回环接口工作正常,但这并不能解决我的问题。

的ifconfig输出:

lo  Link encap:Local Loopback 
      inet addr:127.0.0.1 Mask:255.0.0.0 
      inet6 addr: ::1/128 Scope:Host 
      UP LOOPBACK RUNNING MTU:65536 Metric:1 
      RX packets:1096 errors:0 dropped:0 overruns:0 frame:0 
      TX packets:1096 errors:0 dropped:0 overruns:0 carrier:0 
      collisions:0 txqueuelen:0 
      RX bytes:91408 (89.2 KiB) TX bytes:91408 (89.2 KiB) 

我尝试下面的命令,反反复复,没有结果:

'sudo apt-get -f install'

'sudo apt-get autoremove'

'sudo apt-get autoclean'

'sudo apt-get update'

'sudo apt-get upgrade'

'sudo dpkg --configure -a'

回答

0

尝试用:

sudo apt-get autoremove --purge <package> 
1

的问题是在安装前脚本。它应该完美安装。你在这里有一些选择:

1)在Debian Bug Tracking System(BTS)上打开一个bug。确保你使用的是最新版本。

2)试着自己修复它。

如果您决定使用2),那么您希望使该脚本冗长,因此,请编辑文件名/var/lib/dpkg/info/mysql-server-5.5_5.5.52-0*.preinst

然后从替换初始行:

#!/bin/sh 

#!/bin/sh -x 

然后,调用# apt-get install -f,看到了新的日志消息