Upgrade self host GitLab error dpkg

Hi all,
I have a self hosted GitLab (ver 13.9.3-ee) and I have to upgrade to the latest version.

So I do → 13.12.914.0.714.1.2 and then install the latest version (Upgrading GitLab | GitLab)

When i do sudo apt install gitlab-ee=13.12.9-ee.0
i get the following error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/988 MB of archives.
After this operation, 42.8 MB of additional disk space will be used.
(Reading database ... 235966 files and directories currently installed.)
Preparing to unpack .../gitlab-ee_13.12.9-ee.0_amd64.deb ...
gitlab preinstall:
gitlab preinstall: This node does not appear to be running a database
gitlab preinstall: Skipping version check, if you think this is an error exit now
gitlab preinstall:
gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)
2021-09-06 15:37:26 +0000 -- Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... pg_dump: error: connection to database "gitlabhq_production" failed: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
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:134:in `block (4 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:12: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)
gitlab preinstall:
gitlab preinstall: Database backup failed! If you want to skip this backup, run the following command and try again:
gitlab preinstall:
gitlab preinstall:  sudo touch /etc/gitlab/skip-auto-backup
gitlab preinstall:
dpkg: error processing archive /var/cache/apt/archives/gitlab-ee_13.12.9-ee.0_amd64.deb (--unpack):
 new gitlab-ee package pre-installation script subprocess returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)`

As you can see I have a problem with dpkg in the last lines.

What can I do to resolve this?
Thanks in advance


Did you stop gitlab first? If you did gitlab-ctl stop, then you shouldn’t do this. Let gitlab stop the services itself during upgrade, as it needs the postgres service running to do db migrations.

1 Like