Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Assistant 2022.2 not starting #52

Closed
piereligio opened this issue Feb 2, 2022 · 34 comments
Closed

Home Assistant 2022.2 not starting #52

piereligio opened this issue Feb 2, 2022 · 34 comments

Comments

@piereligio
Copy link

I don't really know where to ask, I'm not sure if this issue is because of the integration or of Home Assistant Core itself.
Basically what happens is that if I try to upgrade homeassistant service from the shell of this integration, what happens is that homeassistant service won't start. It prints "Home assistant only supports Linux, OSX and Windows using WSL", then it says it is launched with the local URL where I should be able to open the GUI, but it will never be accessible. If I check the status of the service giving input 2, it will say that homeassistant isn't running, and if I restart, it tells me something like "home assistant not running check homeassistant_daemon.pid" .

Basically the question if it is only matter of time before 2022.2 will get supported, or if it's my installation that got bugged up somehow, or if I have something to edit in the configuration files.

Thanks in advance.

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

. It prints "Home assistant only supports Linux, OSX and Windows using WSL",

Oh 💩 I'm in the process of spinning up a TrueNAS CORE instance to have a look

@piereligio
Copy link
Author

Thank you very much 😁

@adorobis
Copy link

adorobis commented Feb 2, 2022

Same here. Had to roll back to snapshot from before upgrade...

@piereligio
Copy link
Author

Same here. Had to roll back to snapshot from before upgrade...

Exactly, same here. This time around snapshots were a godsend. Thanks for the feedback 😊

@adorobis
Copy link

adorobis commented Feb 2, 2022

On the release party on youtube channel they've just confirmed the fix - there is a supported os check included by default which can be overridden by a command line parameter. @tprelog is about to implement a fix :) This is fast support :)

@adorobis
Copy link

adorobis commented Feb 2, 2022

snapshots were a godsend

Yeah, I have it as a habit since a few months to always take a snapshot just before any upgrades...

@piereligio
Copy link
Author

snapshots were a godsend

Yeah, I have it as a habit since a few months to always take a snapshot just before any upgrades...

I have periodic snapshots everyday for the whole pool, so I can always use those even in the worst case possible (which is me forgetting to do important stuff lol).

On the release party on youtube channel they've just confirmed the fix - there is a supported os check included by default which can be overridden by a command line parameter. @tprelog is about to implement a fix :) This is fast support :)

Being it a known command line parameter, is it something I can do even before a new release of this integration? I mean, not that I'm so in a hurry, but it would be great. I can't wait to set up local Google Assistant feature, you know ahah

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

Ok here's the fix

iocage console $jail_name
#Press 0 to exit menu

ee /usr/local/etc/rc.d/homeassistant

Edit line 116 of the script to add --ignore-os-check as shown below

HA_ARGS="--ignore-os-check --config ${homeassistant_config_dir}"

Press esc then enter twice to save and exit

Finally start Home Assistant

service homeassistant start

@piereligio
Copy link
Author

Ok here's the fix

iocage console $jail_name
#Press 0 to exit menu

ee /usr/local/etc/rc.d/homeassistant

Edit line 116 of the script to add --ignore-os-check as shown below

HA_ARGS="--ignore-os-check --config ${homeassistant_config_dir}"

Press esc then enter twice to save and exit

Finally start Home Assistant

service homeassistant start

It's working, thank you so much, amazing support! 😁

@adorobis
Copy link

adorobis commented Feb 2, 2022

Many thanks for super fast fix!

Edit line 116

In my case it was line 146 and I don't recall to edit the file before.
Btw, when checking the config from command line menu it also shows the same message and I think it is not performing the config check.
image

@piereligio
Copy link
Author

piereligio commented Feb 2, 2022

Many thanks for super fast fix!

Edit line 116

In my case it was line 146 and I don't recall to edit the file before. Btw, when checking the config from command line menu it also shows the same message and I think it is not performing the config check. image

The line will still appear, but if you check status, it won't stop running now. If you wait long enough, GUI will be available at your usual local address. I had it in line 116 though. The check_config didn't print out anything already before the update, however. I guess it prints out only if something is wrong.

