Skip to content

Use /var/lib/homeassistant as Supervisor data directory #397

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

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

agners
Copy link
Member

@agners agners commented Feb 25, 2025

Instead of using /usr/share/hassio use /var/lib/homeassistant as Supervisor data directory. While the Supervisor data directory is a mixed bag of user and somewhat static files, /var/lib seems the better fit than /usr/local.

Fixes: #393

Instead of using /usr/share/hassio use /var/lib/homeassistant as
Supervisor data directory. While the Supervisor data directory is a
mixed bag of user and somewhat static files, /var/lib seems the better
fit than /usr/local.

Fixes: #393
@ikifar2012
Copy link
Member

@agners while I do agree with this change I noticed when upgrading on a fresh machine created today from the previous version it does not retain any data. Do you think we should handle migration or just warn the user? I am a bit afraid of handling the migration automatically as we don't know how every user could have their system configured but I also think users really need to be made aware of the changes as it could result in panic if their configuration is gone

@agners
Copy link
Member Author

agners commented Feb 26, 2025

@agners while I do agree with this change I noticed when upgrading on a fresh machine created today from the previous version it does not retain any data. Do you think we should handle migration or just warn the user? I am a bit afraid of handling the migration automatically as we don't know how every user could have their system configured but I also think users really need to be made aware of the changes as it could result in panic if their configuration is gone

Uh I see, we overwrite the config unconditional, so if the user does not set an explicit DATA_SHARE environment variable, it will default to the new location even on upgrade.

That was not my intention. Fixed it now by reading the json config file if it is present. Right now, even if the user provides a DATA_SHARE, we'll retain the old value. I think if the user wants to move the data directory, he'd have to manually move the data and adjust the config afterwards.

@ikifar2012
Copy link
Member

@agners while I do agree with this change I noticed when upgrading on a fresh machine created today from the previous version it does not retain any data. Do you think we should handle migration or just warn the user? I am a bit afraid of handling the migration automatically as we don't know how every user could have their system configured but I also think users really need to be made aware of the changes as it could result in panic if their configuration is gone

Uh I see, we overwrite the config unconditional, so if the user does not set an explicit DATA_SHARE environment variable, it will default to the new location even on upgrade.

That was not my intention. Fixed it now by reading the json config file if it is present. Right now, even if the user provides a DATA_SHARE, we'll retain the old value. I think if the user wants to move the data directory, he'd have to manually move the data and adjust the config afterwards.

Awesome, just tested, works great... I'm gonna merge!

@ikifar2012 ikifar2012 merged commit 467befc into main Mar 5, 2025
2 checks passed
@ikifar2012 ikifar2012 deleted the use-var-lib-homeassistant-as-data-dir branch March 5, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Report: Violation of FHS by storing variable data under /usr/share?
2 participants