Certbot: Cannot install python-certbot-nginx on Ubuntu 18.04 because of ‘unmet dependencies’

Created on 9 Sep 2018  ·  18Comments  ·  Source: certbot/certbot

On a completely fresh, up-to-date Ubuntu 18.04.1 LTS (Server) installation, Certbot cannot be installed from the Certbot PPA. The installation fails with ‘unmet dependencies’.

I am following the instructions at https://certbot.eff.org/lets-encrypt/ubuntuartful-nginx.

Command-line conversation after having done sudo add-apt-repository ppa:certbot/certbot and updated the APT package cache follows.

ubuntu@pingu:~$ sudo apt-get install python-certbot-nginx
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:
 python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
ubuntu@pingu:~$ sudo apt-get install python3-certbot-nginx
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:
 python3-certbot-nginx : Depends: certbot (>= 0.25.0~) but it is not going to be installed
                         Depends: python3-acme but it is not going to be installed
                         Depends: python3-certbot (>= 0.25.0~) but it is not going to be installed
                         Depends: python3-mock but it is not installable
E: Unable to correct problems, you have held broken packages.

I expect this package install to work, or if I am missing some prerequisites perhaps the Certbot instructions should mention them. Thank you!

debian / ubuntu documentation pkging bug

Most helpful comment

run sudo add-apt-repository universe the sudo apt-get update and you can install certbot like the instructions

All 18 comments

Thanks for letting us know about this problem, @glts. @bmw, do you have any suggestions?

@schoen I now believe this is due to the universe repos (bionic, bionic-updates, bionic-security) not being enabled by default. I can proceed after I add the universe repos.

In that case this is not a bug, but certainly a hint in the instructions would be very welcome.

I have the same problem, How solve it ?

run sudo add-apt-repository universe the sudo apt-get update and you can install certbot like the instructions

The same behaviour is present in debian stretch, I get the following error :

apt install python3-certbot-nginx
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:
 python3-certbot-nginx : Depends: certbot (>= 0.25.0~) but 0.10.2-1 is to be installed
                         Depends: python3-acme (>= 0.26.0~) but 0.10.2-1 is to be installed
                         Depends: python3-certbot but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Should I open a new issue for this ?

For Debian Gnu/Linux, the recommendation is to use the backports, you can do this with a sudo account :

echo "deb http://ftp.debian.org/debian stretch-backports main">>/etc/apt/sources.list
apt-get update && apt-get install certbot python3-certbot-nginx -t stretch-backports 
ertbot --nginx -d domain.com

@h3ct0rjs, you need to include -t stretch-backports so your installation command would be sudo apt-get install python-certbot-nginx -t stretch-backports. See https://certbot.eff.org/lets-encrypt/debianstretch-nginx for more info.

For Ubuntu users, this issue should be resolved with https://github.com/certbot/website/pull/382.

i'm having a similar issue after recently doing apt-get dist-upgrade on Debian testing. it removed certbot and it cannot be re-installed.

root@localhost:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  python3-acme python3-configargparse python3-configobj python3-future python3-icu python3-josepy python3-mock python3-parsedatetime python3-pbr python3-requests-toolbelt python3-rf
  python3.6 python3.6-minimal
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  certbot python3-certbot python3-zope.component python3-zope.hookable python3-zope.interface
The following NEW packages will be installed:
  libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-minimal
The following packages will be upgraded:
  binutils binutils-common binutils-x86-64-linux-gnu cargo cpp-8 g++-8 gcc-8 gcc-8-base gir1.2-glib-2.0 git git-man init init-system-helpers iptables iptables-persistent libasan5 li
  libcryptsetup12 libfreetype6 libgcc-8-dev libgcc1 libgdbm-compat4 libgdbm6 libgirepository-1.0-1 libgomp1 libip4tc0 libip6tc0 libiptc0 libitm1 libllvm7 liblsan0 libmpx2 libnghttp2
  libpython3-stdlib libquadmath0 libsqlite3-0 libssl1.0.2 libssl1.1 libstdc++-8-dev libstdc++6 libsystemd0 libtiff5 libtsan0 libubsan1 libudev1 libxtables12 linux-libc-dev netfilter
  python3-reportbug reportbug stress-ng sudo systemd systemd-sysv sysvinit-utils udev unattended-upgrades vim vim-tiny xxd
68 upgraded, 4 newly installed, 5 to remove and 0 not upgraded.
Need to get 0 B/78.4 MB of archives.
After this operation, 22.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

debian has no 'universe', trying to add it results in:

root@localhost:~# add-apt-repository universe
Error: 'universe' invalid
root@localhost:~# apt-get install python-certbot-nginx
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:
 python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@localhost:~# apt-cache policy certbot
certbot:
  Installed: (none)
  Candidate: 0.28.0-1
  Version table:
     0.28.0-1 500
        500 http://mirrors.linode.com/debian unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     0.25.0-1+ubuntu17.10.1+certbot+1 500
        500 http://ppa.launchpad.net/certbot/certbot/ubuntu artful/main amd64 Packages
