Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 01-25-2025, 07:03 PM   #31
compurandom
Guru
compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.compurandom ought to be getting tired of karma fortunes by now.
 
Posts: 989
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
Quote:
Originally Posted by LordP View Post
Guys, you are ALL missing the point.

JSwolf is going off the deep end, I think
I didn't miss the point, I ignored JSwolf. He's always off the deep end.

Quote:
Originally Posted by John F View Post
There was some version of Windows or Kobo that would report there was a "problem" when the reader was mounted by Windows.
That's for filesystem corruption, which probably accompanies database corruption, and for the same reason -- something kept it open, two operating systems trying to write to the same disk at the same time. So yes, wrong thing, right reason anyway.

Quote:
Originally Posted by DNSB View Post
What I also found was the if I got the database corrupted message and immediately ejected, the database will be closed which also merges the -wal and -shm file so the next connection will not show a corrupt database.
That's very valid but you gotta get lucky! You have to eject and reboot before anything else especially calibre starts scribbling on the database.

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.
compurandom is offline   Reply With Quote
Old 01-25-2025, 07:19 PM   #32
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 43,455
Karma: 165170834
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by compurandom View Post
That's very valid but you gotta get lucky! You have to eject and reboot before anything else especially calibre starts scribbling on the database.
As far as I can tell, as long as the message was on screen, calibre wasn't trying to write to the database. So as I said, close calibre immediately and eject the Kobo. I ran ~14 tests and did not get database corruption doing this. OTOH, it was simply easier to reboot my Kobo before connecting.


Quote:
Originally Posted by compurandom View Post
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.
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.
DNSB is offline   Reply With Quote
Advert
Old 01-30-2025, 03:00 PM   #33
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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?
JSWolf is offline   Reply With Quote
Old 01-30-2025, 04:07 PM   #34
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
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.
PeterT is offline   Reply With Quote
Old 01-30-2025, 07:47 PM   #35
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
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.
DNSB is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 05:35 PM.


MobileRead.com is a privately owned, operated and funded community.