Can't install certbot, unmet dependencies

Can't install certbot on Ubuntu 16.04.5 LTS.
I added universe and ppa:certbot/certbot PPA as in documentation:

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository universe
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update

it says:
The following packages have unmet dependencies:

sudo apt install certbot
certbot : Depends: python3-certbot (= 0.31.0-1+ubuntu16.04.1+certbot+1) but it is not going to be installed
mysql-server : Depends: mysql-server-5.7 but it is not going to be installed

1st dependeny is python3-certbot. We have 2 versions of python installed 2.7 and 3. Primary used python is 2.7.
These are installed packages:

apt list --installed | grep python
python/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-all/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-all-dev/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-apt/xenial-updates,now 1.1.0~beta1ubuntu0.16.04.2 amd64 [installed,automatic]
python-apt-common/xenial-updates,xenial-updates,now 1.1.0~beta1ubuntu0.16.04.2 all [installed]
python-dev/xenial-updates,now 2.7.12-1~16.04 amd64 [installed]
python-minimal/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-pip/xenial-updates,xenial-updates,now 8.1.1-2ubuntu0.4 all [installed]
python-pip-whl/xenial-updates,xenial-updates,now 8.1.1-2ubuntu0.4 all [installed,automatic]
python-pkg-resources/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed,automatic]
python-pycurl/xenial,now 7.43.0-1ubuntu1 amd64 [installed,automatic]
python-setuptools/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed,automatic]
python-software-properties/xenial-updates,xenial-updates,now 0.96.20.8 all [installed]
python-wheel/xenial,xenial,now 0.29.0-1 all [installed,automatic]
python2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.4 amd64 [installed,automatic]
python2.7-dev/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.4 amd64 [installed,automatic]
python2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.4 amd64 [installed,automatic]
python3/xenial,now 3.5.1-3 amd64 [installed]
python3-apport/xenial-updates,xenial-updates,xenial-security,xenial-security,now 2.20.1-0ubuntu2.18 all [installed]
python3-apt/xenial-updates,now 1.1.0~beta1ubuntu0.16.04.2 amd64 [installed]
python3-asn1crypto/xenial,xenial,now 0.22.0-2+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-certifi/xenial,xenial,now 2017.4.17-2+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-cffi-backend/xenial,now 1.10.0-0.1+ubuntu16.04.1+certbot+1 amd64 [installed,automatic]
python3-chardet/xenial,xenial,now 3.0.4-1+ubuntu16.04.1+certbot+2 all [installed]
python3-commandnotfound/xenial-updates,xenial-updates,now 0.3ubuntu16.04.2 all [installed]
python3-cryptography/xenial,now 1.9-1+ubuntu16.04.1+certbot+2 amd64 [installed,automatic]
python3-dbus/xenial,now 1.2.0-3 amd64 [installed]
python3-debian/xenial,xenial,now 0.1.27ubuntu2 all [installed]
python3-dev/xenial,now 3.5.1-3 amd64 [installed]
python3-distupgrade/xenial-updates,xenial-updates,now 1:16.04.26 all [installed]
python3-gdbm/xenial,now 3.5.1-1 amd64 [installed]
python3-gi/xenial,now 3.20.0-0ubuntu1 amd64 [installed]
python3-idna/xenial,xenial,now 2.5-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-minimal/xenial,now 3.5.1-3 amd64 [installed]
python3-newt/xenial,now 0.52.18-1ubuntu2 amd64 [installed]
python3-openssl/xenial,xenial,now 17.3.0-1~0+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-pip/xenial-updates,xenial-updates,now 8.1.1-2ubuntu0.4 all [installed]
python3-pkg-resources/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed]
python3-problem-report/xenial-updates,xenial-updates,xenial-security,xenial-security,now 2.20.1-0ubuntu2.18 all [installed]
python3-pycurl/xenial,now 7.43.0-1ubuntu1 amd64 [installed]
python3-requests/xenial,xenial,now 2.18.1-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-setuptools/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed]
python3-six/xenial,xenial,now 1.11.0-1+ubuntu16.04.1+certbot+1 all [installed]
python3-software-properties/xenial-updates,xenial-updates,now 0.96.20.8 all [installed]
python3-systemd/xenial,now 231-2build1 amd64 [installed]
python3-update-manager/xenial-updates,xenial-updates,now 1:16.04.15 all [installed]
python3-urllib3/xenial,xenial,now 1.21.1-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-wheel/xenial,xenial,now 0.29.0-1 all [installed,automatic]
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.5 amd64 [installed]
python3.5-dev/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.5 amd64 [installed,automatic]
python3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.5 amd64 [installed]

