HA (hassbian) suddenly stop working - missing all modules?

Hi,

today in night my HA (I use hassbian version) suddenly stop working. I dont do anything - no update, changes in configuration etc. but is suddenly stop working. I can connect through SSH but HA dont want start. I found that log file has a lot of Gb, so I remove it but now it dont create new.

When I try run it - nothing happen - but status command return:

ImportError: No module named 'homeassistant'

I try update it but it return diff error:

ImportError: No module named 'pip'

How it is possible that a lot of modules dissepear? In hassbian in default is any auto upgrade of python or any similiar?

BTW: I try a lot of restarts but nothing.

Thank you for any help.

Have you tried to start HA manually ?
I think you have to activate the venv before.

Yes already tried, same bug:
ImportError: No module named ‘homeassistant’

are you sure you didn’t delete other critical homeassistant files by mistake?

what exactly did you delete?

there should be no reason for HA to stop working (barring a failed HDD/SD card) with no modifications by you.

also you said you were on hassbian but you posted this under the hass.io section. which are you running?

I am sure that I only delete homeassistant.log (but that errors show me before) because I has a problem with read it (it has around 4Gb), so I hope that when I remove it, it write errors again, but nothing.

I do nothing more than 3 weeks - its only work at home, but without changes in configuration, no updates etc. so I dont understand it too. SD card looks correct - I have installed it on pi3.

BTW: Sorry for section in Hass.io -> I fix it … I think that is common section and that HA = Hass = only shortcut.

Do you have a backup of your SD card?

I have backup of my config files, so I can reinstall everything and restore files from backup and I must install several other components (use PHP for some custom scripts), but I am interest why it is happen.

It is reason why looking for solution which will be create ISO of SD card on my NAS … I hope that is possible …

Good that you have backup config files already.
What do you get if you run this:
sudo systemctl status [email protected]

This is what I get with HA running:
[email protected] - Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-03-26 17:22:55 UTC; 1 day 22h ago
Main PID: 470 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]
├─ 470 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass -c /home/homeassistant/.homeassistant
etc…

As far as I know hassbian does not have built-in auto-update/upgrade.

Already tried … there show that (full log bellow)

ImportError no module named 'homeassistant'

simple dissepeares every modules … I don`t understand how it is possible, but probably is … I would like to try install every module again but I am not sure how work that “python environment” … I am PHP developer so Python is strange for me …

It is look that I can use command “pip3” but when I activate that environment
source /srv/homeassistant/bin/activate
that command return:
ImportError: No module named 'pip'

It is puzzle for me …

[email protected] - Home Assistant for homeassistant
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-03-28 13:12:13 UTC; 2h 21min ago
  Process: 2483 ExecStart=/srv/homeassistant/bin/hass (code=exited, status=1/FAILURE)
 Main PID: 2483 (code=exited, status=1/FAILURE)

Mar 28 13:12:13 hassbian systemd[1]: Started Home Assistant for homeassistant.
Mar 28 13:12:13 hassbian hass[2483]: Traceback (most recent call last):
Mar 28 13:12:13 hassbian hass[2483]:   File "/srv/homeassistant/bin/hass", line 7, in <module>
Mar 28 13:12:13 hassbian hass[2483]:     from homeassistant.__main__ import main
Mar 28 13:12:13 hassbian hass[2483]: ImportError: No module named 'homeassistant'
Mar 28 13:12:13 hassbian systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Mar 28 13:12:13 hassbian systemd[1]: [email protected]: Unit entered failed state.
Mar 28 13:12:13 hassbian systemd[1]: [email protected]: Failed with result 'exit-code'.

I’m not a programmer at all, just a user :blush:

If for me, I would first rename the db file and known_devices file and restart.
If that still does not work, try the upgrade step
Upgrade
That’s the limit of my HA/Pi “skills”, next would be reinstall (on a new SD card) for me.

I just use Win32DiskImager on my windows machine to make a backup of the SD card. You can store that backup file anywhere you want. i make a backup of the card on every major upgrade after i verify it is working. and i make periodic backups if i make a bunch of config changes.

what was the full path (including the exact name of the file) of the log file you deleted? you said you deleted homeassistant.log. My log file is called home-assistant.log. if you have a straight hassbian install then yours should be named the same too and located in the directory where your configuration files are located (/home/homeassistant/.homeassistant) unless you told it to put it somewhere else - but then you wouldn’t have a straight hassbian install…

and i’ve NEVER seen my home-assistant.log file be anywhere NEAR that size. either you deleted the wrong file or you had MAJOR issues before you deleted the file. Mine has been running for almost a week and its size is around 29k.

either way, since you don’t have a full sd card image backup, it may just be easier to reinstall hassbian on a new sd card and bring your saved config files back in.

Thank you, I must begin backup as images …
But yes it was home-assistant.log, and 100% that was the log … I dont know why it is so much large, but it is look that I have some problem with SD card maybe, because I try apt-get update and it isnt working too - some missing files /etc/conf.d … so it is look that a lof of files from SD card missing … why? i dont know but problem will be there …

SD cards fail…especially if they get written to a lot. which yours definitely sounds like it was. some people use a different db manager and put the log files in a different location off the SD card for that reason. I haven’t done that yet and luckily haven’t had any issues.

So thanks everybody :slight_smile: I must go reinstall it because outdoors it dims and I can not light up :smiley: