Error: object file .git/objects/ is empty - Fatal: loose object stored in .git/objects is corrupt

OS type and version Ubuntu Linux 22.04.4
Webmin version 2.105
Usermin version 2.005
Virtualmin version 7.9.0
Theme version 21.09.5
Package updates All installed packages are up to date

I need help please.
I don’t know anything about git repositories.
My webmin and virtualmin server has 3 websites but they don’t use git repositories.
Only the local repo.
A few days ago this error appeared while I was updating the tzdata file.
I tried to fix it but things got worse.
I looked all over the internet to find something helpful but nothing.
The git status & git fsck --full commands worked until they stopped working.
So I decided to roll back the server to a previous snapshot.
But this time I realized that the .git repository in the root folder does not exist.
I was able to re-create it with the commands
git init & git add -A & git commit
without losing any files.
Results show all ok from git status & git fsck --full commands
But now every time I run an update in webmin I still get the original error.
Always the same.
But this empty file exist in the folder:
and not in:
What can I do to get rid of it without problem?

error: object file .git/objects/ is empty
error: object file .git/objects/d4/7e7d94fe3f1a84a82c3889abc02b0a016174d0 is empty
fatal: loose object d47e7d94fe3f1a84a82c3889abc02b0a016174d0 (stored in .git/objects/d4/7e7d94fe3f1a84a82c3889abc02b0a016174d0) is corrupt

The .git in /etc probably comes from the etckeeper package.

If you didn’t know you had it and don’t care about the history contained in it, you can just delete the /etc/.git directory and reinitialize etckeeper. No harm in that, if nothing important is in the history (most people don’t use etckeeper, but we install it by default on systems that have a package that sets it up automatically because it made us sad to see so many people desperate to recover some previous state and not having backups…etckeeper is not a substitute for backups, but it does allow you to see exactly what changes you made, which might help you fix things if you make a mistake that breaks something and you don’t remember what you changed to get there).

Why did you believe you needed a .git repository in the root folder? You can obviously just delete that one, it has nothing to do with anything. Or you can keep it, I don’t care. But, it has nothing to do with any errors during a package installation or update.

Oh, and once you have git happy in /etc, you can run dpkg --configure -a to make sure any unconfigured stuff gets configured.

Thank you very much for your immediate response :slight_smile:
Usually, when something goes wrong on my server at once go to the previous snapshot which my provider offers me
I think it is better not to trouble with the history of git. I wouldn’t mind having no history as I keep it all on my computer. The main changes. And I do very frequent backups and snapshots.
1. So you think I can delete /root/.git completely. Does not do anything? I am very happy for this
2. If I want to reinitialize etckeeper /etc/.git (etckeeper) how can I do it and
3. Where can I see the history of etckeeper, perhaps in the Webmin Actions Log?

You created it for reasons only you know. You can do whatever you want with it.

Delete the old /etc/.git and run etckeeper init

Webmin Actions Log is the Webmin action log. etckeeper is not Webmin and has no relation to Webmin.

You can look at the history the same way you would any git repository, it’s just a git repository. etckeeper is just a tool to automatically check changes in /etc into a revision controls system (git in this case, but it supports others). There are GUIs for git repositories, but we don’t set one up. This isn’t a Webmin or Virtualmin thing and is in no way necessary for Webmin or Virtualmin. It’s just an optional package we install for the reasons I mentioned above.

1 Like

Thank you Joe.
You covered all my concerns
Have a beautiful day!

  1. I installed my last snapshot from yesterday
  2. I deleted /root/.git folder
  3. I deleted /etc/.git folder
  4. I runned etckeeper init command
  5. I runned dpkg --configure -a command
  6. I updated webmin with the latest updates that it asked: python3-cryptography:amd64 (3.4.8-1ubuntu2.2)
    And finally no error anywhere !!!

That’s also entirely unrelated to Webmin.

When you install software updates in Webmin/Virtualmin, it is just using the system package manager to install updates provided by your OS. Unless they come from our repos (at they aren’t ours. You’re not “updating Webmin” you’re updating whatever your OS package manager has available to update (which you absolutely should do, which is why we show available system updates so prominently in the UI). Our packages are also installed using the OS package manager, of course, but they come from our repos rather than the OS repos.

You are absolutely right. I didn’t need to write it. I just wanted to point out that now all system updates don’t show an error anywhere, which wasn’t the case before (whether it was OS updates or Webmin/Virtualmin)

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.