HA won't start or produce an error log - I'm a bit panicky

Can anyone help me with a startup issue? Everything was working fine, I did some editing in my sensors.yaml and now HA won’t start up and doesn’t produce a error log either. This is the first time this ever happened to me and I’m a bit freaked out.

systemctl status shows the following:

● home-assistant.service - Home Assistant
Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled)
Active: failed (Result: exit-code) since Mon 2016-10-17 23:52:26 EDT; 20s ago
Process: 2278 ExecStart=/srv/hass/hass_venv/bin/hass -c /home/hass/ (code=exited, status=1/FAILURE)
Main PID: 2278 (code=exited, status=1/FAILURE)
Oct 17 23:52:25 raspi1 hass[2278]: self.update(index+1)
Oct 17 23:52:25 raspi1 hass[2278]: File "/srv/hass/hass_venv/lib/python3.4/site-packages/yaml/reader.py", line 153, in update
Oct 17 23:52:25 raspi1 hass[2278]: self.update_raw()
Oct 17 23:52:25 raspi1 hass[2278]: File "/srv/hass/hass_venv/lib/python3.4/site-packages/yaml/reader.py", line 178, in update_raw
Oct 17 23:52:25 raspi1 hass[2278]: data = self.stream.read(size)
Oct 17 23:52:25 raspi1 hass[2278]: File "/srv/hass/hass_venv/lib/python3.4/codecs.py", line 313, in decode
Oct 17 23:52:25 raspi1 hass[2278]: (result, consumed) = self._buffer_decode(data, self.errors, final)
Oct 17 23:52:25 raspi1 hass[2278]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 179: invalid start byte
Oct 17 23:52:26 raspi1 systemd1: home-assistant.service: main process exited, code=exited, status=1/FAILURE
Oct 17 23:52:26 raspi1 systemd1: Unit home-assistant.service entered failed state.

Commenting out the edits in the sensors.yaml file had no effect. I checked every other YAML file and they all look like valid text files, so I am thinking that somehow one of the core file got mangled but I can’t tell which one from the error.

first try to take a clean yaml from which everyone is sure that it should work.
(the original one)

and make sure that it has the right rights.

if that does work you know that it is something in the yaml.
if not then you probably have to reinstall HA.

1 Like

I know the feeling…

The only other time I had HASS not start and also not producing errors in the Hass log was when I had deleted my full .homeassistant directory and just restored my backup. I made a write up on how I got it back working (see below).

I would suggest to make a full backup of everything under .homeassistant and then deleting everything in that directory on your Pi. If you then restart HASS, it pulls all the needed files from the web and should start up (of course empty because there are not yaml’s in there) . At least you will know if it is hass ore something else that is messed up. If it comes up, then start copying back your yamls (see post for some tips)

1 Like

There’s probably something wrong with your config, some special character or something like that.
It seems it is not utf-8 encoded.
Probably a name for an entity - try to remove all non-ascii characters from the config.
You can also try to convert the file:

iconv -f iso-8859-1 -t utf-8 configuration.yaml >configuration.yaml.converted

you specify the current encoding with -f - depending on what it is, you might need to change the parameter.

Sebastian

1 Like

Sebastian gave me the clue here - I was trying to make an average temperature sensor using a value template using the example shown in this post:

I copied the example and I believer it was the degree symbol in the unit of measurement that threw things off. Wow that was scary! It was the sensors.yaml file but the error doesn’t reference the file with the special character or the line in that file so I was without a clue.

I think HA should have identified the proper file, so I’m going to put in an issue for this so it gets caught properly.
This is the longest I’ve been down and it was pretty weird having to give up at 1:00 AM knowing the HA wouldn’t be running in the morning.

Thanks @sebk-666 for the solution as well as the iconv info - didn’t know about that.
@ReneTode and @Tyfoon - thanks so much for your help and support!

Issue raised:

just for feeling a bit more secure:

make a dir call backup and copy all youre yaml there right now.
if you edit a lot, make a regular backup.

after that you can get your HA working again just by changing 2 dirnames or copiing a few files.

i dont do it often enough, but i should :wink:

Agreed and I had a backup, but it wasn’t recent enough. Just did a new one.

Here’s the reason I raised the bug issue though; besides not raising a proper error and creating a log, I had commented out the new section with the sensor completely as part of my initial trouble shooting.

HA shouldn’t have even read the section with the error…

1 Like

i had that trouble when i started using HA.
i didnt use a right editor and got TABS where they shouldnt be.

no real error to fall back on. but because i knew it after a short while i always checked my last changes on strange characters.
if HA doesnt start after an yaml edit, i am always sure it is a character problem.

1 Like

I am now :laughing:

I’m not a dev, but shouldn’t voluptuous catch something like this? Or do I not understand how voluptuous works?

i cant help you there.
by voluptuous do i think of a woman. :stuck_out_tongue:

1 Like

My first thought when I saw it as well! LOL

For the record: Voluptuous, despite the name, is a Python data validation library. It is primarily intended for validating data coming into Python as JSON, YAML, etc.

It has three goals:

Simplicity.
Support for complex data structures.
Provide useful error messages.

You can find out more about it here:

1 Like

That explains a lot; yesterday I made a rest sensor with a template and Hass would not restart. I commented out the sensor and still it would not restart. I then removed it completely to work on it in a separate notepad. Hass restarted fine again. Never made this link. Notepad actually puts the # one space before the actually text (instead of the first character on the line). Does this cause these issues?

Not sure about this. I use the ConText editor for everything including YAML files. Never had a problem with it until this.

For the record, I’m still unsure of how to put the degree symbol in so HA will accept it, but without it HA is loading fine and the sensors work great.

Edit: Found the solution in this post: