hassio-addons: [Mealie] PermissionError: [Errno 13] Permission denied: '/config/addons_config/mealie_data/.secret'

Description

When trying to start mealie, I’m now getting this error. The last confirmed version that works for me is v1.0.0-RC. I started experiencing this issue today when I updated to v1.0.0.5. If I downgrade to v1.0.0, I get a different error where it repeats the following line:

Switching to dedicated user
usermod: no changes

On v1.0.0, if i change my uid/gid from 0 to 1000, I get the same error as I do on v1.0.0.5 and above. The full traceback is below:


        User uid:    1000
        User gid:    1000
        
Traceback (most recent call last):
  File "/app/mealie/db/init_db.py", line 10, in <module>
    from mealie.core import root_logger
  File "/app/mealie/core/root_logger.py", line 60, in <module>
    logger_config = get_logger_config()
  File "/app/mealie/core/root_logger.py", line 28, in get_logger_config
    settings = get_app_settings()
  File "/app/mealie/core/config.py", line 40, in get_app_settings
    return app_settings_constructor(env_file=ENV, production=PRODUCTION, data_dir=determine_data_dir())
  File "/app/mealie/core/settings/settings.py", line 190, in app_settings_constructor
    **{"SECRET": determine_secrets(data_dir, production)},
  File "/app/mealie/core/settings/settings.py", line 16, in determine_secrets
    if secrets_file.is_file():
  File "/usr/local/lib/python3.10/pathlib.py", line 1322, in is_file
    return S_ISREG(self.stat().st_mode)
  File "/usr/local/lib/python3.10/pathlib.py", line 1097, in stat
    return self._accessor.stat(self, follow_symlinks=follow_symlinks)
PermissionError: [Errno 13] Permission denied: '/config/addons_config/mealie_data/.secret'

Reproduction steps

bash

  1. Update to v1.0.0 or above
  2. Make sure UID/GID is not 0
  3. Start the add-on
  4. Error appears

Addon Logs

/etc/cont-init.d/00-banner.sh: executing

-----------------------------------------------------------
 Add-on: Mealie (Omni):
 Mealie is a self hosted recipe manager and meal planner built in Vue
-----------------------------------------------------------
 Add-on version: v1.0.0
 There is an update available for this add-on!
 Latest add-on version: v1.0.0-7
 Please consider upgrading as soon as possible.
 System: Home Assistant OS 11.4  (amd64 / qemux86-64)
 Home Assistant Core: 2024.1.5
 Home Assistant Supervisor: 2023.12.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='false'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='true'
Timezone set from Etc/UTC to America/New_York
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/addons_config/mealie/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /homeassistant/addons_config/mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /homeassistant/addons_config/mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[16:21:15] INFO: Exporting variables
ALLOW_SIGNUP=false
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=true
[16:21:18] INFO: config.yaml found in /config/addons_config/mealie/config.yaml, exporting variables
Permissions adapted
[16:21:18] INFO: Starting nginx
[16:21:18] INFO: Starting app
Switching to dedicated user

        User uid:    1000
        User gid:    1000
        
Traceback (most recent call last):
  File "/app/mealie/db/init_db.py", line 10, in <module>
    from mealie.core import root_logger
  File "/app/mealie/core/root_logger.py", line 60, in <module>
    logger_config = get_logger_config()
  File "/app/mealie/core/root_logger.py", line 28, in get_logger_config
    settings = get_app_settings()
  File "/app/mealie/core/config.py", line 40, in get_app_settings
    return app_settings_constructor(env_file=ENV, production=PRODUCTION, data_dir=determine_data_dir())
  File "/app/mealie/core/settings/settings.py", line 190, in app_settings_constructor
    **{"SECRET": determine_secrets(data_dir, production)},
  File "/app/mealie/core/settings/settings.py", line 16, in determine_secrets
    if secrets_file.is_file():
  File "/usr/local/lib/python3.10/pathlib.py", line 1322, in is_file
    return S_ISREG(self.stat().st_mode)
  File "/usr/local/lib/python3.10/pathlib.py", line 1097, in stat
    return self._accessor.stat(self, follow_symlinks=follow_symlinks)
