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

Ntfy server is impossible to set up on NixOS 23.11 #1070

Closed
KaiserCalm opened this issue Mar 26, 2024 · 1 comment
Closed

Ntfy server is impossible to set up on NixOS 23.11 #1070

KaiserCalm opened this issue Mar 26, 2024 · 1 comment
Labels
🪲 bug Something isn't working

Comments

@KaiserCalm
Copy link

🐞 Describe the bug
When installing ntfy-sh by enabling it as a module, the state directory is created in /var/lib/private/ntfy-sh and linked to /var/lib/ntfy-sh. This is a problem as the private folder is owned by root which makes the symlink inaccessible. Changing the permissions of the private folder seems to create other problems as ntfy-sh requests the folder be owned by root with permissions 0700 and that makes this problem a Catch-22 as by default ntfy-sh can't access the files in it's state folder and if permissions are changed, ntfy-sh does not want to access it's folder.

💻 Components impacted
ntfy server v2.8.0

💡 Screenshots and/or logs
Default:

× ntfy-sh.service - Push notifications server
     Loaded: loaded (/etc/systemd/system/ntfy-sh.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-03-26 21:07:07 EET; 1s ago
   Duration: 71ms
    Process: 11056 ExecStart=/nix/store/wgb20j6kkxz0j6d5ihmn9g29giqx6wmp-ntfy-sh-2.8.0/bin/ntfy serve -c /nix/store/ma711yry2gs6s8vsnrah1cy9fx0iipdv-server.yml (code=exited, status=1/FAILURE)
   Main PID: 11056 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 69ms

Mar 26 21:07:07 server systemd[1]: Started Push notifications server.
Mar 26 21:07:07 server ntfy[11056]: 2024/03/26 21:07:07 FATAL attempt to write a readonly database (exit_code=1)
Mar 26 21:07:07 server ntfy[11056]: attempt to write a readonly database
Mar 26 21:07:07 server systemd[1]: ntfy-sh.service: Main process exited, code=exited, status=1/FAILURE
Mar 26 21:07:07 server systemd[1]: ntfy-sh.service: Failed with result 'exit-code'.

Too permissive:

× ntfy-sh.service - Push notifications server
     Loaded: loaded (/etc/systemd/system/ntfy-sh.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-03-26 21:03:03 EET; 1s ago
   Duration: 2ms
    Process: 8743 ExecStart=/nix/store/wgb20j6kkxz0j6d5ihmn9g29giqx6wmp-ntfy-sh-2.8.0/bin/ntfy serve -c /nix/store/ma711yry2gs6s8vsnrah1cy9fx0iipdv-server.yml (code=exited, status=238/STATE_DIRECTORY)
   Main PID: 8743 (code=exited, status=238/STATE_DIRECTORY)
         IP: 0B in, 0B out
        CPU: 882us

Mar 26 21:03:03 server systemd[1]: Started Push notifications server.
Mar 26 21:03:03 server (ntfy)[8743]: Directory "/var/lib/private" already exists, but has mode 0750 that is too permissive (0700 was requested), refusing.
Mar 26 21:03:03 server (ntfy)[8743]: ntfy-sh.service: Failed to set up special execution directory in /var/lib: File exists
Mar 26 21:03:03 server (ntfy)[8743]: ntfy-sh.service: Failed at step STATE_DIRECTORY spawning /nix/store/wgb20j6kkxz0j6d5ihmn9g29giqx6wmp-ntfy-sh-2.8.0/bin/ntfy: File exists
Mar 26 21:03:03 server systemd[1]: ntfy-sh.service: Main process exited, code=exited, status=238/STATE_DIRECTORY
Mar 26 21:03:03 server systemd[1]: ntfy-sh.service: Failed with result 'exit-code'.

Wrong User:

× ntfy-sh.service - Push notifications server
     Loaded: loaded (/etc/systemd/system/ntfy-sh.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-03-26 21:04:50 EET; 1s ago
   Duration: 3ms
    Process: 9917 ExecStart=/nix/store/wgb20j6kkxz0j6d5ihmn9g29giqx6wmp-ntfy-sh-2.8.0/bin/ntfy serve -c /nix/store/ma711yry2gs6s8vsnrah1cy9fx0iipdv-server.yml (code=exited, status=238/STATE_DIRECTORY)
   Main PID: 9917 (code=exited, status=238/STATE_DIRECTORY)
         IP: 0B in, 0B out
        CPU: 922us

Mar 26 21:04:50 server systemd[1]: Started Push notifications server.
Mar 26 21:04:50 server (ntfy)[9917]: Directory "/var/lib/private" already exists, but is owned by 989:986 (0:0 was requested), refusing.
Mar 26 21:04:50 server (ntfy)[9917]: ntfy-sh.service: Failed to set up special execution directory in /var/lib: File exists
Mar 26 21:04:50 server (ntfy)[9917]: ntfy-sh.service: Failed at step STATE_DIRECTORY spawning /nix/store/wgb20j6kkxz0j6d5ihmn9g29giqx6wmp-ntfy-sh-2.8.0/bin/ntfy: File exists
Mar 26 21:04:50 server systemd[1]: ntfy-sh.service: Main process exited, code=exited, status=238/STATE_DIRECTORY
Mar 26 21:04:50 server systemd[1]: ntfy-sh.service: Failed with result 'exit-code'.
@KaiserCalm KaiserCalm added the 🪲 bug Something isn't working label Mar 26, 2024
@binwiederhier
Copy link
Owner

The Nix package is linked in the install instructions, but not officially maintained by us. See #462 - You may want to reach out to @wamserma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants