Erro ao instalar o mysql-server no Debian 9 Stretch (problemas de dependência)

1

Usando o Debian 9.5, nova instalação. Eu quero instalar o mysql-server, mas me deparo com problemas de dependência.

sudo apt-get install mysql-server
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:
 mysql-server : Depends: default-mysql-server but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

apt-get install mysql-server default-mysql-server
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:
 default-mysql-server : Depends: mariadb-server-10.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1
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:
 mariadb-server-10.1 : Depends: libdbi-perl but it is not going to be installed
                       Recommends: libhtml-template-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1 libhtml-template-perl
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:
 libhtml-template-perl : Depends: libcgi-pm-perl but it is not going to be installed or
                                  perl (< 5.19) but 5.26.2-7 is to be installed
 mariadb-server-10.1 : Depends: libdbi-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1 libdbi-perl
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:
 libdbi-perl : Depends: perlapi-5.24.1
E: Unable to correct problems, you have held broken packages.

EDIT1: apt-cache policy :

apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://security.debian.org/debian-security stretch/updates/contrib amd64 Packages
     release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=contrib,b=amd64
     origin security.debian.org
 500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
     release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=main,b=amd64
     origin security.debian.org
 500 http://deb.debian.org/debian stretch-updates/main amd64 Packages
     release o=Debian,a=stable-updates,n=stretch-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian stretch/main amd64 Packages
     release v=9.5,o=Debian,a=stable,n=stretch,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:

EDIT2: apt policy perl perl-base :

apt policy perl perl-base
perl:
  Installed: 5.26.2-7
  Candidate: 5.26.2-7
  Version table:
 *** 5.26.2-7 100
        100 /var/lib/dpkg/status
     5.24.1-3+deb9u4 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
perl-base:
  Installed: 5.26.2-7
  Candidate: 5.26.2-7
  Version table:
 *** 5.26.2-7 100
        100 /var/lib/dpkg/status
     5.24.1-3+deb9u4 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages

Como posso corrigir esses problemas de dependência?

    
por klor 23.09.2018 / 19:33

2 respostas

5

Como indicado pelo seu apt policy perl perl-base output, e apontado por jordanm , seu sistema tem a versão Buster do Perl, não a versão do Debian 9. Então o seu sistema não é realmente uma "nova instalação" do Debian 9.5; e como o Perl é um componente tão importante de uma configuração Debian, é provável que existam muitos outros pacotes que foram atualizados para a versão do Buster.

Essa incompatibilidade de Perl é a razão pela qual você não pode instalar os pacotes do MySQL.

Suponho que esta é uma instalação recente e, portanto, você não investiu demais nela; a recomendação do jordanm para re-instalar é provavelmente a melhor solução neste caso. O Debian 9 e o Buster divergiram um pouco, então a reversão pode se tornar bastante complicada, especialmente desde que você atualizou o Perl. Remover mc certamente não será suficiente.

No futuro, não misture estável e teste. Se você encontrar um bug que o impeça de usar um pacote, envie um bug ( reportbug mc ); se for grave o suficiente, pode se qualificar para uma atualização estável. Você também pode pedir um backport; que te daria a versão atual do Buster de mc , reconstruída para o Debian 9.

    
por 23.09.2018 / 21:30
1

Eu executei os seguintes comandos com sucesso com base na solução aceita:

wget http://ftp.debian.org/debian/pool/main/p/perl/perl-base_5.24.1-3+deb9u4_amd64.deb
sudo dpkg -i perl-base*deb
    dpkg: warning: downgrading perl-base from 5.26.2-7 to 5.24.1-3+deb9u4
    (Reading database ... 38749 files and directories currently installed.)
    Preparing to unpack perl-base_5.24.1-3+deb9u4_amd64.deb ...
    Unpacking perl-base (5.24.1-3+deb9u4) over (5.26.2-7) ...
    Setting up perl-base (5.24.1-3+deb9u4) ...
    Processing triggers for man-db (2.7.6.1-2) ...
sudo apt-get install mysql-server
sudo apt --fix-broken install
sudo apt autoremove
sudo apt-get install mysql-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    mysql-server is already the newest version (5.5.9999+default).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Resultado:

dpkg -l perl-base
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ii  perl-base                                             5.24.1-3+deb9u4                 amd64                           minimal Perl system


dpkg -l mysql-server
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ii  mysql-server                                          5.5.9999+default                amd64                           MySQL database server binaries and system database setup [transitional]
    
por 23.09.2018 / 22:13