@adorobis
Copy link

adorobis commented Feb 2, 2022

Yes, HA starts although it took a very long time. Also need to update the zwavejs2mqtt plugin as it requires latest version now (and this one also takes quite a long time). Let's see if anything else is broken...

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

In my case it was line 146 and I don't recall to edit the file before.

@adorobis you must be on an older version of the plugin -- recent version should show the plugin version on the main menu

image

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

Plugin is updated now. Running a Plugin UPDATE will apply required changes.

@adorobis
Copy link

adorobis commented Feb 2, 2022

you must be on an older version of the plugin

Indeed, I don't remember when doing the last update, for sure before November last year. I think I've only tried to update the plugin once in the past and it failed so was rather not doing it later. Is the plugin snapshot also allowing to roll back to before the plugin Update?

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

I don't remember when doing the last update,

I think you can still see your version in the POST INSTALL NOTES
image

Getting a bit off topic, this is kinda an area I'm torn between just leaving well enough alone or some further development effort. For example I've debated in my head if we should have a way to run an update from the menu, that will only update files contained in the plugin overlay. Aside from changes to the plugin manifest, which are less frequent, that would essentially allow you to keep the "plugin" updated without running a Plugin UPDATE.

@piereligio
Copy link
Author

piereligio commented Feb 2, 2022

