Certbot deleted from Ubuntu, can't reinstall

I’m trying to install Certbot. I had it before, and then it just inexplicably disappeared. Now I can’t reinstall. See below.

My domain is:

privatedomain.com

I ran this command:

sudo apt install certbot

It produced this output:

The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.22.2-1+ubuntu16.04.1+certbot+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

My web server is (include version):

AWS Linux AMI

The operating system my web server runs on is (include version):

Ubuntu 16.04.3 LTS

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know):

yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

Nope, using terminal

Does apt display more information?

sudo apt install certbot
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:
certbot : Depends: python3-certbot (= 0.22.2-1+ubuntu16.04.1+certbot+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

My Webserver is Apache2. I see in retrospect that I answered the question incorrectly.

Possibly related: Certbot and related packages held back on Ubuntu

Hm. I'm not an expert at debugging apt, but are there any held packages?

“apt-mark showhold” returns nothing.

How about:
sudo apt update
sudo apt autoremove
sudo apt autoclean
sudo apt install python3-certbot
sudo apt install certbot

I get this after installs:
apt list --installed | grep -i certbot
certbot/xenial,xenial,now 0.22.2-1+ubuntu16.04.1+certbot+1 all [installed]
python-certbot-apache/xenial,xenial,now 0.22.0-1+ubuntu16.04.1+certbot+2 all [installed]
python-pkg-resources/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed,automatic]
python-setuptools/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed,automatic]
python3-acme/xenial,xenial,now 0.22.2-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-asn1crypto/xenial,xenial,now 0.22.0-2+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-augeas/xenial,xenial,now 0.5.0-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-certbot/xenial,xenial,now 0.22.2-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-certbot-apache/xenial,xenial,now 0.22.0-1+ubuntu16.04.1+certbot+2 all [installed]
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-configargparse/xenial,xenial,now 0.11.0-1+certbot~xenial+1 all [installed,automatic]
python3-configobj/xenial,xenial,now 5.0.6-2+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-cryptography/xenial,now 1.9-1+ubuntu16.04.1+certbot+2 amd64 [installed,automatic]
python3-future/xenial,xenial,now 0.15.2-4+ubuntu16.04.1+certbot+3 all [installed,automatic]
python3-idna/xenial,xenial,now 2.5-1+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-josepy/xenial,xenial,now 1.0.1-1+ubuntu16.04.1+certbot+7 all [installed,automatic]
python3-ndg-httpsclient/xenial,xenial,now 0.4.2-1+certbot~xenial+1 all [installed,automatic]
python3-openssl/xenial,xenial,now 17.3.0-1~0+ubuntu16.04.1+certbot+1 all [installed,automatic]
python3-parsedatetime/xenial,xenial,now 2.4-3+ubuntu16.04.1+certbot+3 all [installed,automatic]
python3-pkg-resources/xenial,xenial,now 33.1.1-1+certbot~xenial+1 all [installed]
python3-pyasn1/xenial,xenial,now 0.1.9-2+certbot~xenial+1 all [installed,automatic]
python3-requests/xenial,xenial,now 2.18.1-1+ubuntu16.04.1+certbot+1 all [installed]
python3-rfc3339/xenial,xenial,now 1.0-4+certbot~xenial+1 all [installed,automatic]
python3-six/xenial,xenial,now 1.11.0-1+ubuntu16.04.1+certbot+1 all [installed]
python3-urllib3/xenial,xenial,now 1.21.1-1+ubuntu16.04.1+certbot+1 all [installed]
python3-zope.component/xenial,xenial,now 4.3.0-1+ubuntu16.04.1+certbot+3 all [installed,automatic]
python3-zope.hookable/xenial,now 4.0.4-4+ubuntu16.04.1+certbot+1 amd64 [installed,automatic]
python3-zope.interface/xenial,now 4.3.2-1+ubuntu16.04.1+certbot+1 amd64 [installed,automatic]

Many thanks to all for taking time with this. Here is what happened. Still banging my head against the wall.

$ sudo apt update

Hit:1 http://repo.mysql.com/apt/ubuntu xenial InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://dl.google.com/linux/chrome/deb stable Release
Hit:5 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Hit:6 http://archive.ubuntu.com/ubuntu xenial InRelease
Reading package lists… Done
Building dependency tree
Reading state information… Done
All packages are up to date.

$ sudo apt autoremove

Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt autoclean

Reading package lists… Done
Building dependency tree
Reading state information… Done

$ sudo apt install python3-certbot

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 : Depends: python3-acme (>= 0.22.0~) but it is not going to be installed
Depends: python3-mock but it is not going to be installed
Depends: python3-rfc3339 but it is not going to be installed
Depends: python3-tz but it is not installable
Recommends: certbot but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ sudo apt install certbot

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:
certbot : Depends: python3-certbot (= 0.22.2-1+ubuntu16.04.1+certbot+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

This one sounds serious...

And this seems to be the only real clue:

try:
dpkg --get-selections | grep hold

and what about:
sudo apt-get install --reinstall certbot

show:
dpkg --get-selections | grep -v install

$ dpkg --get-selections | grep hold
$

It comes back empty.

$ sudo apt-get install --reinstall certbot

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:
certbot : Depends: python3-certbot (= 0.22.2-1+ubuntu16.04.1+certbot+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

This is over my head and I’m just guessing, but what does “dpkg -l python3 python3-tz tzdata” show?

python3-rfc3339 is from Certbot’s PPA, but python3-tz is a simple package from main. It’s hard for me to imagine it not working.

Lets get more detail on why this fails…
try:
sudo apt install python3-tz
sudo apt-get install --reinstall python3-tz

1 Like

$ dpkg -l python3 python3-tz tzdata

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 python3 3.5.1-3 amd64 interactive high-level object-oriented language (default python3 ver
ii tzdata 2017c-0ubuntu0.16.04 all time zone and daylight-saving time data
dpkg-query: no packages found matching python3-tz

Reading package lists… Done
Building dependency tree
Reading state information… Done
Package python3-tz is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘python3-tz’ has no installation candidate

WTF ?!?!?!?!?!?!?!
Something is not good under the hood.

Maybe it’s in the repositories?

So it's required but it doesn't know where to get it?

What repositories are enabled in /etc/apt/sources.list?

If you run sudo apt update, what happens?