Hass not shutting down

When I shutdown or restart home-assistant, it seems to be failing to terminate correctly. Does anybody know why this might be?

I’m running on a raspberry pi 3, on raspian, with a Z-stick 5 connected to two other z-wave components. Other major components are Chromecasts on WiFi, an MQTT link to owntracks, and then pi-hole, transmission, uber, and snmp modules loaded.

Dec 30 15:27:44 raspberrypi systemd[1]: Stopping Home Assistant...
Dec 30 15:27:44 raspberrypi hass[746]: INFO:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
Dec 30 15:27:44 raspberrypi hass[746]: INFO:homeassistant.components.zwave:Stopping ZWave network.
Dec 30 15:27:44 raspberrypi hass[746]: INFO:openzwave:Stop Openzwave network.
Dec 30 15:27:44 raspberrypi hass[746]: INFO:openzwave:ZWave configuration written to user directory.
Dec 30 15:27:49 raspberrypi hass[746]: Config directory: /home/homeassistant/.homeassistant
Dec 30 15:28:11 raspberrypi hass[746]: INFO:netdisco.service:Scanning
Dec 30 15:29:14 raspberrypi systemd[1]: [email protected] stop-sigterm timed out. Killing.
Dec 30 15:29:14 raspberrypi systemd[1]: [email protected]: main process exited, code=killed, status=9/KILL
Dec 30 15:29:14 raspberrypi systemd[1]: Stopped Home Assistant.
Dec 30 15:29:14 raspberrypi systemd[1]: Unit [email protected] entered failed state.

The last few messages are systemd coming in and killing the process after a couple of minutes.

1 Like

It’s a known problem. I gave up using the app to shut down HA and just go to systemctl to do it every time. It works correctly that way.

It only works in systemctl because it’s killing it after it fails to shutdown. At least that’s how it is for me.

Annoying because you have to wait for the timeout.

but much quicker than waiting forever for it to shut down through the app.

Wait, just upgraded to 35 and it worked. Maybe it’s fixed.

True, it is quicker.

Unfortunately it’s still hanging in 0.35.3 for me

What happens when you run it via CLI with the “hass” command and then shut it down with ^C? This is what I’ve been getting for the last view versions:

^C16-12-31 06:23:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event homeassistant_stop[L]>
16-12-31 06:23:25 INFO (Thread-5) [homeassistant.components.zwave] Stopping ZWave network.
16-12-31 06:23:25 INFO (Thread-5) [openzwave] Stop Openzwave network.
16-12-31 06:23:25 INFO (Thread-5) [openzwave] ZWave configuration written to user directory.
16-12-31 06:23:25 INFO (Thread-13) [homeassistant.components.emulated_hue.upnp] UPNP responder shutting down.

Then after waiting for a bit and hitting ^C again, I get this:

16-12-31 06:23:25 INFO (Thread-13) [homeassistant.components.emulated_hue.upnp] UPNP responder shutting down.
^CException ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 1294, in _shutdown
  File "/usr/lib/python3.4/threading.py", line 1060, in join
  File "/usr/lib/python3.4/threading.py", line 1076, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):

That looks very similar to what I’m getting. Certainly the second ^C gives the same trace-back. Prior to that it looks very much like the log file I gave in the original post.

Edit: I’m not at home at the moment, and I don’t want to remotely shut things down. When I’m back home I can capture a log if it’s useful.

I too seem to be having log restart/shutdown times due to Netdisco service still running after the restart service has been called (doing scans every 5 minutes). Doing a service restart via init.d also shows the same behaviour. Log below:

17-01-06 11:03:28 homeassistant.core: Bus:Handling <Event call_service[L]: service_data=, service_call_id=1978778864-68, domain=homeassistant, service=restart>
17-01-06 11:03:28 homeassistant.core: Bus:Handling <Event service_executed[L]: service_call_id=1978778864-68>
17-01-06 11:03:28 homeassistant.core: Bus:Handling <Event homeassistant_stop[L]>
17-01-06 11:03:28 homeassistant.components.wemo: Shutting down subscriptions.
17-01-06 11:03:28 hbmqtt.broker: Broker closed
17-01-06 11:03:28 homeassistant.components.emulated_hue.upnp: UPNP responder shutting down.
17-01-06 11:03:28 hbmqtt.broker: Listener 'default': 1 connections acquired
17-01-06 11:03:28 pywemo.subscribe: Terminated threads
17-01-06 11:03:39 netdisco.service: Scanning
17-01-06 11:08:48 netdisco.service: Scanning
17-01-06 11:13:57 netdisco.service: Scanning

I’m also experiencing this problem on regular basis.
Does anyone have an idea in what part of the code I should look first to solve this?


same here!


could you tell me how to do the shutdown?