[GH-ISSUE #959] Upgrade to 2.8: service can't start, "attempt to write a readonly database" #673

Closed
opened 2026-05-07 00:26:30 +02:00 by BreizhHardware · 2 comments

Originally created by @maxhac03 on GitHub (Nov 24, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/959

🐞 Describe the bug
Upgrade from 2.7 to 2.8 with "apt upgrade ntfy" break the service.

💻 Components impacted
Ubuntu 22.04.3
VM dedicated to NTFY.

💡 Screenshots and/or logs
{"time":"2023-11-24T03:08:01.973Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"}
{"time":"2023-11-24T03:08:01.973Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1}
{"time":"2023-11-24T03:08:02.304Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"}
{"time":"2023-11-24T03:08:02.306Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1}
{"time":"2023-11-24T03:08:02.549Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"}
{"time":"2023-11-24T03:08:02.549Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1}
{"time":"2023-11-24T03:08:02.823Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"}
{"time":"2023-11-24T03:08:02.823Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1}
{"time":"2023-11-24T03:08:03.055Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"}
{"time":"2023-11-24T03:08:03.055Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1}

🔮 Additional context
ntfy_comandline.txt

Originally created by @maxhac03 on GitHub (Nov 24, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/959 :lady_beetle: **Describe the bug** Upgrade from 2.7 to 2.8 with "apt upgrade ntfy" break the service. :computer: **Components impacted** Ubuntu 22.04.3 VM dedicated to NTFY. :bulb: **Screenshots and/or logs** {"time":"2023-11-24T03:08:01.973Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"} {"time":"2023-11-24T03:08:01.973Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1} {"time":"2023-11-24T03:08:02.304Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"} {"time":"2023-11-24T03:08:02.306Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1} {"time":"2023-11-24T03:08:02.549Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"} {"time":"2023-11-24T03:08:02.549Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1} {"time":"2023-11-24T03:08:02.823Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"} {"time":"2023-11-24T03:08:02.823Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1} {"time":"2023-11-24T03:08:03.055Z","level":"INFO","message":"Migrating user database schema: from 4 to 5","tag":"user_manager"} {"time":"2023-11-24T03:08:03.055Z","level":"FATAL","message":"attempt to write a readonly database","exit_code":1} :crystal_ball: **Additional context** [ntfy_comandline.txt](https://github.com/binwiederhier/ntfy/files/13454795/ntfy_comandline.txt)
BreizhHardware 2026-05-07 00:26:30 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@binwiederhier commented on GitHub (Nov 24, 2023):

That sounds like a permission issue to me: https://matthewsetter.com/sqlite-attempt-to-write-to-readonly-database/

Did you ever change the user database permissions? They should be ntfy:ntfy if you're running systemd, similar to this:

root@ntfy:~# ll /var/lib/ntfy/user.db
-rw-r--r-- 1 ntfy ntfy 1912832 Nov 24 11:43 /var/lib/ntfy/user.db
<!-- gh-comment-id:1825562928 --> @binwiederhier commented on GitHub (Nov 24, 2023): That sounds like a permission issue to me: https://matthewsetter.com/sqlite-attempt-to-write-to-readonly-database/ Did you ever change the user database permissions? They should be `ntfy:ntfy` if you're running systemd, similar to this: ``` root@ntfy:~# ll /var/lib/ntfy/user.db -rw-r--r-- 1 ntfy ntfy 1912832 Nov 24 11:43 /var/lib/ntfy/user.db ```
Author
Owner

@maxhac03 commented on GitHub (Nov 24, 2023):

-rw-r--r-- 1 root root 77824 Aug 31 14:33 /var/lib/ntfy/user.db

This was indeed the issue. After fixing the permission the upgrade worked.

Thanks!

<!-- gh-comment-id:1825589581 --> @maxhac03 commented on GitHub (Nov 24, 2023): -rw-r--r-- 1 root root 77824 Aug 31 14:33 /var/lib/ntfy/user.db This was indeed the issue. After fixing the permission the upgrade worked. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#673
No description provided.