![]() |
#31 | |||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 989
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
|
Quote:
Quote:
Quote:
JSwolf suggested looking for the WAL files from nickelmenu before plugging in USB, which is on the right track, but as usual, dead wrong. The problem is that as long as the kobo is in its GUI and not in usb mode, the database is open, so it will always be open then. Similarly, once calibre has detected the device, the driver opens the database, and then it's too late to check. What we need is the driver itself, before opening the database, to check for the wal files and then refuse to open the device until it is rebooted... but even I might be off base there, because maybe it already does that and that's still not enough. Maybe the issue is that the kobo OS has the database open but the wal file only exists in cache memory and hasn't been written to disk yet, so the OS calibre is in doesn't see it. And then to make matters worse, calibre scribbles on the database, but the kobo OS still has the cached blocks in memory it wrote, which are now out of date, and it writes them back anyway, so now you have a database with a few old blocks written to it from before the USB mode was activated and a few blocks from calibre that were written while in USB mode, and it's all mixed up and corrupt... If you reboot before doing all this, it doesn't happen. If you don't reboot, then the kobo might keep cached blocks from before calibre wrote the database, and things might look ok for a while but the copy of the database blocks on disk and in kobo memory might not be in sync. If you reboot afterwards, then the kobo memory is cleared and database blocks in memory will be fully in sync, corrupt or not. So rebooting afterwards might look like it helps but it doesn't actually prevent corruption, because it's probably too late. I think sometimes the kobo devices have bad ram in them which gets bit flips and then the kobo starts acting strange... and in those cases, rebooting helps a lot. Last edited by compurandom; 01-25-2025 at 07:21 PM. |
|||
![]() |
![]() |
![]() |
#32 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43,455
Karma: 165170834
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
From the documentation, the -wal and -shm files are written to disk and not stored in memory. The problem is that they have to be written to the database before the database is closed though the SQLite code seems to handle the database not being properly closed so the -wal and -shm files will be merged when the database is re-opened unless the database has been hooped in the meantime. Last edited by DNSB; 01-25-2025 at 07:23 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#33 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,467
Karma: 142993686
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
How about a plugin for calibre that runs before anything else runs that checks if the database is closed. Would that help to not have to reboot before every connection to the computer?
|
![]() |
![]() |
![]() |
#34 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,138
Karma: 78857258
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Jon; as soon as the USB cable is connected and the option selected to mount the drive to the host, if the database was open, corruption will occur. This is regardless of whether or not calibre or any program on the host has accessed the drive.
|
![]() |
![]() |
![]() |
#35 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43,455
Karma: 165170834
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Not quite right, Peter. What I found is if as soon as the database corrupt message shows up, I closed calibre and then safely ejected my Kobo, the database was not corrupted. I did use a reboot to force the database to close before trying to reconnect.
I suppose you could mount your Kobo, look at the .kobo directory and then safely eject and reboot if sqlite-wal/sqlite-shm files are present. If not, run calibre as usual. I played with several ideas when my Sage was running firmware that was prone to database corruption and found a simple reboot before connecting was safer and faster than connecting, checking for the journal files and ejecting and rebooting if the journal files were present. |
![]() |
![]() |
Advert | |
|
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
calibre corrupt error corrupt error database disk image is malformed | didu812 | Calibre | 50 | 04-10-2024 08:51 AM |
Database corrupt, what can I do? | elstupid | Calibre | 7 | 05-14-2023 03:24 PM |
Aura HD Corrupt database? | patrik | Kobo Reader | 34 | 01-13-2014 02:10 AM |
Database corrupt | mwerth1 | Calibre | 4 | 08-07-2012 07:31 PM |
Corrupt database | jjansen | Calibre | 4 | 10-26-2011 11:51 PM |