0

I am trying to install cerbot on my Ubuntu 16.04.4 server. I was having some trouble with python, so I removed all python versions from the system. I then downloaded the latest 3.8 release from Python.org, and ran

make
make install 

However, when I try to run

sudo add-apt-repository ppa:certbot/certbot

I am getting an error telling me that the command cannot be found

sudo: add-apt-repository: command not found

So I then saw an answer to this - which is to install the software-properties-common package.

However doing so gives me this error,

nuser@nserver:~$ sudo apt install software-properties-common
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:
 dh-python : Depends: python3:any (>= 3.3.2-2~)
 python3-asn1crypto : Depends: python3:any (>= 3.3.2-2~)
 python3-certifi : Depends: python3:any (>= 3.4~)
 python3-chardet : Depends: python3:any (>= 3.3.2-2~)
                   Depends: python3-pkg-resources but it is not going to be installed
 python3-debian : Depends: python3-six (> 1.4~) but it is not going to be installed
                  Depends: python3:any (>= 3.3.2-2~)
                  Recommends: python3-apt but it is not going to be installed
 python3-idna : Depends: python3:any (>= 3.3.2-2~)
 python3-linecache2 : Depends: python3:any (>= 3.3.2-2~)
 python3-pip : Depends: python-pip-whl (= 8.1.1-2ubuntu0.4) but it is not going to be installed
               Depends: python3:any (>= 3.4~)
               Recommends: python3-dev (>= 3.2) but it is not going to be installed
 python3-pycurl : Depends: python3 (< 3.6) but it is not going to be installed
                  Depends: python3 (>= 3.5~) but it is not going to be installed
 python3-setuptools : Depends: python3-pkg-resources (= 33.1.1-1+certbot~xenial+1) but it is not going to be installed
                      Depends: python3:any (>= 3.3.2-2~)
 python3-testresources : Depends: python3:any (>= 3.3.2-2~)
 python3-traceback2 : Depends: python3:any (>= 3.3.2-2~)
 python3-unittest2 : Depends: python3-pkg-resources but it is not going to be installed
                     Depends: python3-six (>= 1.4) but it is not going to be installed
                     Depends: python3:any (>= 3.3.2-2~)
 python3-update-manager : Depends: python3:any (>= 3.3.2-2~)
                          Depends: python3-apt (>= 0.8.5~) but it is not going to be installed
                          Depends: python3-distupgrade but it is not going to be installed
                          Depends: lsb-release but it is not going to be installed
 python3-wheel : Depends: python3:any (>= 3.3.2-2~)
 software-properties-common : Depends: python3:any (>= 3.3.2-2~)
                              Depends: python3 but it is not going to be installed
                              Depends: python3-gi but it is not going to be installed
                              Depends: gir1.2-glib-2.0 but it is not going to be installed
                              Depends: python-apt-common (>= 0.9) but it is not going to be installed
                              Depends: python3-dbus but it is not going to be installed
                              Depends: python3-software-properties (= 0.96.20.10) but it is not going to be installed
 ufw : Depends: python3:any (>= 3.3.2-2~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Any help would be great.

Patrick
  • 101
  • Many Ubuntu tools are heavily reliant on python, and the specific version they come with (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=python3). Removing and changing the default python (or python3) is not wise, and you should return it back to it's default. You can add a second python version if required. Also note a fully upgraded Ubuntu 16.04 will report 16.04.7, so your system is badly behind (>2 years) on upgraded packages (and thus hopefully not online) – guiverc Sep 01 '20 at 01:13
  • Did you uninstall the python3 package? If so, you might have seriously broken your system as apt itself relies on the python3 package being present. Never do a make install on python, always do make localinstall which leaves the system Python intact. – Brian Turek Sep 01 '20 at 05:28
  • @BrianTurek I did remove the python3 package. Do you think a system reinstall would be required to fix this? – Patrick Sep 01 '20 at 21:12
  • A re-install is often faster, and would bring your very outdated/unmaintained system up to date (I'd suggest 16.04.7 media), but you can install python-minimal package (using dpkg) and fix without re-install... You may need to do more than just this though – guiverc Sep 01 '20 at 22:32
  • Thanks, @guiverc - I will give this a try. – Patrick Sep 01 '20 at 22:33
  • See if apt-get -f install works and reinstalls python3. If it does, you should be safe :) – Brian Turek Sep 02 '20 at 04:30
  • @BrianTurek Just ran that command - Machine is doing more than it was before. I will let you know how I get on with this. Thank you – Patrick Sep 02 '20 at 22:47
  • Thank you @BrianTurek and @ guiverc - I was able to fix this in the end. – Patrick Sep 04 '20 at 13:13

1 Answers1

0

I was able to solve the problem by deploying another instance of Ubuntu 16.04.

I copied the files that I deleted from /usr/bin/py* from the working instance, onto my broken machine.

This got me to a point where I could manually solve my individual errors by updating and removing broken links and packages.

Thank you @BrianTurek and @Guiverc for the help.

Patrick
  • 101