Skip to content

pg_dump fails with 'permission denied for table audits'

Summary

When trying to backup our GitLab CE 13.7.3 instance (Omnibus, docker container), the process fails. We have successfully executed (many) backups in the past without issues, and there have been no (intentional) changes to the DB since we performed our last backup.

Steps to reproduce

  1. Start the backup process with:
docker-compose exec gitlab gitlab-backup
  1. Alternatively, entering the container and directly running the command:
user@host$ docker-compose exec gitlab bash
root@gitlab:/# gitlab-backup 

Example Project

What is the current bug behavior?

The backup operation fails with the with the error message below:

Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] query failed: ERROR:  permission denied for table audits

What is the expected correct behavior?

The backup process succeeds.

Relevant logs and/or screenshots

docker-compose exec gitlab gitlab-backup
2021-02-08 17:17:37 +0000 -- Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] query failed: ERROR:  permission denied for table audits
pg_dump: [archiver (db)] query was: LOCK TABLE public.audits IN ACCESS SHARE MODE
[FAILED]
rake aborted!
Backup::Error: Backup failed
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/database.rb:62:in `dump'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:132:in `block (4 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:10:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:backup:db:create
(See full trace by running task with --trace)

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.1
Redis Version:	5.0.9
Git Version:	2.29.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.7.3
Revision:	1ef3b81f122
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.9
URL:		https://XXXX.xxx.xxx/gitlab
HTTP Clone URL:	https://XXXX.xxx.xxx/gitlab/some-group/some-project.git
SSH Clone URL:	ssh://git@XXXX.xxx.xxx:2222/some-group/some-project.git
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.14.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.14.0 ? ... OK (13.14.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... Checking gitlab@xxx.xxx yes Init.d configured correctly? ... skipped MailRoom running? ... skipped

Checking Reply by email ... Finished

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 100 users of 100 limit.

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 6/1 ... yes 6/6 ... yes 5/7 ... yes 5/8 ... yes 5/10 ... yes 5/11 ... yes 5/13 ... yes 5/16 ... yes 5/17 ... yes 33/18 ... yes 6/19 ... yes 6/21 ... yes 37/22 ... yes 37/23 ... yes 6/24 ... yes 5/25 ... yes 42/26 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.29.0 ? ... yes (2.29.0) Git user has default SSH configuration? ... yes Active users: ... 23 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes