Closed csoltenborn closed 3 years ago
That is what I did @csoltenborn Deployed a new plugin on 12.1, then migrated config over, was definitely faster ;-)
@atxbyea Thanks for letting me know :-)
As I said, I'm rather new to HA - would you mind to confirm the following steps?
/home/homeassistant
directoryHi @csoltenborn
atxbyea is correct. If spending more than 15-20 minutes trouble shooting a broken plugin, it should be quicker to just reinstall. Although you are the first person to report pkg-static update -f
then pkg-static upgrade -f
did not work. One person has reported using Plugin > UPDATE after upgrading the jail. In that case, the virtualenv was ale to be rebuilt.
In my opinion, this highlights the biggest downfall using plugins on TrueNAS. That is to say, there is not a simple way to store the configuration directories to a separate dataset.
would you mind to confirm the following steps?
That is correct.
Just to be safe, you can export the existing plugin before it's destroyed. This will create a zip backup of the entire jail, I know the jail is broke but it will still contain the HA configuration.
Thinking about this now, it might be the perfect time to create an external dataset :wink:
There's a few ways to configure this - I think this a relatively easy approach. If you're already familiar with TrueNAS, I assume you can make adjustments as needed.
homeassistant
uses with a UID of 8123
(optional, set the config dataset as home directory)homeassistant
and RW access/home/homeassistant
directory to the new dataset/home/homeassistant
directory (we need an empty directory to mount external dataset)home/homeassistant
I'm gonna try to write these steps with little more detail and add to the wiki over this weekend. It you already reinstalled the plugin, you can still add the external dataset following the steps above, just skip steps 5 and 6.
Oops - that's my inexperience with HA. I spent more like a couple of hours :-)
Your approach of separating config and installation makes a lot of sense to me - I will in fact try this right now and let you know about the result.
4. contents of
/home/homeassistant
Is that directory the only place where HA config is stored?
Short answer is YES
Long answer is still YES but technically (to be more exact)
Home Assistant config - /home/homeassistant/homeassistant
If installed using the console menu
Configurator (File Editor) config - /home/homeassistant/configurator
AppDaemon config - /home/homeassistant/appdaemon
Also to note for anyone who installed this plugin before August 2020 - The previous username was hass
.
In this case /home/hass
would contain the HA config as laid out above
Worked like a charm. The only "drawback" when assigning the config dataset to the homeassistant user as home directory is that the dir will then contain a couple of other files, which confused me for a second since I'm a Windows user ;-)
Edit: I just noted that the File Editor now allows to navigate the jail's complete file structure - as far as I remember, I could not go beyond the home/homeassistant
directory before.
It seems that when there is the needed to destroy/recreate the jail once more, the only thing needed is to re-add the mount point - might that be a candidate for the plug-in? It might ask for a config directory during installation, or might offer to create that mount point from the shell service menu... Let me know whether I shall create a feature request (I guess most of the steps could be automated by the plug-in).
Thanks, @atxbyea and @tprelog! Issue can be closed from my point of view...
It seems that when there is the needed to destroy/recreate the jail once more, the only thing needed is to re-add the mount point
Yes, step 5-11 anytime you need to reinstall the plugin. Your configuration is now safely separated from the jail.
might that be a candidate for the plug-in? It might ask for a config directory during installation, or might offer to create that mount point from the shell service menu
https://github.com/ix-plugin-hub/iocage-plugin-index/issues/120
The only "drawback" when assigning the config dataset to the homeassistant user as home directory is that the dir will then contain a couple of other files, which confused me for a second since I'm a Windows user
I'll add these details in the wiki page but briefly, the homeassistant
user created on TrueNAS can optionally be used to validate access to a samba share but the shell can still be set to nologin
. Also most of the extra files can be deleted.
Assuming you have installed all 3 services, these are the 4 directories you should keep
.cache
appdaemon
configurator
homeassistant
Unless you have created any extra files yourself anything beyond the above list can safely be deleted.
Also to access the HA config via samba share from windows have a look at this overview
If you're following along with the link - You should create the share path pointing directly to the external dataset (do not point it to the directory inside the jail)
I see - taking care of the mount point feature from iocage obviously is preferable.
Thanks for pointing out the mandatory files - I have changed the user's shell config and removed the other files.
In fact, I already have a samba share for the HomeAssistant config - however, given HA's File Explorer extension (which, btw, I got to know from your tutorial at the HA forum, same for AppDaemon and HACS) I'm not even sure whether I will keep it...
Of course this has to be more complicated... I just realized that the TrueNAS UI does not create the homeassistant
user as I expected - To be more specific, when setting a specific UID for the user, the primary group is created with the next available GUID. It does NOT match the UID as expected.
root@truenas-vm[~]# id homeassistant
uid=8123(homeassistant) gid=1001(homeassistant) groups=1001(homeassistant),545(builtin_users)
If your accessing the share using the (TrueNAS) homeassistant
user, I guess this shouldn't really cause any serious issues but IMO, I would prefer both UID and GUID are correctly set to match the homeassistant
account inside the jail
I'll address how to avoid (and correct) this in wiki
The wiki page is started - If you have a minute, please provide any feed back or suggestions
https://github.com/tprelog/iocage-homeassistant/wiki/external_dataset_and_samba
I will close this issue when the wiki page it is more complete
Some comments on the Wiki page:
homeassistant
user's primary group to that group and remove the old one. Correct?I have not created the Samba share, thus I can't comment too much on that one. I have still read it, and it looks good to me.
Thanks once more for the great explanations!
Great Wiki, many thanks! I have one question, not sure if it was answered there or here:
Thank you for looking!
- First paragraph: I would explicitly point to the "destroy/reinstall instead of update" scenario (but that might just be me ;-) )
I agree. I think I'm also going to split creating the SMB share to a separate page. The dataset will be recommended for everyone. The SMB is optional. Moving forward, I will only cover creating a SMB using the dataset. (Only in case of emergency, creating the share inside the jail will be mentioned)
Would approach to install the HA plugin and mount the config dataset be a recommended approach to any HA version upgrade? Or you would rather recommend it only when major upgrades of TrueNAS are performed?
Moving the config to an external dataset will be suggested, recommend and encouraged for everybody. The initial steps to setup and move the config, will only need to preformed once.
I will recommend reinstalling the plugin to everyone who has upgraded from FreeNAS, even people who have already upgraded successfully. Moving forward, I will recommend a full reinstall on a case by case basis (this relates to the "plugin")
Don't tell anyone, Version 5 in progress :speak_no_evil:
HA version upgrade?
Not likely, maybe only when the supported version of Python changes.
The "how to correct wrong id of group" part is not yet contained, but might not be needed (since your instructions prevent this problem). For me, I would now create the group as described and then switch the homeassistant user's primary group to that group and remove the old one. Correct?
If you are able to just delete and recreate the group with the correct 8123
GID then yes.
Otherwise, at this point it is also safe to delete BOTH the homeassistant
user and group from TrueNAS, then re-add them as shown in the new wiki page. -- However, after more testing I think I'm going to recommend the homeassistant
user is created with following setting. Notice I am not setting a path to home and password login, samba authentication have been disabled.
On the page to the access the SMB, I will instruct to either A) add the homeassistant
group to your own existing user account. B) enable password login and samba authentication for the homeassistant
user
"Copy existing configuration": I in fact had the problem that some files did not have the correct permissions (already at the old place), which I then corrected after copying. Maybe it makes sense to mention that permissions should be checked either before or after copying.
I have included the commands under the final section Reset Permissions - but still needs brief explanation. As I understand, because we are copying the config while logged in as root
, everything should get copied regardless permissions. IMO, it makes the most sense to fix permissions after the config have been moved. Generally speaking, resetting the permissions should be safe for everyone, however,I should point certain files, for example, if you have any shell scripts, they will need to made executable again.
- Would approach to install the HA plugin and mount the config dataset be a recommended approach to any HA version upgrade? Or you would rather recommend it only when major upgrades of TrueNAS are performed?
I think this is the right idea :shrug: It's certainly better than the NA I provide now
starting with version 5, I'm gonna try something like this https://github.com/tprelog/iocage-homeassistant/wiki/temp_about_version
I've updated the plugin to version 5.
Please see the following for more information
I will close this issue when the wiki page it is more complete
The wiki should be updated to cover topics discussed here so I'm gonna close this now.
I've also found and and enabled a new discussion feature on this repository.
We can continue to discuss any ideas here without creating issues
-- Please open a new issue for version 5 if you have trouble with a reinstall
Hi,
first of all, thanks for the plugin and the excellent descriptions in the Wiki! :-)
I'm on TrueNAS 12.0, but my HA jail is still running 11.3 and 0.116.4, and updating the HA version results in the OpenSSL errors. Thus, I thought I'd upgrade the jail's OS first. I have tried 12.1 and 12.2, but running into the same error...
Here are my update steps:
The problem occurs at the
check_config
step: the installation ofPyNaCl
is failing with the following error:Afterwards, a couple of more packages are installed without issues, the last being
sqlalchemy
. Then, the script gets stuck and can only be canceled withCtrl-C
. I can then restart the jail, and HA starts, but the log contains a couple of errors, and some entities are broken. The errors:Apparently,
openssl
is involved into the problems - I guess that this will annoy the heck out of you, but I think I have to take that risk ;-)Any idea? Could setting up a new jail using the plugin an approach? Could I then just copy the contents of
/home/homeassistant
into the new jail, restart and be all set up? Sorry if this is a stupid question - I'm rather new to HA...