Core: 0.29.1 systemd can't shut down hass/ignoring sigterm

Created on 29 Sep 2016  路  4Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.29.1

Python release (python3 --version):

Component/platform:
Ubuntu

Description of problem:
Worked correctly with 0.28. After upgrade to 0.29.1 systemd is no longer able to shut it down - it looks that sigterm gets ignored/stuck. Need to kill -9 it.

Expected:
Shutdown of hass

Problem-relevant /etc/systemd/system/[email protected] entries and steps to reproduce:

# This is a simple service file for systems with systemd to tun HA as user.
#
# For details please check https://home-assistant.io/getting-started/autostart/
#
[Unit]
Description=Home Assistant for %i
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=%i
# Enable the following line if you get network-related HA errors during boot
#ExecStartPre=/bin/sleep 30
# Use `whereis hass` to determine the path of hass
ExecStart=/srv/hass/bin/hass --runner
SendSIGKILL=no
RestartForceExitStatus=100

[Install]
WantedBy=multi-user.target
  1. sudo systemctl restart home-assistant@hass
  2. tail logs with journalctl -f -u home-assistant@hass
Sep 28 23:35:55 thinkbox systemd[1]: Stopping Home Assistant for hass...
[...]
Sep 28 23:36:00 thinkbox hass[7647]: INFO:homeassistant.components.device_tracker.asuswrt:Checking ARP
Sep 28 23:36:00 thinkbox hass[7647]: INFO:somecomfort:Session refreshed
[...]
Logs as usual in normal operation
[...]
Sep 28 23:37:25 thinkbox systemd[1]: [email protected]: State 'stop-sigterm' timed out. Skipping SIGKILL.
[...]
Logs continue and hass keep on working

Additional info:

bug core

Most helpful comment

I'm seeing this as well.

Workaround is to add:
KillSignal=SIGINT
to the Service part of the systemd service file.

All 4 comments

I'm seeing this in 0.29.5 also.
I've noticed that if you restart/stop hass shortly after starting it, it will generally restart or stop as requested.

I'm seeing this as well.

Workaround is to add:
KillSignal=SIGINT
to the Service part of the systemd service file.

@magicus added that to my systemd file and looks good, thanks!

When I issue the "sudo systemctl restart homeassistant.service" command, it takes several minutes for it to actually perform the restart. Usually somewhere between 2-4 minutes. But it does always complete the restart.

Was this page helpful?
0 / 5 - 0 ratings