root@localhost:~# apt-cache policy python-certbot-nginx
python-certbot-nginx:
  Installed: (none)
  Candidate: 0.28.0-1
  Version table:
     0.28.0-1 500
        500 http://mirrors.linode.com/debian unstable/main amd64 Packages
     0.25.0-2+ubuntu17.10.1+certbot+1 500
        500 http://ppa.launchpad.net/certbot/certbot/ubuntu artful/main amd64 Packages
root@localhost:~# apt-cache policy python3-certbot-nginx
python3-certbot-nginx:
  Installed: (none)
  Candidate: 0.28.0-1
  Version table:
     0.28.0-1 500
        500 http://mirrors.linode.com/debian unstable/main amd64 Packages
     0.25.0-2+ubuntu17.10.1+certbot+1 500
        500 http://ppa.launchpad.net/certbot/certbot/ubuntu artful/main amd64 Packages

any advice would be appreciated, thanks!

@leeoniya check the previous comment by @bmw, you will need to install the certbot backport under Debian Gnu/Linux

@h3ct0rjs, you need to include -t stretch-backports so your installation command would be sudo apt-get install python-certbot-nginx -t stretch-backports. See https://certbot.eff.org/lets-encrypt/debianstretch-nginx for more info.

For Ubuntu users, this issue should be resolved with certbot/website#382.

Jessie users should not forget to change few lines :)

For jessie add this line to source list
deb http://ftp.debian.org/debian jessie-backports main
For stretch add this line
deb http://ftp.debian.org/debian stretch-backports main

Then install depends on your Debian version:
sudo apt-get install python-certbot-nginx -t jessie-backports
or
sudo apt-get install python-certbot-nginx -t stretch-backports

it would seem obvious but just in case ;)

Hi, same problem here with a fresh install of ubuntu 18.04 ... would like to know if someone found a solution for this ?
I tried doc of the offical website
$ 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
$ sudo apt-get install python-certbot-nginx

but I receive error :
The following packages have unmet dependencies:
python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Hi again,
I found the problem with my config but I need your help
I had installed nginx from source and compiled in my side because I need some custom modules (like pagespeed and brotlib) so I can't use apt package to install the nginx server.
And because I block Nginx update in apt to avoid that it overwrite this custom version (thru /etc/apt/preference.d/ => package: nginx*), when I try to install your "python-certbot_nginx", it try to install the nginx package and it fails) ... I make a test and if I allow install of nginx package the error disappear ... but I don't want to validate this install because I think that it will erase my custom version of nginx and I will loose the sutom modules compiled by myself.
Can someone help me to find a solution to solve this problem ?
Thanks a lot for your help in advance !

@angelflo, I strongly recommend you post to https://community.letsencrypt.org where there is a large group of people familiar with the project who would be happy to try and help you.

sudo apt-get update
sudo apt-get install --only-upgrade python
sudo apt-get install python-pip
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
pip install pyopenssl
certbot certonly

I do not recommend installing packages with pip outside of a virtual environment. Doing so causes the packages to be mixed with and override the packages provided by your OS package manager and can result in a broken Python environment.

I do not recommend installing packages with pip outside of a virtual environment. Doing so causes the packages to be mixed with and override the packages provided by your OS package manager and can result in a broken Python environment.

I agree, but if there is no other option, then this can be used if there is a serious need for it. I used this option on my server and everything works successfully.

For anyone else running into this problem and adding universe fails because it’s already added and up to date. I was able to resolve by removing universe (was at the end of my file) and then manually uncommenting the two repos above it in /etc/apt/sources.list — which also include universe.

Change:

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
# deb http://archive.ubuntu.com/ubuntu/ bionic main universe multiverse
# deb http://archive.ubuntu.com/ubuntu/ bionic-security main universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic universe

To:

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
deb http://archive.ubuntu.com/ubuntu/ bionic main universe multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-security main universe multiverse

Then run sudo apt-get update and the install should work.

In my case, the problem was that AWS's Ubuntu mirror apparently doesn't include python3-mock etc. (WTF?)

In /etc/apt/sources.list:

# Fails:
deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ bionic main universe multiverse

# Succeeds:
deb http://archive.ubuntu.com/ubuntu/ bionic main universe multiverse

Guys I have a leading edge solution for this.
TL;DR this works baby! https://certbot.eff.org/lets-encrypt/ubuntuother-nginx

I installed NGINX from source custom build and it is bleeding edge. I tried all the solutions mentioned
1 - Update your repos to include universe
2 - Try the backport flags option
3 - Install Python

None of these work on a brand new install with @angristan nginx autointall source build

After I tried everything I could find this worked https://certbot.eff.org/lets-encrypt/ubuntuother-nginx

Was this page helpful?
0 / 5 - 0 ratings