Okay, when I run the first command (sudo echo $PATH) i get this:
/root/.nvm/versions/node/v11.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
when i run the second command (sudo echo $PATH sudo find / -type f -name certbot 2>/dev/null) I get these 2 paths:
/etc/logrotate.d/certbot
/etc/cron.d/certbot
grep certbot
rc certbot 0.28.0-1+ubuntu16.04.1+certbot+4 all automatically configure HTTPS using Let's Encrypt
ii python-asn1crypto 0.22.0-2+ubuntu16.04.1+certbot+1 all Fast ASN.1 parser and serializer (Python 2)
ii python-certifi 2017.4.17-2+ubuntu16.04.1+certbot+1 all root certificates for validating SSL certs and verifying TLS hosts
ii python-cffi-backend 1.10.0-0.1+ubuntu16.04.1+certbot+1 amd64 ForeignFunction Interface for Python calling C code - backend
ii python-chardet 3.0.4-1+ubuntu16.04.1+certbot+2 all universal character encoding detector for Python2
ii python-cryptography 1.9-1+ubuntu16.04.1+certbot+2 amd64 Python library exposing cryptographic recipes and primitives (Python 2)
ii python-dnspython 1.15.0-1+certbot~xenial+1 all DNS toolkit for Python
ii python-idna 2.5-1+ubuntu16.04.1+certbot+1 all Python IDNA2008 (RFC 5891) handling (Python 2)
ii python-ipaddress 1.0.17-1+certbot~xenial+1 all Backport of Python 3 ipaddress module (Python 2)
ii python-openssl 17.3.0-1~0+ubuntu16.04.1+certbot+1 all Python 2 wrapper around the OpenSSL library
ii python-pkg-resources 33.1.1-1+certbot~xenial+1 all PackageDiscovery and Resource Access using pkg_resources
ii python-requests 2.18.1-1+ubuntu16.04.1+certbot+1 all elegantand simple HTTP library for Python2, built for human beings
ii python-six 1.11.0-1+ubuntu16.04.1+certbot+1 all Python 2 and 3 compatibility library (Python 2 interface)
ii python-urllib3 1.21.1-1+ubuntu16.04.1+certbot+1 all HTTP library with thread-safe connection pooling for Python
ii python3-asn1crypto 0.22.0-2+ubuntu16.04.1+certbot+1 all Fast ASN.1 parser and serializer (Python 3)
ii python3-cffi-backend 1.10.0-0.1+ubuntu16.04.1+certbot+1 amd64 ForeignFunction 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-cryptography 1.9-1+ubuntu16.04.1+certbot+2 amd64 Python library exposing cryptographic recipes and primitives (Python 3)
ii python3-idna 2.5-1+ubuntu16.04.1+certbot+1 all Python IDNA2008 (RFC 5891) handling (Python 3)
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-pkg-resources 33.1.1-1+certbot~xenial+1 all PackageDiscovery 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)
ii python3-six 1.11.0-1+ubuntu16.04.1+certbot+1 all Python 2 and 3 compatibility library (Python 3 interface)
@mnordhoff no i certainly didn’t run that… I was trying to create a mail server and maybe there was something in there that did that… is it safe and simple enough to reinstall certbot?
No, you will not lose your existing certificates from (re-)installing certbot.
It’s hard to see why installation of a mail server would cause the removal of certbot. Could you tell us which? And if you followed some guide please also give us a link to that.
To (re-)install certbot, try: sudo apt install certbot=0.28.0-1+ubuntu16.04.1+certbot+4 (that should give the precise version that was removed, any errors from that might also give us a clue to what happened with it, so if it fails, please give us the complete output.
Thanks so much for the help, I'll try to find the tutorial I was following.
For now I tried to run the script you sent but got this error:
sudo apt install certbot=0.28.0-1+ubuntu16.04.1+certbot+4
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.28.0-1+ubuntu16.04.1+certbot+4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
That was not a script as much as a single command.
In some sense that error is not surprising, in that the certbot package does depend on the python3-certbot package. What is surprising (to me at least) is that that package was not in the output you showed earlier, so either you never had it (but then certbot never worked?), or it has been removed very thoroughly (and I don’t see why that would happen unintentionally).
But try sudo apt install certbot=0.28.0-1+ubuntu16.04.1+certbot+4 python3-certbot=0.28.0-1+ubuntu16.04.1+certbot+4. (The same command as before, just also specify that we want the package apt complained about in the version apt said was required.)
So strange… no idea how I could have possibly gotten rid of certbot. I got an email from let’s encrypt saying my certificate is going to expire, hence checking in on this…
So just tried the script you sent, still getting an error
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Version ‘0.28.0-1+ubuntu16.04.1+certbot+4’ for ‘python3-certbot’ was not found
I’d also like to point out that the packages you’re trying to install are out of date. The version in the PPA is 0.31.0 (and the version in xenial-updates is 0.23.0). I would try reinstalling the client using the installation commands found at https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx.
Pure speculation: What if there was some conflict between a package in the Certbot PPA and some other package (perhaps from a different third-party repository) and apt helpfully suggested resolving it by uninstalling stuff?
Does /var/log/dpkg.log suggest what might have happened?
No. Without fully understanding the situation, a lot of things might go wrong, but /etc/letsencrypt/ won't get deleted.
So the log file was empty but I went ahead a reinstalled certbot following the instructions you provided. This worked and I was able to renew my certificate. Hopefully this never happens again but if so I know what to do.