Within the error message provided in the question, I noticed the problematic Certbot's executable is /usr/local/bin/certbot
.
Usually the executable files located in /usr/local/bin
are a kind of custom installations and they take precedence over these installed by the package managers, because of the default structure of the $PATH
variable - to check it run:
echo $PATH
On the other hand, packages installed with apt
could be found in the other directories like /usr/bin
or /usr/sbin
, or /bin
, or /snap/bin
for the snap
packages, etc.
So different versions of a command (with the same name) could exist in different directories which belong to your $PATH
. To find which one takes precedence over the others you can use the command:
which certbot
To find the locations of all executable files named certbot
within the directories in the $PATH
use the command:
which -a certbot
In a case the above command outputs more than one line - for example:
/usr/local/bin/certbot
/usr/bin/certbot
/bin/certbot
You can try to renew your certificates by the second (or the third) command by calling it with its full path - i.e. /usr/bin/certbot
.
If this works,you can safely remove the obsolete executable /usr/local/bin/certbot
which probably was installed a long time ago while you've followed some guide which you can't remember right now :)