Upgrading gitlab-ee 13.12.5-ee.0 to 14.0.1-ee.0 failed

I tried upgrading our gitlab-ee 13.12.5-ee.0 installation on a Debian 9.13 system to 14.0.1-ee.0 yesterday. The upgrade didn’t show any specific problems as far as I could see and afterwards I was able to login, but not to access repositories.

Not being able to immediately figure out what was going wrong and getting angry support requests by students who had deadlines for trainings, I decided to switch back to a snapshot of the old system.

This did not help either. (builds, git-data, shared and uploads are mounted via NFS)

Investigating further I noticed issues with gitaly not being able to move folders because of wrong permissions. Some files and folders were owned by root even though they should be owned by git (I guessed). Other components had similar problems.

I was able to manually fix a few of these by doing some chown and chmod, but I am not sure if I got all.

So I have two questions:

  1. What might have caused this?
  2. Is there a tool/script to check and fix file and folder permissions? Or at least a document telling me how they should be?