Postgresql update does not work from PG12 to PG13

I am currently trying to update gitlab from 15.11.13 to 16.1.5 and need to upgrade my Postresql database too. Unfortunately its running into a problem.

gitlab-studio-backup$ curl -s “” | bash -s -x – -r gitlab-dev-release -n gitlab-dev pre

  • set -e
  • fake_timestamp=database_upgrade_6
  • script_name=database-upgrade
  • getopts :r:n:b: opt
  • case “${opt}” in
  • release=gitlab-dev-release
  • getopts :r:n:b: opt
  • case “${opt}” in
  • namespace=‘-n gitlab-dev’
  • getopts :r:n:b: opt
  • shift 4
  • case ${1} in
  • pre
  • in_toolbox backup-utility -t database_upgrade_6 --skip registry,uploads,artifacts,lfs,packages,external_diffs,terraform_state,ci_secure_files,repositories,pages
    ++ grep -v backup
    +++ selector toolbox
    +++ base=app=toolbox
    ++ head -n 1
    +++ ‘[’ -n gitlab-dev-release ‘]’
    +++ base+=,release=gitlab-dev-release
    +++ echo app=toolbox,release=gitlab-dev-release
    ++ kubectl -n gitlab-dev get pods -l app=toolbox,release=gitlab-dev-release --field-selector status.phase=Running -o --no-headers
  • task_pod=gitlab-dev-release-toolbox-65c4d44458-7b2vh
  • kubectl -n gitlab-dev exec -it gitlab-dev-release-toolbox-65c4d44458-7b2vh -c toolbox – env GITLAB_ASSUME_YES=1 backup-utility -t database_upgrade_6 --skip registry,uploads,artifacts,lfs,packages,external_diffs,terraform_state,ci_secure_files,repositories,pages
    Unable to use a TTY - input is not a terminal or the right kind of file
    2023-11-02 18:01:04 +0100 – Dumping database …
    Dumping PostgreSQL database gitlabhq_production … pg_dump: warning: could not find where to insert IF EXISTS in statement "-- not dropping schema, since initdb creates it
    2023-11-02 18:01:08 +0100 – Dumping database … done
    2023-11-02 17:01:08 +0000 – Deleting backup and restore lock file
    Packing up backup tar
    ERROR: Error parsing xml: mismatched tag: line 66, column 4
    ERROR: b’\r\n \r\n \r\n\r\n \r\n body {\r\n font-family: “Helvetica Neue”, Helvetica, Arial, sans-serif;\r\n line-height: 1.66666667;\r\n font-size: 16px;\r\n color: #333;\r\n background-color: #fff;\r\n margin: 2em 1em;\r\n }\r\n h1 {\r\n font-size: 28px;\r\n font-weight: 400;\r\n }\r\n p {\r\n margin: 0 0 10px;\r\n }\r\n .alert.alert-info {\r\n background-color: #F0F0F0;\r\n margin-top: 30px;\r\n padding: 30px;\r\n }\r\n .alert p {\r\n padding-left: 35px;\r\n }\r\n ul {\r\n padding-left: 51px;\r\n position: relative;\r\n }\r\n li {\r\n font-size: 14px;\r\n margin-bottom: 1em;\r\n }\r\n {\r\n position: relative;\r\n font-size: 20px;\r\n }\r\n, {\r\n content: “”;\r\n left: 0;\r\n position: absolute;\r\n top: 0;\r\n }\r\n {\r\n background: #0066CC;\r\n border-radius: 16px;\r\n color: #fff;\r\n content: “i”;\r\n font: bold 16px/24px serif;\r\n height: 24px;\r\n left: 0px;\r\n text-align: center;\r\n top: 4px;\r\n width: 24px;\r\n }\r\n\r\n @media (min-width: 768px) {\r\n body {\r\n margin: 6em;\r\n }\r\n }\r\n \r\n \r\n \r\n

    Application is not available


    The application is currently not serving requests at this endpoint. It may not have been started or is still starting.


    \r\n Possible reasons you are seeing this page:\r\n

    • \r\n The host doesn't exist.\r\n Make sure the hostname was typed correctly and that a route matching this hostname exists.\r\n
    • \r\n
    • \r\n The host exists, but doesn't have a matching path.\r\n Check if the URL path was typed correctly and that the route was created using the desired path.\r\n
    • \r\n
    • \r\n Route and path matches, but all pods are down.\r\n Make sure that the resources exposed by this route (pods, services, deployment configs, etc) have at least one pod running.\r\n
    • \r\n
    \r\n \r\n\r\n’
    WARNING: Upload failed: /database_upgrade_6_gitlab_backup.tar (503 (Service Unavailable))
    WARNING: Retrying on lower speed (throttle=0.01)
    WARNING: Waiting 3 sec…

Target port configuration were false. The GUI didnt properly show it in the normal view. In the Edit mode you could see the missing port configs.