Hass no longer starting - Segfaults

For a while, on a random reboot Hass wouldn’t start. Since a reboot always fixed the issue, I didn’t worry too much about it. The issue, however, had started happening more often. I went to update to the newest version, and received a lot of errors (such as below). This is on a Pi 3 with the all in one installer.

17-04-18 06:18:49 WARNING (MainThread) [homeassistant.components.sensor.yr] Retrying in 15 minutes: [Errno 101] Cannot connect to host aa015h6buqvih86i1.api.met.no:443 ssl:True [Can not connect to aa015h6buqvih86i1.api.met.no:443 [Network is unreachable]]

I did a reboot and was going to attempt the upgrade again, but now Hass will no longer start. It always fails with the following. Any thoughts?

pi@raspberrypi:~ $ sudo systemctl status -l home-assistant
● home-assistant.service - Home Assistant
   Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled)
   Active: failed (Result: signal) since Tue 2017-04-18 20:59:44 EDT; 1min 15s ago
  Process: 670 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass -c /home/homeassistant/.homeassistant (code=killed, signal=SEGV)
 Main PID: 670 (code=killed, signal=SEGV)

Apr 18 20:59:43 raspberrypi systemd[1]: Started Home Assistant.
Apr 18 20:59:44 raspberrypi systemd[1]: home-assistant.service: main process exited, code=killed, status=11/SEGV
Apr 18 20:59:44 raspberrypi systemd[1]: Unit home-assistant.service entered failed state.

I updated Raspbian, and upon reboot Hass started. I was able to update to version 0.42.4. On the next reboot, more segfaults. It appears random, but it takes 3 to 4 reboots to get it to work. After that, if I reboot it’s segfaults for 3 or 4 more times. Any thoughts or suggestions? When I check the config it shows as valid. I’m not sure where to go from here.

Does anyone have any suggestions? I’m running the following script in cron every 5 minutes, but even then it can take hours of reboots until it starts up successfully.

#!/bin/bash

# Check if HASS is active, and if not reboot.

hass_status=$(sudo systemctl status -l home-assistant | grep 'Active:')
status_check='failed'

if echo $hass_status | grep -q $status_check ; then
  sudo reboot
fi

Random faults like that suggest either faulty hardware, or a corrupt install. Also, reboots are a brute force option, why not simply try restarting the service?

I’d grab a fresh SD card and do a fresh install of Raspbian and the AIO installer, then restore your configuration. That will rule out a faulty SD card and a corrupt install. If you’re still getting issues, you’ve either got an under powered power supply, or a faulty Pi.

The reboots were to fix random zwave disconnects I had when I first started the build. Those went away after I added more devices, so it was probably a weak signal. I just figured a reboot every few weeks couldn’t hurt.

With that being said, I did go out and get a new SD card. New install of Raspbian and Hass, and everything seems to be working. I was hoping there was something simple I had missed, but appears to be the card or install. Thanks.