"Database Disk Image is malformed" when connecting to Calibre after adding new books

I keep getting errors in Calibre when trying to add books to the Kobo.

I tried to add a bunch of new books and a couple were having problems (badly formed epubs I think), so I deleted the iffy books from Calibre, after much trying, testing and head-scratching I found the only way to get the Kobo working again was to manually delete all books from the Kobo then do the SQL database replacement referred to in the sticky.

This is the 3rd time in the last 24 hours I have had to wipe and start again. I replace the SQL database, start adding my books 100 at a time (or 50 at a time, or 20 at a time, doesn't seem to matter) and then disconnect the device to let it process the new content, then I go back and add some more books etc etc.

Eventually, some times after almost all the books are loaded, sometimes after less than half are loaded, I will reconnect the device to add more books after the last lot were processed successfully by the Kobo and Calibre will give me an error saying it cannot connect to the device and the details show it as a "database disk image is malformed" error.

From my checking it looks like either Calibre or (more likely) the Kobo is creating a corrupted file in the .kobo/images folder.

At this point if I disconnect the Kobo it might work fine, but will no longer connect to Calibre to load new books or it is toast, it won't start and I have to go back and wipe all the books from it manually, let Windows do it's disk check (If I don't do this the corrupted file in the .kobo/images folder won't delete) then reload the SQL database and start again, even though it was working fine before I connected it to the PC.

Reloading your books manually (with a clean DB) would help diagnose whether the problem is with your Kobo or with Calibre, but if you're getting actual disk errors (not just a corrupted file) it's presumably a problem with the Kobo.

I do believe the underlying problem is with the Kobo not with Calibre despite the fact that the Borders app is not having any problem synching with the device.

Yesterday one time it happened I found that one of the image files was corrupt and I had to get Windows to scan the kobo and fix the file before I could delete it. This time I copied the whole .kobo\images folder to my desktop, batch renamed all the files from .parsed to .jpg in the hope that I could check the preview to see if one was corrupted, but all of them look fine.

I will try loading some books by drag-and-drop and see what that does.

So I loaded some books manually and the Kobo went through it's "processing new content" procedure for about as long as I would expect for that amount of books to take but once it was finished none of the new books showed up.

So I loaded some books manually and the Kobo went through it's "processing new content" procedure for about as long as I would expect for that amount of books to take but once it was finished none of the new books showed up.

Now up to wipe number 5 and getting frustrated.

I went through this a couple of nights ago. A real pain in the _ss.

I ended up deleting everything off the kobo drive and running windows chkdsk against it. I then replaced the contents of the drive, except I made sure the images directory was empty and made sure the sqllite db was not copied over. I then booted up the device and it had no titles (as the SD card was not inserted). I turned off the device, inserted the SD card then booted it back up. At that point, the db was rebuilt (which took quite a long time) and the device began to behave properly once more.

Before going through the procedure above, I spent a solid 2hrs trying a variety of different things.

I ended up deleting everything off the kobo drive and running windows chkdsk against it. I then replaced the contents of the drive, except I made sure the images directory was empty and made sure the sqllite db was not copied over. I then booted up the device and it had no titles (as the SD card was not inserted). I turned off the device, inserted the SD card then booted it back up. At that point, the db was rebuilt (which took quite a long time) and the device began to behave properly once more.

Before going through the procedure above, I spent a solid 2hrs trying a variety of different things.

Thanks for that, I have loaded almost half of my content since the last wipe with no issues yet (fingers are crossed) but if I get another fail I'm going to try your method.

From your post it seems you keep all your content on the SD card, I was thinking of doing this, do you find it makes the device any faster, slower or no difference when you keep the Kobo storage empty and store everything on the SD?

Sorry for the delay. I did not see this until late last night. The driver attempt to update the database with the books on the I'm Reading List or Finished list. If no books are on either list it sets all books to unread. The updates are fairly simple and should not result in the issues you are seeing.

From later responses it looks like you are having other issues with the device. Instead of doing the chkdsk I would be tempted to reformat that drive. That should clear up any file system issues.

However, you will need to make sure that you have a backup of any of the files that you want from the drive (like Desktop Installers). You should probably also deauthorize that device with Adobe Digital Editions if you have used that before formating the device.

NOTE!!! I have not attempted to format the drive on my kobo. You may want to ask Sameer or someone else at Kobo to see if that is okay. Logic tells me it should be okay but logic tells me a lot of things that seem to be downright wrong...

I'm starting to wonder if the whole issue of file/database corruption may be caused by data loss from a dodgy USB port on the Kobo? I am finding that sometimes when I plug it in neither the PC nor the Kobo recognise the connection. If I disconnect and reconnect it will work.

Any thoughts on whether this would be possible? If the USB connection was flakey could a file or two get corrupted? My IT brain says no, the USB is either connected or not connected, it's not really possible for it to be connected yet still have degradation of the data.

But the thing is, when I had all the problems I was mostly working while lying in bed (injured my leg and was immobile for a few days) and the Kobo was never lying flat, was getting moved around a lot etc. Today I have been very careful to keep the Kobo in precisely the same spot and not move it around at all while the data is being transferred and it's working really well, almost 2/3 way through loading all my books and it's doing fine.

I'm starting to wonder if the whole issue of file/database corruption may be caused by data loss from a dodgy USB port on the Kobo? I am finding that sometimes when I plug it in neither the PC nor the Kobo recognise the connection. If I disconnect and reconnect it will work.

Any thoughts on whether this would be possible? If the USB connection was flakey could a file or two get corrupted? My IT brain says no, the USB is either connected or not connected, it's not really possible for it to be connected yet still have degradation of the data.

But the thing is, when I had all the problems I was mostly working while lying in bed (injured my leg and was immobile for a few days) and the Kobo was never lying flat, was getting moved around a lot etc. Today I have been very careful to keep the Kobo in precisely the same spot and not move it around at all while the data is being transferred and it's working really well, almost 2/3 way through loading all my books and it's doing fine.

Any previous known issue of dodgy USB ports on Kobos?

This is certainly a possibility. I had resigned myself to using the SD exclusively for epubs and pdfs - I don't know if its slower or not, but I can easily swap a card to manage content or deal with a corrupt card. Food for thought, I suppose.

I'm starting to wonder if the whole issue of file/database corruption may be caused by data loss from a dodgy USB port on the Kobo? I am finding that sometimes when I plug it in neither the PC nor the Kobo recognise the connection. If I disconnect and reconnect it will work.

[snip]

Any previous known issue of dodgy USB ports on Kobos?

I would try a different USB cable first. Didn't I hear somewhere that some of them were dodgy?

Mine is a black 1.4 revision Kobo from Borders Australia, but I have used 3 different USB cables with it, I don't even remember which one came with the device.

Today everything is working well, managed to get all my books loaded via Calibre with no errors. This makes me feel more like the USB port is dodgy, I'm gonna have to run some more tests on it, if it is a bad USB port I want to make sure I get the device replaced before the warranty runs out.

Anyone had any experiences with returning a Kobo to Borders Australia? Do they just swap the thing or will they want to send it off to Canada for repair?