Follow up on the original issue: basically it seems to happen still, when I restart home assistant server from home assistant GUI. It's not a big issue, since it doesn't happen when restarting the whole jail (and of course it doesn't happen when launching from shell, either), but I think it made sense to report it anyways.

@adorobis
Copy link

adorobis commented Feb 2, 2022

Yeah, pretty old here: version: v_0.4.0 and the release is 12.1-RELEASE-p13
I'm hesitating to update as some of my plugins fail to update.
Would plugin Update without selecting to update the jail update only the plugin overlay files?

@adorobis
Copy link

adorobis commented Feb 2, 2022

it doesn't happen when restarting the whole jail

I'm always restarting entire jail as some integrations don't reload properly when just restarting the service or from GUI (e.g. yamaha integration seems to keep some tcp connections open)

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

it seems to happen still, when I restart home assistant server from home assistant GUI.

Unfortunately, I don't think I can affect how the GUI works. It is possible, (already a good case for the new button entity helper) to trigger the service homeassistant restart from within HA.

You could probably restart the entire jail as well but that will be a little more involved, getting into using the TrueNAS API

@tprelog
Copy link
Owner

tprelog commented Feb 2, 2022

Would plugin Update without selecting to update the jail update only the plugin overlay files?

No but you can it manually for now... If you'd like, let's open a separate discussion about it

@tprelog
Copy link
Owner

tprelog commented Feb 3, 2022

@piereligio - think we have a workaround for the restart issue. I've already updated the plugin

https://github.com/tprelog/iocage-homeassistant/releases/tag/v7-2022.2.3

If you'd rather update your rc script manually instead, just apply these changes like we did above

@piereligio
Copy link
Author

@piereligio - think we have a workaround for the restart issue. I've already updated the plugin

https://github.com/tprelog/iocage-homeassistant/releases/tag/v7-2022.2.3

If you'd rather update your rc script manually instead, just apply these changes like we did above

Thank you very much 😁

@tprelog tprelog pinned this issue Feb 3, 2022
@b-neufeld
Copy link

Ran updates today and can't get back into the GUI after quite a bit of waiting...

Does this message mean something is still migrating in the background that I have to wait to complete?
image

Thanks for the discussion & notes so far.

@adorobis
Copy link

adorobis commented Feb 7, 2022

It took longer than usual to start after upgrading to 2022.2.0 In the mean time check if the service is running (option 2 on that menu screen) and if there are any messages in the log file (/home/homeassistant/homeassistant/home-assistant.log)

@b-neufeld
Copy link

b-neufeld commented Feb 7, 2022

Thanks for the reply! How much longer - like half an hour or more? If so, I will let it sit all afternoon.

Option 2:

homeassistant is running as pid 48438.
http://172.16.1.108:8123

Nothing exciting in the logfile. It appears to have started up successfully at least once after upgrading because it was griping about a Volumio device loading slowly. Every subsequent restart of the service or reboot of the jail, nothing happens.

The log file was >300 MB so I renamed it and created a new logfile "home-assistant.log" and ensured it had the right permissions and owner. When I restart the home assistant service, the logfile stays at filesize zero.

As a sanity-check I searched the jail for other instances of "home-assistant.log" (found none) and double-checked the mount point mapping (appears unchanged).

I tried running the upgrader again from the console, all requirements are already satisfied, and it signs off with these lines again:

Testing configuration at /home/homeassistant/homeassistant
INFO:homeassistant.helpers.storage:Migrating core.device_registry storage from 1.1 to 1.2
INFO:homeassistant.helpers.storage:Migrating core.entity_registry storage from 1.1 to 1.4

... and logfile remains empty.

Running service -e in the console, I also see "/usr/local/etc/rc.d/homeassistant" running.

Any thoughts are appreciated. The empty logfile is strange. And sorry if this is not the right place to troubleshoot (please advise if not), but it seemed relevant.

EDIT: Before anyone wastes any time on my reply... I think I have found a workaround. I shut down the old jail, built a new jail from scratch, and pointed it at my config directory (which I'd externalized per the documentation). Everything has been booting up for 20 minutes - verrrry slowly as adorobis said - but at least it all seems to be working. Glad I read the original instructions and set that up!! I have to run a cat to the vet right now but you can assume that if I don't update this post again, it's all working. Not sure where I went wrong. Thanks again all. Love this integration.

FINAL UPDATE: All appears to be well. HA is back and my cat's shots are up to date. Not sure what the issue was, but as a colleague used to say I'm going to "back away slowly". Thanks to all the contributors!

@tprelog
Copy link
Owner

tprelog commented Feb 8, 2022

Hi @b-neufeld sorry for the trouble, but glad to hear you got it sorted... and thank you @adorobis for jumping in

Just a quick follow up here

Everything has been booting up for 20 minutes

There is at least one report of someone waiting around 45 minutes for Home Assistant to come back after an update... But that was after a Plugin UPDATE which reinstalled Home Assistant during the process. (That's when I decided I would not reinstall home assistant automagically anymore on future updates, even when I know it needs to be.)

The log file was >300 MB so I renamed it and created a new logfile "home-assistant.log" and ensured it had the right permissions and owner. When I restart the home assistant service, the logfile stays at filesize zero.

That could be normal - The default log level in HA is set to warning so we typically don't see anything until it breaks. I was just sharing with @adorobis in this discussion, some ideas to change the log levels info and get more feedback during an update

@adorobis
Copy link

Home-Assistant works and is actively supported for FreeBSD

I'm afraid it isn't. Neither officially nor actively supported. Point me to the place where it states otherwise.

@tprelog
Copy link
Owner

tprelog commented Feb 17, 2022

Sorry @UraniumDonut but FreeBSD has never been supported by Home Assistant. We are lucky that for the most part it just works.

Please see this Home Assistant ADR for details
https://github.com/home-assistant/architecture/blob/6da4482d171f2ef04de9320d313526653b5818b4/adr/0016-home-assistant-core.md#0016-installation-method-home-assistant-core

@aliekiddo
Copy link

I'm having the same issue after upgrading to 2022.2.3 - I previously had 2021.3.4 which stopped successfully restarting with the WebUI in HA, only when restarting the jail would it come back up.

I thought updating the plugin / upgrading with the shell would help (I've tried both) but I've not been able to get the UI working for several hours.
I've tried restarting from shell; restarting the jail; stopping and starting; rebooting TrueNAS. It's been at least 1:30 after I've rebooted and it's still down.

@tprelog
Copy link
Owner

tprelog commented Mar 31, 2022

Hi @aliekiddo - What you are facing is likely more than this issue alone, which is caused by a new OS check implemented by Home Assistant.

after upgrading to 2022.2.3 - I previously had 2021.3.4

That's a really big jump for Home Assistant and this plugin. I imagine there are a few breaking changes you'll need to address with Home Assistant, including the required (yearly) python upgrade.

If you are using an external dataset for your configuration, I would suggest just doing a clean install of the plugin and remount your configuration there.

Otherwise you'll first need to run a Plugin UPDATE from the TrueNAS UI. This should ensure you have the new python version installed as well as other files that have since been updated in this plugin, including the fix for the OS check.

Next you'll need to manually switch python versions and rebuild the virtualenv for Home Assistant

iocage console $JAIL_NAME
# press 0 to exit menu
sysrc homeassistant_python=/usr/local/bin/python3.9
service homeassistant reinstall homeassistant

Also it will take some time for Home Assistant to reinstall itself. It will still be downloading and compiling additional python packages in the virtualenv, depending on the number of integrations and your NAS hardware, this could take awhile.

There's a way, mentioned in this discussion comment to gain some feedback about what's happening by setting the Home Assistant logger integration to info and having the log file print out in the terminal as things happen. The discussion itself does not relate to your issue but there is also boring, no audio, realtime video example showing how it works while reinstalling Home Assistant.

@aliekiddo
Copy link

aliekiddo commented Mar 31, 2022

That's a really big jump for Home Assistant and this plugin. I imagine there are a few breaking changes you'll need to address with Home Assistant, including the required (yearly) python upgrade.

I didn't realise until recently that updating the plugin wasn't updating the Home Assistant version. I thought I had ran an upgrade in the Home Assistant console last week before this, but I know from another github thread I was running 2021.3.4 8 days ago - I just thought the TrueNAS version ran behind the current version.
I checked the solutions on this thread, the line to ignore OS version was present.

HA_ARGS="--ignore-os-check --config ${homeassistant_config_dir}"

If you are using an external dataset for your configuration, I would suggest just doing a clean install of the plugin and remount your configuration there.

I am not using an external dataset unfortunately for a quick fix.

I started a plugin update at 08:50, I was getting a lot of 'lua script failed'

After a while TrueNAS kicked me out of the WebUI and I lost the ability to see what stage it was at. As far as I can see it's still sitting at 0% at 11:30, is it normal to take this long?

Edit: It's now saying it's failed with error: list index out of range

2022-03-31 09 00 11

Screenshot_20220331-103806

@tprelog
Copy link
Owner

tprelog commented Mar 31, 2022

Ugh, sorry for the trouble @aliekiddo First and most important, Do not delete this jail. In any case we can still recover your configuration. While it is possible to further troubleshoot and repair this installation, I'm afraid it could be rather time intensive since the process can be some trial and error.

Can I instead offer to help you get setup with a new installation?

I can help you either move configuration to an external dataset now or transfer it directly to a new installation.

I was reading through the Home Assistant beta release notes for version 2022.4 and they are adding a backup function to Home Assistant CORE - Not much details yet but I'm hoping there will be a web based restore method provided. This could potentially eliminate the need for using an external dataset.

EDIT: Just tested a clean install of the plugin does complete without issue. I updated to the beta release to have a look at the backup integration. So far it just creates a backup and allows you to easily download it from the Home Assistant UI - Maybe an upload function will come in a future release but nothing there now. It's still possible to upload files using the file editor though.

Is it worth starting a discussion about trying to add some sort of restore function ourselves. Or do we just have some commands to copy and paste in the terminal to manually restore?

@aliekiddo
Copy link

aliekiddo commented Apr 1, 2022

Thank you @tprelog and yes please.
I figured a reinstall would be on the cards but spent a bit of time trying to see if there was anything else I could do.

I tried updating Python and reinstalling Home Assistant with the lines above but It kept saying it didn't recognise the command 'homeassistant' after the failed plugin update.

I tried to restore from several different snapshots but it that didn't seem to do anything, after it was done it didn't roll back to 2021.3.4.

I tried following this installation guide to reinstall but I kept coming up against errors.
ERROR: Failed building wheel for cryptography

I've tried a couple of times to install a new HA plugin but it's got stuck at 50% and said the jail was corrupt.
A search on this error came up with running
iocage clean -a
but I'm not 100% sure if this is safe to do

@tprelog tprelog closed this as completed Jul 18, 2022
@tprelog tprelog unpinned this issue Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants