Ask Your Question
0

Fedora 24 dnf: sqlite3.DatabaseError: database disk image is malformed

asked 2016-07-05 17:46:38 -0500

Favorablestream gravatar image

Hello. When installing software with dnf I receive the above error (sqlite3.DatabaseError: database disk image is malformed).

Full example: http://pastebin.com/Rvi6sygi

Any answers I've found online are for yum and they haven't worked for me. Most of them seem to suggest this is related to the history database being corrupted.

Things I have tried:

  • dnf clean all (root and my user)
  • dnf clean dbcache
  • dnf makecache
  • Many posts suggest yum history new but this command is not available with dnf. I haven't found a way to clear the history database in dnf though so if someone knows it's location or how to clear it that could be helpful.
  • Clearing all rpm database files in /var/lib/rpm then regenerating them (rpm --rebuilddb).

Anyway was wondering if anyone had dealt with this before. Every post or solution I've found is out of date and hasn't worked.

Cheers

edit retag flag offensive close merge delete

Comments

Did you find a solution by now? I'm stuck with a similar problem (i think I ran out of disk space during an update) and have also tried what you did without success. The only thing that works for me as a workaround is using yum-deprecated instead of dnf... but anyway I would like to get dnf working again.

samuel0815 gravatar imagesamuel0815 ( 2016-09-09 05:15:45 -0500 )edit

Sorry for not answering, I didn't see your comment.

Not sure if you saw the answer that was left but I ended up solving it by doing something different.

Basically I found that the db files were located at /var/lib/dnf/history and deleted all of them. Obviously this won't work if you want the history.

Not sure if the answer that was given is better but this worked for me.

Favorablestream gravatar imageFavorablestream ( 2016-11-12 21:06:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-09-10 18:22:07 -0500

gilj gravatar image

Unlike yum, dnf does not allow to recover from broken history database, this is reported as a bug ( https://bugzilla.redhat.com/show_bug.... and https://bugzilla.redhat.com/show_bug.... ).

On that first link Jan Silhan suggests to dump the entire database with .dump, create a new one and remove the old one:

`sqlite3 history-<date>.sqlite ".dump" | sqlite3 history-<new date>.db && rm history-<date>.sqlite`

I had a "sqlite3.DatabaseError: database disk image is malformed" error while using dnf to install, update or remove any package, probably due to the lack of space during the last update. Thanks @samuel0815 for that tip, I wasn't getting how this error had shown up.

I've used the above commands as root at /var/lib/dnf/history/ directory and dnf is working again.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-07-05 17:46:38 -0500

Seen: 871 times

Last updated: Jul 05 '16