Git LFS Database disk image is malformed #8190

Closed
opened 2025-11-02 07:56:38 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @JaydenMaalouf on GitHub (Nov 29, 2021).

Gitea Version

1.15.6

Git Version

2.30.2

Operating System

Docker Linux (gitea/gitea)

How are you running Gitea?

I'm hosting it locally on a machine at home via docker (gitea/gitea).

Database

SQLite

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/JaydenMaalouf/22ea2952c0f8c07909a618208027a271

Description

It seems my sql db has become corrupt somehow.
Now anytime I try to access the LFS settings or attempt to push with LFS into my git repo, it fails with the messages you can see in the logs.

The instance has been running fine for a while until today. At first I thought my Sourcetree updated and my local git was no longer compatible with my Gitea version - so I updated the Gitea container instance to realised it was corrupt.

Is there any way I can resolve this issue?
I am the only one who uses this instance but recreating several projects will be a not-so-fun time.

Thanks in advance!

Screenshots

No response

Originally created by @JaydenMaalouf on GitHub (Nov 29, 2021). ### Gitea Version 1.15.6 ### Git Version 2.30.2 ### Operating System Docker Linux (gitea/gitea) ### How are you running Gitea? I'm hosting it locally on a machine at home via docker (gitea/gitea). ### Database SQLite ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/JaydenMaalouf/22ea2952c0f8c07909a618208027a271 ### Description It seems my sql db has become corrupt somehow. Now anytime I try to access the LFS settings or attempt to push with LFS into my git repo, it fails with the messages you can see in the logs. The instance has been running fine for a while until today. At first I thought my Sourcetree updated and my local git was no longer compatible with my Gitea version - so I updated the Gitea container instance to realised it was corrupt. Is there any way I can resolve this issue? I am the only one who uses this instance but recreating several projects will be a not-so-fun time. Thanks in advance! ### Screenshots _No response_
Author
Owner

@zeripath commented on GitHub (Nov 29, 2021):

The error "database disk image is malformed" is coming from your SQLite db file.

You need to fix your sqlite db using the sqlite3 command PRAGMA integrity_check;

https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed- appears to show a general solution.

At worst if the database is completely hosed you can start again with a clean database, adopt the repository and then as an administrator go to that repository's settings, use the LFS settings tab and then click find pointer files. This will search the whole repository looking for pointer files and compare with the file content store if they exist. Assuming that your content store and repositories aren't hosed - as an administrator you should be able to reassociate the lfs files with the repository.

Finding pointer files may take some time as it has to crawl all the objects in your repository looking for them.

It would better to try to restore the db first.

@zeripath commented on GitHub (Nov 29, 2021): The error "database disk image is malformed" is coming from your SQLite db file. You need to fix your sqlite db using the `sqlite3` command `PRAGMA integrity_check;` https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed- appears to show a general solution. At worst if the database is completely hosed you can start again with a clean database, adopt the repository and then as an administrator go to that repository's settings, use the LFS settings tab and then click find pointer files. This will search the whole repository looking for pointer files and compare with the file content store if they exist. Assuming that your content store and repositories aren't hosed - as an administrator you should be able to reassociate the lfs files with the repository. Finding pointer files may take some time as it has to crawl all the objects in your repository looking for them. It would better to try to restore the db first.
Author
Owner

@JaydenMaalouf commented on GitHub (Nov 29, 2021):

I did an export and ran the integrity check. It succeeded without finding any issues.

I didn't bother to copy the db file back onto the server because it said it found nothing. However, upon attempting to start the container again, I received some network bridge errors in Docker.

Couldn't get the container to start so I deleted the container and image but kept the app data. Tried re-pulling the image and creating the container again but same error.

Removed the container and images again but rebooted the host entirely. Once the host was back up I readded the container and it spun up without issues.

LFS is also now working somehow.

I have zero clue how the issue arose or how it was solved but I guess I should've tried turning it off and on again.

Thanks for your help nonetheless!

@JaydenMaalouf commented on GitHub (Nov 29, 2021): I did an export and ran the integrity check. It succeeded without finding any issues. I didn't bother to copy the db file back onto the server because it said it found nothing. However, upon attempting to start the container again, I received some network bridge errors in Docker. Couldn't get the container to start so I deleted the container and image but kept the app data. Tried re-pulling the image and creating the container again but same error. Removed the container and images again but rebooted the host entirely. Once the host was back up I readded the container and it spun up without issues. LFS is also now working somehow. I have zero clue how the issue arose or how it was solved but I guess I should've tried turning it off and on again. Thanks for your help nonetheless!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8190