Closed tesfabpel closed 9 months ago
I don't have a lot of experience with flatpak or the flatpak community repository of QOwnNotes. Does the flatpak even have permissions to write to /run/user/1000/doc/ff2a565b/Notes
? What happens if you set your note folder to somewhere in your home directory?
Otherwise, best open an issue directly on https://github.com/flathub/org.qownnotes.QOwnNotes/issues.
Oh, yes it does have permission to write there as the notes you see in the output of ls
were created inside the app (and the notes.sqlite
file is recreated by the app.
The weird path is because the app doesn't have permissions to write everywhere (it can be set via the app's manifest) and when you click the Select Folder on QOwnNotes to choose the notes directory, a portal gets used to ask the user to pick a directory, giving the app permission to use it. The real path is instead /mnt/CommonExtraLinuxFiles/DATASTORE/Documents/Notes/
.
This is similar to mobile OSes like Android: the app asks the user to select a directory (or file) via OS' APIs and then the app is given access to it when the user agrees...
Anyway, I can try to give explicit access to the directory via flatpak (or FlatSeal, an app to manage permissions) to check if the issue is still present when using the real path (without having to go through the flatpak's documents portal) or to change the path to a different one.
I will report my findings and in case the issue isn't directly attributable to QOwnNotes I will open the bug issue to the flatpak repo's GitHub...
BTW, this is the output of flatpak documents
:
$ flatpak documents --columns=all org.qownnotes.QOwnNotes
ID Path Origin Application Permissions
ff2a565b /run/user/1000/doc/ff2a565b/Notes /mnt/CommonExtraLinuxFiles/DATASTORE/Documents/Notes org.qownnotes.QOwnNotes read write grant-permissions
Yes, best open an issue on https://github.com/flathub/org.qownnotes.QOwnNotes/issues.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Using the flatpak version (QOwnNotes - version 23.11.1 - GitHub - build 1062), trying to open the app, it greets me with the message: "Unable to establish a database connection with file '/run/user/1000/doc/ff2a565b/Notes/notes.sqlite'. Are the folder and the file writeable?"
After searching through the code, it seems it's displayed here: https://github.com/pbek/QOwnNotes/blob/cceb3370c333dc0d70f4dd1dcefc426107b9deb1/src/services/databaseservice.cpp#L142
Entering the flatpak environment with
flatpak enter org.qownnotes.QOwnNotes bash
, and issuing the commandls -al /run/user/1000/doc/ff2a565b/Notes/
it reports:So the file is indeed writable.
Issuing the command
file /run/user/1000/doc/ff2a565b/Notes/notes.sqlite
it says:So I tried to delete the file and run the app again and no message were shown this time and the file was recreated (but still empty).
Closing the app, and restarting it, the message reappeared...
Does Qt SQL gets mad that the .sqlite is empty, expecting at least a schema inside (while with the file missing it just creates a new one)?
Expected behaviour
No message appears when starting the app.
Actual behaviour
A ciritical message "Unable to establish a database connection with file '/run/user/1000/doc/ff2a565b/Notes/notes.sqlite'. Are the folder and the file writeable?" appears when starting the app but then it continues seemingly fine (didn't test all the features) but I can edit and create new notes...
Steps to reproduce
Output from the debug section in the settings dialog
Expand
QOwnNotes Debug Information =========================== ## General Info **Current Date**: `sab nov 11 09:51:35 2023` **Version**: `23.11.1` **Build date**: `Nov 10 2023` **Build number**: `1062` **Platform**: `linux` **Operating System**: `KDE Flatpak runtime` **Build architecture**: `x86_64` **Current architecture**: `x86_64` **Release**: `GitHub` **Qt Version (build)**: `5.15.10` **Qt Version (runtime)**: `5.15.10` **Portable mode**: `no` **Settings path / key**: `/home/tesx/.var/app/org.qownnotes.QOwnNotes/config/PBE/QOwnNotes.conf` **Application database path**: `/home/tesx/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/QOwnNotes.sqlite` **Application arguments**: `QOwnNotes` **Qt Debug**: `0` **Locale (system)**: `it_IT` **Locale (interface)**: *empty* **Primary screen resolution**: `1920x1080` **Icon theme**: `breeze` **Notes in current note folder**: `5` **Calendar items**: `0` **Enabled scripts**: `0` ## Server Info **serverUrl**: *empty* **appIsValid**: `yes` **notesPathExists**: *empty* **serverVersion**: *empty* **appVersion**: *empty* ## Spellchecking **Enabled**: `true` **Selected language**: `auto` **Language codes**: `en_AU, en_BS, en_BZ, en_CA, en_GB, en_GH, en_IE, en_IN, en_JM, en_MW, en_NA, en_NZ, en_PH, en_TT, en_US, en_ZA, en_ZW, it_IT` **Language names**: `Australian English (Australia), English (Bahamas), English (Belize), Canadian English (Canada), British English (United Kingdom), English (Ghana), English (Ireland), English (India), English (Jamaica), English (Malawi), English (Namibia), English (New Zealand), English (Philippines), English (Trinidad & Tobago), American English (United States), English (South Africa), English (Zimbabwe), italiano (Italia)` **Application dictionaries path**: `/home/tesx/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/dicts` ## Note folders **currentNoteFolderId**: `1` ### Note folder `default` **id**: `1` **isCurrent**: `yes` **activeTagId**: `0` **localPath**: `/run/user/1000/doc/ff2a565b/Notes` **remotePath**: `Notes` **cloudConnectionId**: `1` **isShowSubfolders**: `no` **isUseGit**: `no` **allowDifferentNoteFileName**: `no` **activeNoteSubFolder name**: *empty* **database file**: `/run/user/1000/doc/ff2a565b/Notes/notes.sqlite` ## Cloud connections ### Cloud connection `Predefinito` **id**: `1` **isCurrent**: `yes` **serverUrl**: *empty* **username**: *empty* **accountId**: *empty* ## Enabled scripts ## Settings **AboutDialog/geometry** (QByteArray): `Relevant log output in the Log panel
Expand
``` [09:52:59] [warning] QSqlDatabasePrivate::database: unable to open database: "unable to open database file Errore di apertura del database" [09:52:59] [warning] QSqlQuery::prepare: database not open [09:52:59] [warning] fetch : QSqlError("", "Impossibile ottenere la riga", "Nessuna query") ``` Translated by me: ``` [09:52:59] [warning] QSqlDatabasePrivate::database: unable to open database: "unable to open database file Error opening database" [09:52:59] [warning] QSqlQuery::prepare: database not open [09:52:59] [warning] fetch : QSqlError("", "Can't fetch the row", "No query") ```