Fatal: Unable to create '/data/addons/core/.git/index.lock': File exists

I’m trying to update from 0.77.3 to 0.80, but every time the update fails with this error:

18-10-13 22:52:24 ERROR (MainThread) [hassio.addons.git] Can't update https://github.com/home-assistant/hassio-addons repo: Cmd('git') failed due to: exit code(128)
  cmdline: git reset --hard origin/master
  stderr: 'fatal: Unable to create '/data/addons/core/.git/index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.'.

I’ve tried finding the file while logged in as root (using a private key etc.) on port 22222, tried finding it in the configurator, but I can’t seem to find it.

Anyone know how I can get rid of this file so I can update?

Does this file exist?

ls 

will tell you.

If not, this may be in the supervisor part, ssh in to port 22.

That folder doesn’t exist at all (even when I view hidden stuff with ls -a), so I suspect it’s in a different area that I’m not sure how to get to.

(also configurator is essentially the same as SSH’ing in to the supervisor part, but I just double checked, just in case)

Anyone else got any clues about this?

I ended up wiping my HA installation and starting again from scratch. I was planning to anyway, but if I wasn’t, I shouldn’t have had to wipe just to update.

I’m not going to mark this as the best answer because I hate when the solution is to start again.

Looks like some other process (perhaps a previous failed upgrade) left a file behind.

It is common on unix type systems for a process to create a lock file when it is dangerous to have two processes interfering with each other, to be more specific an upgrade script creates a lock file so that if another upgrade process tries to run at the same time the second process will see the lock file and proceed no further.

Then if the first process crashes and doesn’t remove the lock file, well you can see that trying to upgrade again will necessarily fail.

Explanation, but no easy answer (except to manually remove the lock file).