2nd dependency is mysql-server-5.7, but we have already installed mariaDB which uses mysql-server-core-5.7 package. This is mysql package list:

apt list --installed | grep mysql
libdbd-mysql-perl/xenial-updates,xenial-security,now 4.033-1ubuntu0.1 amd64 [installed,auto-removable]
libmysqlclient-dev/xenial-updates,xenial-security,now 5.7.25-0ubuntu0.16.04.2 amd64 [installed]
libmysqlclient20/xenial-updates,xenial-security,now 5.7.25-0ubuntu0.16.04.2 amd64 [installed,automatic]
mysql-client-5.7/xenial-updates,xenial-security,now 5.7.25-0ubuntu0.16.04.2 amd64 [installed,automatic]
mysql-client-core-5.7/xenial-updates,xenial-security,now 5.7.25-0ubuntu0.16.04.2 amd64 [installed,automatic]
mysql-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 5.7.25-0ubuntu0.16.04.2 all [installed,automatic]
mysql-server/xenial-updates,xenial-updates,xenial-security,xenial-security,now 5.7.25-0ubuntu0.16.04.2 all [installed]
mysql-server-core-5.7/xenial-updates,xenial-security,now 5.7.25-0ubuntu0.16.04.2 amd64 [installed,auto-removable]

I can't reinstall mysql or python as it's working server. We just want to migrate from paid certificates to letsencrypt.

Are you 100% sure that the universe repo was properly enabled? If you run that part again, what is the output?

Certbot does not depend in any way on MySQL, so that’s a bit weird. What does this show?

apt-get install -f

My sources.list file:

cat /etc/apt/sources.list | egrep -v "(^#.*|^$)"
deb Index of /ubuntu xenial main restricted
deb Index of /ubuntu xenial-updates main restricted
deb Index of /ubuntu xenial universe
deb Index of /ubuntu xenial-updates universe
deb Index of /ubuntu xenial multiverse
deb Index of /ubuntu xenial-updates multiverse
deb Index of /ubuntu xenial-backports main restricted universe multiverse
deb Index of /ubuntu xenial-security main restricted
deb Index of /ubuntu xenial-security universe
deb Index of /ubuntu xenial-security multiverse

After apt-get install -f, it asks to install mysql-server-5.7, and when I press "Y"
it gives an error:

sudo apt-get install -f
The following additional packages will be installed:
  mysql-server-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 87 not upgraded.
7 not fully installed or removed.
Need to get 0 B/2,623 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 113256 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.25-0ubuntu0.16.04.2_amd64.deb ...
Aborting downgrade from (at least) 10.0 to 5.7.
If are sure you want to downgrade to 5.7, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.25-0ubuntu0.16.04.2_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.25-0ubuntu0.16.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

There is nothing about 2nd dependency: python3-certbot

Alright, so from that we know that the MySQL issue is just unrelated broken packaging on your server. It can be ignored for the context of Certbot.

One trick that can work to track down which dependency is preventing a package from being installed is trying to install each dependent package that it complains about, directly. e.g.

apt install python3-certbot

and then if it complains about another dependency, try that one.

A different approach could be to forget about the PPA entirely, if you have insurmountable package problems on your server, and try use the portable certbot-auto instead.

Thank you,
I found that my dpkg is broken on my server, I can’t install any package.

Please close the threat.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.