Let's encrypt certificate renewal - unable to log in anymore

I have a big problem!!! My Let’s Encrype certificate was about to expire and I wanted to renew it. I set everything up in the beginning with the help of @brusc (@bruhautomation now I think). To renew certificate I did the following.

I forwarded external port 80 and 443 to internal port 80 and 443 (for my RPi3 IP address). Then I ran the following commands (with my email and domain):

cd letsencrypt
./letsencrypt-auto certonly --email [email protected] -d example.duckdns.org

When prompted, I selected option 2: standalone I got the following output, which means that certification renewal was successfull.

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for XXXXXXXX.duckdns.org
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0001_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0001_csr-certbot.pem

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/XXXXXXXX.duckdns.org/fullchain.pem. Your
   cert will expire on 2017-04-22. To obtain a new or tweaked version
   of this certificate in the future, simply run letsencrypt-auto
   again. To non-interactively renew *all* of your certificates, run
   "letsencrypt-auto renew"
 - If you like Certbot, please consider supporting our work by:

After this I removed previous port forwarding and turnd on port forwarding from 443 to 8123.

I also ran sudo chmod -R 777 /etc/letsencrypt just in case.

Rebooted RPi3…When I am trying to log into Home Assistant it just returns an unexpected error. Nothing is in in Home Assistant log as well.

Any help would be much appreciated

SSH into your Pi and run this command (Resize your terminal window a bit wider to make it easier to read the output):

sudo systemctl status home-assistant.service -l

This should show you whether the service is running or not as well as the last few lines of the log output. This may tell you what the issue is.

This is my output:

pi@Home-Assistant:~ $ sudo systemctl status home-assistant.service -l
● home-assistant.service - Home Assistant
   Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled)
   Active: active (running) since Sun 2017-01-22 18:02:28 CET; 2min 2s ago
 Main PID: 535 (hass)
   CGroup: /system.slice/home-assistant.service
           └─535 /srv/hass/hass_venv/bin/python3 /srv/hass/hass_venv/bin/hass -c /home/hass/.homeassistant

Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.date__time=2017-01-22, 18:04; friendly_name=Date & Time, icon=mdi:calendar-clock @ 2017-01-22T18:04:00.511875+01:00>, old_state=<state sensor.date__time=2017-01-22, 18:03; friendly_name=Date & Time, icon=mdi:calendar-clock @ 2017-01-22T18:03:00.508592+01:00>, entity_id=sensor.date__time>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.cpu_use=8; friendly_name=CPU uporaba, icon=mdi:speedometer, unit_of_measurement=% @ 2017-01-22T18:04:00.652794+01:00>, old_state=<state sensor.cpu_use=12; friendly_name=CPU uporaba, icon=mdi:speedometer, unit_of_measurement=% @ 2017-01-22T18:03:30.651403+01:00>, entity_id=sensor.cpu_use>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.cpu_temperature=53.7; friendly_name=CPU temperatura, unit_of_measurement=°C @ 2017-01-22T18:04:00.689893+01:00>, old_state=<state sensor.cpu_temperature=55.8; friendly_name=CPU temperatura, unit_of_measurement=°C @ 2017-01-22T18:03:00.595091+01:00>, entity_id=sensor.cpu_temperature>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.ram_use=23.5; friendly_name=RAM zasedeno, icon=mdi:poll, unit_of_measurement=% @ 2017-01-22T18:04:00.700407+01:00>, old_state=<state sensor.ram_use=23.2; friendly_name=RAM zasedeno, icon=mdi:poll, unit_of_measurement=% @ 2017-01-22T18:03:30.742342+01:00>, entity_id=sensor.ram_use>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.ram_use_2=172.4; friendly_name=RAM zasedenost, icon=mdi:percent, unit_of_measurement=MiB @ 2017-01-22T18:04:00.715347+01:00>, old_state=<state sensor.ram_use_2=170.5; friendly_name=RAM zasedenost, icon=mdi:percent, unit_of_measurement=MiB @ 2017-01-22T18:03:30.883810+01:00>, entity_id=sensor.ram_use_2>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.since_last_boot=0:01:34.721114; friendly_name=Since Last Boot, icon=mdi:clock, hidden=True @ 2017-01-22T18:04:00.726036+01:00>, old_state=<state sensor.since_last_boot=0:01:04.889268; friendly_name=Since Last Boot, icon=mdi:clock, hidden=True @ 2017-01-22T18:03:30.923021+01:00>, entity_id=sensor.since_last_boot>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.ram_free=562.8; friendly_name=RAM prosto, icon=mdi:memory, unit_of_measurement=MiB @ 2017-01-22T18:04:00.743198+01:00>, old_state=<state sensor.ram_free=564.9; friendly_name=RAM prosto, icon=mdi:memory, unit_of_measurement=MiB @ 2017-01-22T18:03:30.968341+01:00>, entity_id=sensor.ram_free>
Jan 22 18:04:00 Home-Assistant hass[535]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.received_wlan0=0.4; friendly_name=Wi-Fi - prejeti podatki, icon=mdi:arrow-down-bold-circle, unit_of_measurement=MiB @ 2017-01-22T18:04:00.764409+01:00>, old_state=<state sensor.received_wlan0=0.3; friendly_name=Wi-Fi - prejeti podatki, icon=mdi:arrow-down-bold-circle, unit_of_measurement=MiB @ 2017-01-22T18:03:30.979439+01:00>, entity_id=sensor.received_wlan0>
Jan 22 18:04:10 Home-Assistant hass[535]: INFO:root:Sending control command: KEY
Jan 22 18:04:20 Home-Assistant hass[535]: INFO:root:Sending control command: KEY

Last two lines are strange…

Yeah; I can’t say I’m familiar with those either. You have any command line switches or sensors? Maybe that’s what that is. They’re info messages though, so they’re not the reason. And it looks like you’re running. Maybe it’s slow to start for some reason. Give it a few minutes and check again.

If that doesn’t work, you could set your logger level to debug and restart; you’ll have a ton of stuff in your log, but you may get a better error message that will give you some info.

I can disable command line switches and try again. I hope that this is really the case @rpitera …beause my house is almost unusable now :smiley:

While you’re in there disabling, set the logger level too. This way if it isn’t the switches, you may get more info.

I made my config completely barebones now…almost nothing is in it. I included logger…it all looks pretty normal until it gets to this:

17-01-22 18:31:07 homeassistant.components.media_player: Setting up media_player.kodi
17-01-22 18:31:07 homeassistant.components.media_player.kodi: Unable to fetch kodi data
17-01-22 18:31:07 homeassistant.components.media_player: Setting up media_player.samsungtv
17-01-22 18:31:07 homeassistant.components.media_player.kodi: Unable to fetch kodi data
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 138, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 98, in create_connection
    raise err
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 361, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.4/http/client.py", line 1090, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 859, in send
    self.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 163, in connect
    conn = self._new_conn()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 147, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x6f91aa70>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 363, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.0.11', port=8080): Max retries exceeded with url: /jsonrpc (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6f91aa70>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hass/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 37, in send_request
    response = self.request(data=request_body)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.0.11', port=8080): Max retries exceeded with url: /jsonrpc (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6f91aa70>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/kodi.py", line 110, in _get_players
    return self._server.Player.GetActivePlayers()
  File "/home/hass/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 112, in __call__
    return self.__request_method(self.__method_name, args, kwargs)
  File "/home/hass/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 96, in __request
    return self.send_request(method_name, is_notification, args or kwargs)
  File "/home/hass/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 39, in send_request
    raise TransportError('Error calling method %r' % method_name, requests_exception)
jsonrpc_requests.jsonrpc.TransportError: ("Error calling method 'Player.GetActivePlayers'", ConnectionError(MaxRetryError("HTTPConnectionPool(host='192.168.0.11', port=8080): Max retries exceeded with url: /jsonrpc (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6f91aa70>: Failed to establish a new connection: [Errno 111] Connection refused',))",),))
17-01-22 18:31:07 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, entity_id=media_player.samsung_smart_tv, new_state=<state media_player.samsung_smart_tv=unknown; supported_media_commands=1337, is_volume_muted=False, friendly_name=Samsung Smart TV @ 2017-01-22T18:31:07.924835+01:00>>
17-01-22 18:31:07 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, entity_id=media_player.kodi, new_state=<state media_player.kodi=off; supported_media_commands=4927, friendly_name=KODI @ 2017-01-22T18:31:07.941209+01:00>>
17-01-22 18:31:07 homeassistant.components.media_player.samsungtv: Samsung TV 192.168.0.21:55000 added as 'Samsung Smart TV'
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=volume_up, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_play, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_next_track, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_on, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_stop, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_pause, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_off, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_play_pause, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=clear_playlist, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=toggle, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=volume_down, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_previous_track, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=volume_set, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=volume_mute, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=media_seek, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=select_source, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=play_media, domain=media_player>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=media_player>
17-01-22 18:31:08 homeassistant.core: Starting Home Assistant core loop
17-01-22 18:31:08 homeassistant.core: Starting Home Assistant
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=stop, domain=homeassistant>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=restart, domain=homeassistant>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event homeassistant_start[L]>
17-01-22 18:31:08 root: Pilight receiver thread started
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=power_on, domain=hdmi_cec>
17-01-22 18:31:08 homeassistant.core: Timer:starting
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=standby, domain=hdmi_cec>
17-01-22 18:31:08 homeassistant.core: Bus:Handling <Event service_registered[L]: service=select_device, domain=hdmi_cec>
17-01-22 18:31:08 netdisco.service: Scanning

Connection refused?

Oh man, I got it working :smile:

The problem was my router which is a piece of Garbage(!) (yes, capital letter) It is from my ISP provider and it’s just downright garbage. When setting port range forwarding there, I cannot only disable unused settings, eventhoug it offers that option but I have to put zeros in all of them. Stupid.

@rpitera thank you for your help. I see you are helping a lot around this forum and it’s really appreciated!!!

1 Like

I know that feeling when you can’t log into HA so I stuck around to see if I could be of any more help; so glad you got it figured out!

I’m glad I could help out - that’s why I’m here!

1 Like