Website Crash after update AWS Lightsail Bitnami Unmet dependencies between 0.28.0 and 0.31.0

Hi there,

I was trying to renew my certificate and I ran a few commands below:

https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-using-lets-encrypt-certificates-with-wordpress

Now my website is down, looks like that I could renew the certificate but something went wrong during the updates.

My domain is: tabledirect . com . au

I ran this command: sudo apt install certbot

It produced this output:

Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
python3-certbot-nginx python-certbot-doc
The following packages will be upgraded:
certbot
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.0 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
(Reading database … 139904 files and directories currently installed.)
Preparing to unpack …/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+certb
ot+1_all.deb (–unpack):
subprocess new pre-removal script returned error exit status 5
certbot.service is a disabled or a static unit, not starting it.
Job for certbot.timer failed. See “systemctl status certbot.timer” and “journalctl -xe” for
details.
certbot.timer couldn’t start.
Errors were encountered while processing:
/var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

My web server is (include version): Amazon Lightsail

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

I can login to a root shell on my machine.

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

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
When I run certbot --version:

raceback (most recent call last):
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 655, in _build_mast
er
ws.require(requires)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 963, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 854, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (certbot 0.31.0 (/usr/lib/python3/dist-packages), Requiremen
t.parse(‘certbot==0.28.0’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/bin/certbot”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3019, in
@_call_aside
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3003, in _call_asid
e
f(*args, **kwargs)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3032, in _initializ
e_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 657, in _build_mast
er
return cls._build_from_requirements(requires)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 670, in _build_from
_requirements
dists = ws.resolve(reqs, Environment())
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘certbot==0.28.0’ distribution was not found and is
required by the application

Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt-get -f install’ to correct these.
The following packages have unmet dependencies:
** certbot : Depends: python3-certbot (= 0.28.0-1+ubuntu16.04.1+certbot+4) but 0.31.0-1+ubunt**
u16.04.1+certbot+1 is installed
E: Unmet dependencies.

Thanks for your help!

bitnami@ip-172-26-12-60:~$ dpkg -l | grep certbot

ii certbot 0.28.0-1+ubuntu16.04.1+certbot+4 all
automatically configure HTTPS using Let’s Encrypt
ii python-certbot-apache 0.31.0-1+ubuntu16.04.1+certbot+1 all
transitional dummy package
ii python-pkg-resources 33.1.1-1+certbot~xenial+1 all
Package Discovery and Resource Access using pkg_resources
ii python3-acme 0.31.0-1+ubuntu16.04.1+certbot+1 all
ACME protocol library for Python 3
ii python3-asn1crypto 0.22.0-2+ubuntu16.04.1+certbot+1 all
Fast ASN.1 parser and serializer (Python 3)
ii python3-augeas 0.5.0-1+ubuntu16.04.1+certbot+1 all
Python3 bindings for Augeas
ii python3-certbot 0.31.0-1+ubuntu16.04.1+certbot+1 all
main library for certbot
ii python3-certbot-apache 0.31.0-1+ubuntu16.04.1+certbot+1 all
Apache plugin for Certbot
ii python3-certifi 2017.4.17-2+ubuntu16.04.1+certbot+1 all
root certificates for validating SSL certs and verifying TLS hosts (python3)
ii python3-cffi-backend 1.10.0-0.1+ubuntu16.04.1+certbot+1 amd64
Foreign Function Interface for Python 3 calling C code - runtime
ii python3-chardet 3.0.4-1+ubuntu16.04.1+certbot+2 all
universal character encoding detector for Python3
ii python3-configargparse 0.11.0-1+certbot~xenial+1 all
replacement for argparse with config files and environment variables (Python 3)
ii python3-configobj 5.0.6-2+ubuntu16.04.1+certbot+1 all
simple but powerful config file reader and writer for Python 3
ii python3-cryptography 1.9-1+ubuntu16.04.1+certbot+2 amd64
Python library exposing cryptographic recipes and primitives (Python 3)
ii python3-future 0.15.2-4+ubuntu16.04.1+certbot+3 all
Clean single-source support for Python 3 and 2 - Python 3.x
ii python3-idna 2.5-1+ubuntu16.04.1+certbot+1 all
Python IDNA2008 (RFC 5891) handling (Python 3)
ii python3-josepy 1.1.0-2+ubuntu16.04.1+certbot+1 all
JOSE implementation for Python 3.x
ii python3-ndg-httpsclient 0.4.2-1+certbot~xenial+1 all
enhanced HTTPS support for httplib and urllib2 using PyOpenSSL for Python3
ii python3-openssl 17.3.0-1~0+ubuntu16.04.1+certbot+1 all
Python 3 wrapper around the OpenSSL library
ii python3-parsedatetime 2.4-3+ubuntu16.04.1+certbot+3 all
Python 3 module to parse human-readable date/time expressions
ii python3-pkg-resources 33.1.1-1+certbot~xenial+1 all
Package Discovery and Resource Access using pkg_resources
ii python3-pyasn1 0.1.9-2+certbot~xenial+1 all
ASN.1 library for Python (Python 3 module)

Hi @sllyders,

Welcome to the community forum!

The following commands should help cleanup the previous failed installation.

sudo apt-get purge certbot
sudo apt-get autoremove

Ensure you have the latest packages available for your system

sudo apt-get update
sudo apt-get upgrade

Let us know if the following the installation steps from https://certbot.eff.org/lets-encrypt/ubuntuxenial-other actually get certbot installed.

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 certbot

Following these commands on a fresh docker container running ubuntu:xenial allowed me to successfully run certbot 0.31.0.

root@216cf9c02886:/# certbot --version
certbot 0.31.0
root@216cf9c02886:/# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
1 Like

When I run: sudo apt-get purge certbot

I have:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 python3-acme python3-augeas
python3-certbot python3-configargparse python3-funcsigs python3-future python3-icu
python3-josepy python3-mock python3-ndg-httpsclient python3-parsedatetime python3-pbr
python3-requests-toolbelt python3-rfc3339 python3-tz python3-zope.component
python3-zope.event python3-zope.hookable python3-zope.interface ssl-cert
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
certbot*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 38.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 143901 files and directories currently installed.)
Removing certbot (0.28.0-1+ubuntu16.04.1+certbot+4) …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: error processing package certbot (–purge):
subprocess installed pre-removal script returned error exit status 5
certbot.service is a disabled or a static unit, not starting it.
certbot.timer is a disabled or a static unit, not starting it.
Errors were encountered while processing:
certbot
E: Sub-process /usr/bin/dpkg returned an error code (1)

~$ sudo apt-get autoremove
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt-get -f install’ to correct these.
The following packages have unmet dependencies:
certbot : Depends: python3-certbot (= 0.28.0-1+ubuntu16.04.1+certbot+4) but 0.31.0-1+ubun
tu16.04.1+certbot+1 is installed
E: Unmet dependencies. Try using -f.

I did update and upgrade too.

I followed the steps and I have these problems:

sudo apt-get install software-properties-common

bitnami@ip-172-26-12-60:~ sudo apt-get install software-properties-common Reading package lists... Done Building dependency tree Reading state information... Done software-properties-common is already the newest version (0.96.20.8). You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: certbot : Depends: python3-certbot (= 0.28.0-1+ubuntu16.04.1+certbot+4) but 0.31.0-1+ubun tu16.04.1+certbot+1 is to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). bitnami@ip-172-26-12-60:~ Reading package lists… Done
Reading: command not found
bitnami@ip-172-26-12-60:~ Building dependency tree Building: command not found bitnami@ip-172-26-12-60:~ Reading state information… Done
Reading: command not found
bitnami@ip-172-26-12-60:~ software-properties-common is already the newest version (0.96. 20.8). -bash: syntax error near unexpected token `(' bitnami@ip-172-26-12-60:~ You might want to run ‘apt-get -f install’ to correct these:
You: command not found
bitnami@ip-172-26-12-60:~ The following packages have unmet dependencies: No command 'The' found, did you mean: Command 'the' from package 'the' (universe) The: command not found bitnami@ip-172-26-12-60:~ certbot : Depends: python3-certbot (= 0.28.0-1+ubuntu16.04.1+c
ertbot+4) but 0.31.0-1+ubun
-bash: syntax error near unexpected token `(’
bitnami@ip-172-26-12-60:~ tu16.04.1+certbot+1 is to be installed tu16.04.1+certbot+1: command not found bitnami@ip-172-26-12-60:~ E: Unmet dependencies. Try ‘apt-get -f install’ with no package

bitnami@ip-172-26-12-60:~$ sudo apt-get install certbot
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 python3-augeas ssl-cert
Use ‘sudo apt autoremove’ to remove them.
Suggested packages:
python3-certbot-apache python3-certbot-nginx python-certbot-doc
The following packages will be upgraded:
certbot
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/11.0 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Selecting previously unselected package certbot.
(Reading database … 143901 files and directories currently installed.)
Preparing to unpack …/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+cert
bot+1_all.deb (–unpack):
subprocess new pre-removal script returned error exit status 5
certbot.service is a disabled or a static unit, not starting it.
certbot.timer is a disabled or a static unit, not starting it.
Errors were encountered while processing:
/var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

@sllyders

Let’s try to clean up the system state by rebuilding the dpkg database.

sudo dpkg --configure -a
sudo apt-get install -f

Thanks Phil but did not work:

bitnami@ip-172-26-12-60:~$ sudo dpkg --configure -a
Setting up python3-certbot (0.31.0-1+ubuntu16.04.1+certbot+1) …

bitnami@ip-172-26-12-60:~$ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 python3-augeas ssl-cert
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
certbot
Suggested packages:
python3-certbot-apache python3-certbot-nginx python-certbot-doc
The following packages will be upgraded:
certbot
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.0 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database … 143901 files and directories currently installed.)
Preparing to unpack …/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead …
Failed to stop certbot.service: Unit certbot.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+cert
bot+1_all.deb (–unpack):
subprocess new pre-removal script returned error exit status 5
certbot.service is a disabled or a static unit, not starting it.
certbot.timer is a disabled or a static unit, not starting it.
Errors were encountered while processing:
/var/cache/apt/archives/certbot_0.31.0-1+ubuntu16.04.1+certbot+1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don’t know if helps:

bitnami@ip-172-26-12-60:~$ systemctl status certbot.service
● certbot.service - Certbot
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Docs: https://letsencrypt.readthedocs.io/en/latest/

May 20 16:49:53 ip-172-26-12-60 systemd[1]: [/etc/systemd/system/certbot.service:7] Execut
May 20 16:49:53 ip-172-26-12-60 systemd[1]: certbot.service: Service lacks both ExecStart=

1 Like

@sllyders

Since the package is in a funky state, let’s remove that. The working certbot package should reinstall that file.

# Find any old crufty unit files or timers
systemctl list-units  | grep certbot
systemctl list-timers | grep certbot

# Remove the old unit file/timer if they exist
stat /lib/systemd/system/certbot.service
stat /lib/systemd/system/certbot.timer
ls -al /etc/systemd/system/ | grep certbot

# You can issue the rm commands to remove those files

# Reload systemd
sudo systemd daemon-reload
2 Likes

Hi Phil, did work!

After that I could install the final version of the certbot.

Unfortunately, I messed with the .conf files, so I end up reinstalling the server.

Thanks so much for your help.

2 Likes

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