PermissionError: [Errno 13] Permission denied: '/config/addons_config/mealie_data/.secret'

Architecture

amd64

OS

HAos, Virtual Machine

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve updated to the latest version as of this post, but the error message doesn’t appear any different. Here’s the log from version 1.0.0-9_test

-----------------------------------------------------------

 Add-on: Mealie
 Mealie is a self hosted recipe manager and meal planner built in Vue
-----------------------------------------------------------
 Add-on version: v1.0.0-9_test
 You are running the latest version of this add-on.
 System: Home Assistant OS 11.4  (amd64 / qemux86-64)
 Home Assistant Core: 2024.1.5
 Home Assistant Supervisor: 2023.12.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='false'
DATA_DIR='/config/addons_config/mealie_data'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='true'
Timezone set from Etc/UTC to America/New_York
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/addons_config/mealie/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /homeassistant/addons_config/mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /homeassistant/addons_config/mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[05:04:10] INFO: Exporting variables
ALLOW_SIGNUP=false
DATA_DIR=/config/addons_config/mealie_data
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=true
[05:04:13] INFO: Checking user type
[05:04:13] INFO: config.yaml found in /config/addons_config/mealie/config.yaml, exporting variables
.secret file is existing
Permissions adapted
[05:04:13] INFO: Starting nginx
[05:04:13] INFO: Starting app
2024/01/26 05:04:15 [error] 369#369: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4", host: "url"
[26/Jan/2024:05:04:15 -0500] 502 -(192.168.1.26) GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
2024/01/26 05:04:15 [error] 368#368: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc", host: "url"
[26/Jan/2024:05:04:15 -0500] 502 -(192.168.1.26) GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
2024/01/26 05:04:20 [error] 370#370: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4", host: "url"
[26/Jan/2024:05:04:20 -0500] 502 -(192.168.1.26) GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
2024/01/26 05:04:21 [error] 371#371: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc", host: "url"
[26/Jan/2024:05:04:21 -0500] 502 -(192.168.1.26) GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
2024/01/26 05:04:51 [error] 368#368: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4", host: "url"
[26/Jan/2024:05:04:51 -0500] 502 -(192.168.1.26) GET /api/groups/shopping/lists/5fc1e02b-cace-47b9-9d1e-1446566b6cd4 HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
2024/01/26 05:04:51 [error] 368#368: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.26, server: db21ed7f-mealie, request: "GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1", upstream: "http://127.0.0.1:9000/api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc", host: "url"
[26/Jan/2024:05:04:51 -0500] 502 -(192.168.1.26) GET /api/groups/mealplans?start_date=2024-01-25&page=1&perPage=50&orderBy=created_at&orderDirection=desc HTTP/1.1 (HomeAssistant/2024.1.5 httpx/0.26.0 Python/3.11)
Switching to dedicated user

        User uid:    1000
        User gid:    1000
        
Traceback (most recent call last):
  File "/app/mealie/db/init_db.py", line 10, in <module>
    from mealie.core import root_logger
  File "/app/mealie/core/root_logger.py", line 60, in <module>
    logger_config = get_logger_config()
  File "/app/mealie/core/root_logger.py", line 28, in get_logger_config
    settings = get_app_settings()
  File "/app/mealie/core/config.py", line 40, in get_app_settings
    return app_settings_constructor(env_file=ENV, production=PRODUCTION, data_dir=determine_data_dir())
  File "/app/mealie/core/settings/settings.py", line 190, in app_settings_constructor
    **{"SECRET": determine_secrets(data_dir, production)},
  File "/app/mealie/core/settings/settings.py", line 16, in determine_secrets
    if secrets_file.is_file():
  File "/usr/local/lib/python3.10/pathlib.py", line 1322, in is_file
    return S_ISREG(self.stat().st_mode)
  File "/usr/local/lib/python3.10/pathlib.py", line 1097, in stat
    return self._accessor.stat(self, follow_symlinks=follow_symlinks)
PermissionError: [Errno 13] Permission denied: '/config/addons_config/mealie_data/.secret'```

mmh I can’t find a way to replicate the error, even when chmodding .secret to another user, changing permissions… I’ll try to push again a version that will make a specific debug message on the file