Letsencrypt

How would i be able to fix this issue with setting up letsencrypt?

./letsencrypt-auto certonly --email [email protected] -d xxxx.duckdns.org
WARNING: unable to check for updates.
Requesting root privileges to run certbot…
/home/pi/.local/share/letsencrypt/bin/letsencrypt certonly --email [email protected] -d xxxxx.duckdns.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Failed to find executable apache2ctl in PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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): 1
An unexpected error occurred:
ConnectionError: HTTPSConnectionPool(host=‘acme-v01.api.letsencrypt.org’, port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError(’<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x76bdfa70>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

The program need to run things as root, which HA user isn’t by default. To get around this:

Log in as the pi user first >

$ sudo adduser homeassistant sudo

$ sudo su -s /bin/bash/ homeassistant

$ cd full/path/to/cerbot/folder

$ ./certbot-auto certonly --standalone --preferred-challenges http-01 --email [email protected] -d examplehome.duckdns.org

As explained in the docs…

(Step 4)

And be sure that you’ve got 80/443 on your router forwarded to 80/443 on your Pi (when running certbot). You likely have 443 aimed at 8123.

when i run the second line of code it says
pi@Hassbian:~ $ sudo su -s /bin/bash/ homeassistant
Cannot execute /bin/bash/: Not a directory
When i follow the guide that you linked i get to the point of using my public ip address and it then says cant open page due to the server not responding ?

Sorry, typing too fast and not double-checking my code - that line should be:

sudo su -s /bin/bash homeassistant

(without the slash after bash)

As for server not responding, make sure your port-forwards are defined as per the previous steps, and make sure the device you are using to check your external IP is on the same network as your HA. Then if it is still not connecting, try connecting from a device that is not connected to the internal network in case you cannot loopback with your router.

Running the code cd full/path/to/cerbot/folder gives the following:
homeassistant@Hassbian:/home/pi $ cd full/path/to/cerbot/folder
bash: cd: full/path/to/cerbot/folder: No such file or directory
This is my port forwarding settings:


when i use the ip of my pi it works internally but when i use the public ip on my wifi and off my cellular data it does not work.

You don’t type “full path to certbot folder” you type THE full path to your certbot folder.

/home/homeassistant/certbot or wherever you put it.

I’m not familiar with that router software, does the yellow light bulb mean ‘active’?

yes the yellow light means active.
the location from looking at my pi from the network is \HASSBIAN\pi\letsencrypt\certbot
how would i type that into the command?

No, that’s the windows format for the network share.

Depending on how you’ve mapped the share it may be at

/home/pi/letsencrypt/certbot/

But it may not. Can you not remember where you downloaded it to?

It may be worth starting again from scratch, and doing the whole thing in one go tbh. The guide I linked to should take about an hour to complete from start to finish, and should iron out any problems you’re having from any other guides along the way.

i followed this guide:
https://www.youtube.com/watch?v=G8XWsXlfGFQ
I would but i have restarted so many times and to be honest there is always a problem. Home assistant seems so easy but it ant that way at all.

Some service providers block port 80 by default - I had no end of problems until I figured that out. Cablevision let you open it up with their web interface and it now works fine for me.

i shall try and give my service provider a call and see if they do block it.
thanks

1 Like

The reason I wrote the guide I linked to is because most of the other guides are incomplete, and make assumptions about your setup having certain prerequisites.

Ben’s video is great, but there’s errors in it about what port forwarding is required and does not cater for dhcp refreshes, auto renewals, the letsencrypt bit is pretty much skipped over etc etc.

Ben’s videos should be used in conjunction with the docs to help you understand what you’re doing, as if you treat them as gospel but your configuration is different to his you may get different results in some cases. This being one of them.

… And, if 80 is blocked there are workarounds for that too (depending on what other ports are blocked by your ISP)

Thanks all for the suggestions, i am reinstalling hassbian with the all in one installer and am gonna try once again hopefully this time it might work better

1 Like