mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-10 00:08:52 +02:00
[GH-ISSUE #1276] "unable to open database: No such file or directory" #902
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#902
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @matthiasbeyer on GitHub (Feb 9, 2025).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1276
🐞 Describe the bug
I have issues setting up the software because it does not tell me what file or directory does not exist. All files that are configured via the configuration file do exist.
Would be very nice if the log output would tell what paths are affected, which would simplify debugging a log.
💻 Components impacted
ntfy server
💡 Screenshots and/or logs
🔮 Additional context
@matthiasbeyer commented on GitHub (Feb 9, 2025):
After
touching files asrootandchmod a+rwing them,ntfyfails with(strace output).
The path in question is
So I don't know why this fails.
@wunter8 commented on GitHub (Feb 9, 2025):
I agree that printing the path of the failed directory/file would be very helpful.
In general, you shouldn't need to create any files manually (e.g., via
touch). As long as ntfy can read/write in the directories you configured, it will create the files it needs.It looks like you're using systemd. Is it the default service file that comes with the ntfy package? If so, the ntfy server will run under the
ntfyuser instead ofroot. That doesn't make a difference for this particular file since it hasa+rw, but if all of the directories leading to this folder do not haveo+x, ntfy will not be able to read files in the folder.To test things, you can incrementally
lsas the ntfy user:sudo -u ntfy ls /varsudo -u ntfy ls /var/cachesudo -u ntfy ls /var/cache/ntfysudo -u ntfy ls /var/cache/ntfy/cache.db-journalOne (or more) will likely fail because the directory does not have
o+xpermissions@matthiasbeyer commented on GitHub (Feb 9, 2025):
Yes, its systemd. No, the service is generated via the nixos module system.
It runs under
ntfy-shuser and group.That said, I got it running. The issue was apparently that the nixos module configures the user/group not properly... either way the issue was definitively not on
ntfys side, but on nixos side.That being said, (and to help others that might stumble over this issue,) configuring the server with
sudo -u ntfy-sh ntfy user add(orntfy-shas user) does not work, probably because some systemd shenanigans that nixos introduces.Using root works tho and I successfully added my user and tokens.
All the above does not change the fact that the logging output of
ntfywas not helpful for debugging the issue at hand, and I would like to keep this open (or rather let you decide what is the proper way for the project workflow of course) until that is resolved.Thanks for your patience! ❤
@DestinyofYeet commented on GitHub (Feb 10, 2025):
For any other nixos user coming across this, here is some info:
The nixos module sets a few systemd options for example
ProtectSystem=fullandStateDirectory=ntfy-sh, so it doesn't allow access to anything other than/var/lib/ntfy-sh. Setting mycache-fileandattachement-cache-dirto start with/var/lib/ntfy-shfixed the issue for me.@crushndent commented on GitHub (Mar 1, 2025):
Same problem in a Docker container. Anytime ENV vars are set for AUTH_FILE or CACHE_FILE or CACHE_DIR. Not clear how to fix this. I persisted the volume and can't get it to stick when I set the AUTH_FILE. Not clear what is happening.
Too bad we can't just pass an ENV: TOKEN without making all this other stuff.
@hockeygoalie35 commented on GitHub (May 2, 2025):
Same issue here, when trying to enable
NTFY_CACHE_FILEin a docker .env file.@philipwilk commented on GitHub (May 19, 2025):
Alternatively, a more ideal solution, is to use
systemd.services.ntfy-sh.serviceConfig.ReadWritePaths, such thatSimilarly, for firebase-key-file you are likely to want to use
LoadCredential, such that@Math-Aumont commented on GitHub (Aug 6, 2025):
Just set up ntfy build from the source and same problem on FreeBSD with root ...
I can't create any user and I didn't find any workarround
for now I can't create or list users ....
/usr/local/sbin/ntfy serve --config /usr/local/etc/ntfy.yml --log-file /var/log/ntfy.log --debugConfig file :
/usr/local/etc/ntfy.ymlTrace mode
this is weird The trace clearly shows that it is able to read the file
"/var/db/ntfy/user.db@wunter8 commented on GitHub (Aug 6, 2025):
@Math-Aumont when you run any
ntfycommand as root (e.g.,ntfy serve ...,ntfy user ..., etc.), it will look for a config file in/etc/ntfy/server.yml. Since your config file is at/usr/local/etc/ntfy/ntfy.yml, thentfy usercommand is not finding it and using it. (I'm not sure why the trace is showing it accessing the DB file, unless that's a trace of thentfy servecommand, where you're providing a path to the config file)The solution is to provide a path to the config file for the
ntfy usercommand like you did for thentfy servecommand:ntfy user --config /usr/local/etc/ntfy/ntfy.yml list@Math-Aumont commented on GitHub (Aug 6, 2025):
Holy cow, thank you so much 🥇
I searched for hours without understanding what was wrong... I didn't realize for a moment that I had to provide the yaml configuration file when running the “user” command as well 🫢
BTW the trace was from the server side.
@matous-volf commented on GitHub (Sep 7, 2025):
For @DestinyofYeet, @crushndent or anyone encountering this issue with Docker: The following configuration works for me.
server.yml:
Dockerfile: