# Certbot: Command not found



## nepsydude (Jun 9, 2019)

Guys, 
i am setting up home server and want to connect it securely through internet. I am in the process of installing certificates and i tried Certbot by Letsencypt, i followed the instruction as on the website.
Webserver is nextcloud under Apache24  and i installed the py36-certbot package.  And when you try certbot certonly or even with the webroot, it says certbot: Command not found. 

Any ideas why it's saying this?

Thanks in advance


----------



## hurricane (Jun 9, 2019)

On my server It's installed under /usr/local/bin/

Try 
`#/usr/local/bin/certbot`

Or do a rehash first:
`#rehash
#certbot`


----------



## obsigna (Jun 9, 2019)

In the not so distant past, a pkg-upgrade(8) renamed my certbot binary to certbot-2.7. The 2.7 seems to be related to the main python version which is installed on my machine. So perhaps your certbot is now at /usr/local/bin/certbot-3.6.


----------



## SirDice (Jun 11, 2019)

Check which files are installed where: `pkg info -l py36-certbot`.


----------



## Lamia (Jun 11, 2019)

And you may want to do a soft link to certbot with the py36-certbot.


----------



## nepsydude (Jun 11, 2019)

hurricane said:


> On my server It's installed under /usr/local/bin/
> 
> Try
> `#/usr/local/bin/certbot`
> ...



I tried this, do you know if anything is missing .


```
root@FreeBSD12:/usr/local/bin # certbot certonly
certbot: Command not found.
root@FreeBSD12:/usr/local/bin # rehash
root@FreeBSD12:/usr/local/bin # certbot
certbot: Command not found.
root@FreeBSD12:/usr/local/bin # certbot-3.6
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python                                                                             3.6"
```


----------



## tommiie (Jun 11, 2019)

Did you install certbot?


----------



## Lamia (Jun 12, 2019)

According to SirDice, it might be installed in a different name e.g. py36-certbot. The reason is that it was built with py36 - default python for FBSD12 (I hope that is true). I might have been certbot if python 2.7 where used as before.

Check here - /usr/local/bin/- for what name it uses. 

You can then do a symlink if you want it as certbot if under a different name. There is also a recent thread about pkg acme-client being deleted. And now replaced with acme.sh. Be sure you have certbot.....


----------



## SirDice (Jun 12, 2019)

Lamia said:


> There is also a recent thread about pkg acme-client being deleted. And now replaced with acme.sh.


Slightly different issue though as these two are separate ports. The original certbot is the same port just built with a different Python flavor. The name change is probably because of this (allowing different Python "flavors"), while keeping the naming convention clear, predictable and consistent.


----------



## Lamia (Jun 12, 2019)

SirDice said:


> Slightly different issue though as these two are separate ports. The original certbot is the same port just built with a different Python flavor. The name change is probably because of this (allowing different Python "flavors"), while keeping the naming convention clear, predictable and consistent.


Thanks SirDice, that was why I suggested that he should do a symlink if he wants.


----------



## nepsydude (Jul 8, 2019)

unfortunately i am still trying to figure this out,  as i tried to install it under 

```
# cd /usr/ports/security/py-certbot
# make install clean
```
it shows following:

```
===>   py36-certbot-0.34.2,1 depends on package: py36-setuptools>0 - found
===>   py36-certbot-0.34.2,1 depends on file: /usr/local/bin/python3.6 - found
===>  Configuring for py36-certbot-0.34.2,1
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python3.6"
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-certbot
```


----------



## obsigna (Jul 9, 2019)

There is something wrong with your python installation. Try to reinstall python 3.6:

`# pkg delete -f python3`
`# pkg delete -f python35`
`# pkg delete -f python36`
`# pkg delete -f python37`
`# pkg install python36`


----------



## nepsydude (Jul 9, 2019)

I deleted python and reinstalled it again with py36-certbot, everything is newly installed, it still is the problem with same file. 


```
# certbot certonly
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python3.6"

and 

# cd /usr/ports/security/py-certbot
root@FreeBSD12:/usr/ports/security/py-certbot # make install clean
===>   py36-certbot-0.35.1,1 depends on package: py36-setuptools>0 - found
===>   py36-certbot-0.35.1,1 depends on file: /usr/local/bin/python3.6 - found
===>  Configuring for py36-certbot-0.35.1,1
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python3.6"
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-certbot
```


----------



## SirDice (Jul 9, 2019)

What does `ls -l /usr/local/lib/libpython*` show?


----------



## nepsydude (Jul 9, 2019)

here it is:

```
# ls -l /usr/local/lib/libpython*
lrwxr-xr-x  1 www   www         17 May 16 03:14 /usr/local/lib/libpython2.7.so -                                                                                                             > libpython2.7.so.1
-rw-r--r--  1 www   www    1887504 May 16 03:14 /usr/local/lib/libpython2.7.so.1
-rw-r--r--  1 www   www      58707 May 16 03:15 /usr/local/lib/libpython2.7.so.1                                                                                                             -gdb.py
lrwxr-xr-x  1 root  wheel       20 Jul  6 03:25 /usr/local/lib/libpython3.6m.so                                                                                                              -> libpython3.6m.so.1.0
-rw-r--r--  1 root  wheel  2871888 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.                                                                                                             1.0
-rw-r--r--  1 root  wheel    65766 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.                                                                                                             1.0-gdb.py
```


----------



## anlashok (Jul 9, 2019)

Are the spaces in the file names present on the file system or is that just an artefact of pasting it here?



nepsydude said:


> -rw-r--r-- 1 root wheel 2871888 Jul 6 03:25 /usr/local/lib/libpython3.6m.so. 1.0
> -rw-r--r-- 1 root wheel 65766 Jul 6 03:25 /usr/local/lib/libpython3.6m.so. 1.0-gdb.py



The file names should not have a space between the .so. and the 1.0
eg 
/usr/local/lib/libpython3.6m.so.1.0
/usr/local/lib/libpython3.6m.so.1.0-gdb.py
not 
/usr/local/lib/libpython3.6m.so. 1.0
/usr/local/lib/libpython3.6m.so. 1.0-gdb.py


----------



## nepsydude (Jul 9, 2019)

anlashok said:


> Are the spaces in the file names present on the file system or is that just an artefact of pasting it here?
> 
> 
> 
> ...




```
ls -l /usr/local/lib/libpython*
lrwxr-xr-x  1 www   www         17 May 16 03:14 /usr/local/lib/libpython2.7.so -> libpython2.7.so.1
-rw-r--r--  1 www   www    1887504 May 16 03:14 /usr/local/lib/libpython2.7.so.1
-rw-r--r--  1 www   www      58707 May 16 03:15 /usr/local/lib/libpython2.7.so.1-gdb.py
lrwxr-xr-x  1 root  wheel       20 Jul  6 03:25 /usr/local/lib/libpython3.6m.so -> libpython3.6m.so.1.0
-rw-r--r--  1 root  wheel  2871888 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.1.0
-rw-r--r--  1 root  wheel    65766 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.1.0-gdb.py
```
I don't think they have any spaces between so. and 1.0 , I tried it again, there are no spaces.


----------



## toorski (Jul 9, 2019)

And why  /usr/local/lib/libpython2.7.so.1  is owned by www with www group ?
`-rw-r--r--  1 www   www    1887504 May 16 03:14 /usr/local/lib/libpython2.7.so.1`

Edit:

*This is my cerbot test:*

`certbot-3.6 --dry-run certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Apache Web Server plugin (apache)
2: Spin up a temporary webserver (standalone)
3: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-3] then [enter] (press 'c' to cancel):`


----------



## nepsydude (Jul 10, 2019)

Maybe I installed py27 earlier, now I deleted it and now it look like this

```
ls -l /usr/local/lib/libpython*
lrwxr-xr-x  1 root  wheel       20 Jul  6 03:25 /usr/local/lib/libpython3.6m.so -> libpython3.6m.so.1.0
-rw-r--r--  1 root  wheel  2871888 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.1.0
-rw-r--r--  1 root  wheel    65766 Jul  6 03:25 /usr/local/lib/libpython3.6m.so.1.0-gdb.py
```
once I enter certbot certonly it shows:

```
# certbot certonly
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python3.6"
```
also same with the other.

```
# certbot-3.6 --dry-run certonly
ld-elf.so.1: Shared object "libpython3.6m.so.1.0" not found, required by "python3.6"
```


----------



## mark_j (Jul 10, 2019)

If you have re-installed python36 as instructed by* obsigna *(https://forums.freebsd.org/threads/certbot-command-not-found.71061/#post-432328) then go to /usr/ports/security/py-certbot and

```
make clean
```

It might be a good idea to go and delete these:

```
$rm /usr/local/bin/certbot

$rm /usr/local/bin/certbot-3.6
```

The first is a link to the latter.

Then go back to your ports and:



```
make install
```


----------



## toorski (Jul 10, 2019)

I don't have enough skills to help you or troubleshoot the mess in your FreeBSD OS 
Personally, I always start with basics and then progress into more advanced applications or TCP/IP services such as personal cloud. If I was in your situation, I would redo FreeBSD installation and then go step by step and:
Make sure that the OS is up to date
Make sure that my pkg(s) are up to date
Make sure that my configuration files are correct
Make sure to look at the system logs for critical error messages
Make sure that the basic system utilities and apps work as intended

Then, I try to install some kind of developmental framework for TCP/IP server like Apache to play with.
After I felt comfortable and understood the language of the framework and the functions of httpd server, I'd deploy something to play with and learn from. Tho, I would not open my TCP/IP service port(s) to the outside world, until I was more/less sure that my system is secured and fully functional, at its basic level 
I can install almost anything and make it run somehow in FreeBSD. But ..., maybe I'm just lucky - heh

That said, here is my *pkg install* run of basic system utility developed by those who know better for someone like I who doesn't know that much:

`$ uname -a
FreeBSD fbsd12 12.0-RELEASE-p7 FreeBSD 12.0-RELEASE-p7 GENERIC  amd64
pkg install py36-certbot
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.

The following 12 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:

py36-certbot: 0.35.1,1
py36-josepy: 1.2.0
py36-acme: 0.35.1,1
py36-requests-toolbelt: 0.8.0
py36-pytz: 2019.1,1
py36-pyrfc3339: 1.1
py36-zope.interface: 4.6.0
py36-zope.component: 4.2.2
py36-zope.event: 4.1.0
py36-parsedatetime: 2.4_1
py36-configobj: 5.0.6_1
py36-configargparse: 0.14.0

Number of packages to be installed: 12

The process will require 17 MiB more space.

6 MiB to be downloaded.

Proceed with this action? [y/N]: y

This port installs the "standalone" client only, which does not use and is not the certbot-auto bootstrap/wrapper script.

The simplest form of usage to obtain certificates is:
# sudo certbot certonly --standalone -d <domain>, [domain2, ... domainN]>

NOTE:
The client requires the ability to bind on TCP port 80 or 443 (depending on the --preferred-challenges option used). If a server is running on that port, it will need to be temporarily stopped so that the standalone server
can listen on that port to complete the challenge authentication process.

For more information on the 'standalone' mode, see: https://certbot.eff.org/docs/using.html#standalone
The certbot plugins to support apache and nginx certificate installation will be made available in the following ports:

* Apache plugin: security/py-certbot-apache
* Nginx plugin: security/py-certbot-nginx`

And the cerbot-3.6 run:

`certbot-3.6 --dry-run certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: Spin up a temporary webserver (standalone)

2: Place files in webroot directory (webroot)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate number [1-2] then [enter] (press 'c' to cancel):`

_And Yes, I do use certbot-3.6 for Let's Encrypt to maintain and update my httpd, smtpd and imap4 (more/less) secured TCP/IP connectivity _


----------

