Gitlab cannot be restore

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.1.20
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
migrate the yunohost from an older server
gitlab v16.0.1~ynh1

Description of my issue

I am migrating a from another server a Yunohost instance. I already have restore the system, users and other apps, except the mails (we don’t need use mails)

I try restore a Gitlab instance, but it fails. here some logs.

https://paste.yunohost.org/raw/ajucuxejav

It brakes when trying restore a file in /var/opt/gitlab/backups/last_gitlab_backup.tar

2023-06-20 07:56:57,544: DEBUG - + mkdir --parents /var/opt/gitlab/backups
2023-06-20 07:56:57,560: DEBUG - + mountpoint --quiet /home/yunohost.backup/tmp/20230620-070341
2023-06-20 07:56:57,576: DEBUG - + mv /home/yunohost.backup/tmp/20230620-070341/apps/gitlab/backup/var/opt/gitlab/backups/last_gitlab_backup.tar /var/opt/gitlab/backups/last_gitlab_backup.tar
2023-06-20 07:56:57,590: DEBUG - + [[ /var/opt/gitlab/backups/last_gitlab_backup.tar == \/\e\t\c\/\n\g\i\n\x\/\c\o\n\f\.\d\/* ]]
2023-06-20 07:56:57,591: DEBUG - + last_backup=last
2023-06-20 07:56:57,591: DEBUG - + gitlab-ctl stop puma
2023-06-20 07:56:59,942: DEBUG - ok: down: puma: 0s, normally up
2023-06-20 07:56:59,954: DEBUG - + gitlab-ctl stop sidekiq
2023-06-20 07:57:03,935: DEBUG - ok: down: sidekiq: 0s, normally up
2023-06-20 07:57:03,941: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:03,941: DEBUG - + [[ 4 -eq 1 ]]
2023-06-20 07:57:03,941: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:39,914: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup ...
2023-06-20 07:57:39,956: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-20 07:57:39,957: DEBUG - tar: Error is not recoverable: exiting now
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup failed
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Deleting backup and restore PID file ... done
2023-06-20 07:57:40,686: DEBUG - + ynh_exit_properly

I have look for how resolve. First I have read in the gitlab forums, this file can have a chmod 644.

I have got another log at a moment here the paste

https://paste.yunohost.org/raw/rifoqugehu

2023-06-20 07:56:57,590: DEBUG - + [[ /var/opt/gitlab/backups/last_gitlab_backup.tar == \/\e\t\c\/\n\g\i\n\x\/\c\o\n\f\.\d\/* ]]
2023-06-20 07:56:57,591: DEBUG - + last_backup=last
2023-06-20 07:56:57,591: DEBUG - + gitlab-ctl stop puma
2023-06-20 07:56:59,942: DEBUG - ok: down: puma: 0s, normally up
2023-06-20 07:56:59,954: DEBUG - + gitlab-ctl stop sidekiq
2023-06-20 07:57:03,935: DEBUG - ok: down: sidekiq: 0s, normally up
2023-06-20 07:57:03,941: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:03,941: DEBUG - + [[ 4 -eq 1 ]]
2023-06-20 07:57:03,941: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:39,914: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup ...
2023-06-20 07:57:39,956: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-20 07:57:39,957: DEBUG - tar: Error is not recoverable: exiting now
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup failed
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Deleting backup and restore PID file ... done
2023-06-20 07:57:40,686: DEBUG - + ynh_exit_properly
2023-06-20 07:57:40,687: DEBUG - + [[ restore =~ ^install$|^upgrade$|^restore$ ]]
2023-06-20 07:57:41,200: DEBUG - + ynh_clean_setup
2023-06-20 07:57:41,200: DEBUG - + ynh_exec_warn_less ynh_secure_remove --file=/tmp/tmp.UEjwgiuDk7
2023-06-20 07:57:41,201: DEBUG - + [[ 2 -eq 1 ]]
2023-06-20 07:57:41,201: DEBUG - + ynh_secure_remove --file=/tmp/tmp.UEjwgiuDk7
2023-06-20 07:57:41,698: DEBUG - + ynh_clean_check_starting
2023-06-20 07:57:41,698: DEBUG - + '[' -n '' ']'
2023-06-20 07:57:41,699: DEBUG - + '[' -n '' ']'
2023-06-20 07:57:42,722: ERROR - Could not restore gitlab: An error occured inside the app restore script

I also try do a gitlab-ctl reconfigure

Later I could view on another Gitlab running on another yunohost server that the folder /var/opt/gitlab/backups have the owners git:root and here it was root:root so I have done a chown git /var/opt/gitlab/backups

Later we realize the file last_gitlab_backup.tar was very old, we delete it and try a restore, but the backup with gitlab-backup create is done in another path in /home/gitlab.backup/last_gitlab_backup.tar, so we move the file on the path needed for yunohost mv /home/gitlab.backup/last_gitlab_backup.tar /var/opt/gitlab/backups/ do a new backup but trying retore it is again failed

https://paste.yunohost.org/raw/neyoxodogi

2023-06-21 09:16:59,622: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-21 09:16:59,622: DEBUG - + [[ 4 -eq 1 ]]
2023-06-21 09:16:59,622: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-21 09:17:38,726: DEBUG - 2023-06-21 09:17:38 UTC -- Unpacking backup ...
2023-06-21 09:17:38,751: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-21 09:17:38,752: DEBUG - tar: Error is not recoverable: exiting now
2023-06-21 09:17:38,782: DEBUG - 2023-06-21 09:17:38 UTC -- Unpacking backup failed
2023-06-21 09:17:38,782: DEBUG - 2023-06-21 09:17:38 UTC -- Deleting backup and restore PID file ... done
2023-06-21 09:17:38,845: DEBUG - + ynh_exit_properly

What’s going wrong ? is it related to the upgrade to of gitlab 16.0.1~ynh1 ?


Mon serveur YunoHost

Matériel: VPS acheté en ligne
**Version de YunoHost:11.1.20
J’ai accès à mon serveur : En SSH | Par la webadmin
Êtes-vous dans un contexte particulier ou avez-vous effectué des modificiations particulières sur votre instance ? : oui
migration d’un ancien serveur vers un nouveau serveur
Si votre requête est liée à une applicatio, précisez son nom et sa version: gitlab v16.0.1~ynh1

Description du problème

En cours de migration vers un nouvel hébergement. Le système et utilisateurs sont déjà migrés, ainsi que d’autres apps (sauf les mails qui ne seront pas utilisés)

Essais de restauration de Gitlab qui échoue. Ici des logs.

https://paste.yunohost.org/raw/ajucuxejav

Le script plante en voulant restaurer lr fichier /var/opt/gitlab/backups/last_gitlab_backup.tar

2023-06-20 07:56:57,544: DEBUG - + mkdir --parents /var/opt/gitlab/backups
2023-06-20 07:56:57,560: DEBUG - + mountpoint --quiet /home/yunohost.backup/tmp/20230620-070341
2023-06-20 07:56:57,576: DEBUG - + mv /home/yunohost.backup/tmp/20230620-070341/apps/gitlab/backup/var/opt/gitlab/backups/last_gitlab_backup.tar /var/opt/gitlab/backups/last_gitlab_backup.tar
2023-06-20 07:56:57,590: DEBUG - + [[ /var/opt/gitlab/backups/last_gitlab_backup.tar == \/\e\t\c\/\n\g\i\n\x\/\c\o\n\f\.\d\/* ]]
2023-06-20 07:56:57,591: DEBUG - + last_backup=last
2023-06-20 07:56:57,591: DEBUG - + gitlab-ctl stop puma
2023-06-20 07:56:59,942: DEBUG - ok: down: puma: 0s, normally up
2023-06-20 07:56:59,954: DEBUG - + gitlab-ctl stop sidekiq
2023-06-20 07:57:03,935: DEBUG - ok: down: sidekiq: 0s, normally up
2023-06-20 07:57:03,941: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:03,941: DEBUG - + [[ 4 -eq 1 ]]
2023-06-20 07:57:03,941: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:39,914: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup ...
2023-06-20 07:57:39,956: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-20 07:57:39,957: DEBUG - tar: Error is not recoverable: exiting now
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup failed
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Deleting backup and restore PID file ... done
2023-06-20 07:57:40,686: DEBUG - + ynh_exit_properly

Après avoir chercher sur le forum de Gitla et sur internet, je lis que ce fichier doit avoir des permissions chmod 644.

Un autre log d’une autre tentative

https://paste.yunohost.org/raw/rifoqugehu

2023-06-20 07:56:57,590: DEBUG - + [[ /var/opt/gitlab/backups/last_gitlab_backup.tar == \/\e\t\c\/\n\g\i\n\x\/\c\o\n\f\.\d\/* ]]
2023-06-20 07:56:57,591: DEBUG - + last_backup=last
2023-06-20 07:56:57,591: DEBUG - + gitlab-ctl stop puma
2023-06-20 07:56:59,942: DEBUG - ok: down: puma: 0s, normally up
2023-06-20 07:56:59,954: DEBUG - + gitlab-ctl stop sidekiq
2023-06-20 07:57:03,935: DEBUG - ok: down: sidekiq: 0s, normally up
2023-06-20 07:57:03,941: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:03,941: DEBUG - + [[ 4 -eq 1 ]]
2023-06-20 07:57:03,941: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-20 07:57:39,914: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup ...
2023-06-20 07:57:39,956: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-20 07:57:39,957: DEBUG - tar: Error is not recoverable: exiting now
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Unpacking backup failed
2023-06-20 07:57:40,635: DEBUG - 2023-06-20 07:57:39 UTC -- Deleting backup and restore PID file ... done
2023-06-20 07:57:40,686: DEBUG - + ynh_exit_properly
2023-06-20 07:57:40,687: DEBUG - + [[ restore =~ ^install$|^upgrade$|^restore$ ]]
2023-06-20 07:57:41,200: DEBUG - + ynh_clean_setup
2023-06-20 07:57:41,200: DEBUG - + ynh_exec_warn_less ynh_secure_remove --file=/tmp/tmp.UEjwgiuDk7
2023-06-20 07:57:41,201: DEBUG - + [[ 2 -eq 1 ]]
2023-06-20 07:57:41,201: DEBUG - + ynh_secure_remove --file=/tmp/tmp.UEjwgiuDk7
2023-06-20 07:57:41,698: DEBUG - + ynh_clean_check_starting
2023-06-20 07:57:41,698: DEBUG - + '[' -n '' ']'
2023-06-20 07:57:41,699: DEBUG - + '[' -n '' ']'
2023-06-20 07:57:42,722: ERROR - Could not restore gitlab: An error occured inside the app restore script

J’ai essayer aussi de lancer un gitlab-ctl reconfigure avant

Plus tard sur un autre Gitlab qui tourne sur un autre serveur, je prend note que le dossier /var/opt/gitlab/backups appartient aux utlisateur:groupe git:root ici c’était root:root je fais donc un chown git /var/opt/gitlab/backups

Plus tard, je réalise que last_gitlab_backup.tar date de longtemps, on supprime le fichier et on essaye un backup mais la commande gitlab-backup create créér le backup dans un autre chemein /home/gitlab.backup/last_gitlab_backup.tar, donc nous déplaçons le fichier au bon endroit pour yunohost mv /home/gitlab.backup/last_gitlab_backup.tar /var/opt/gitlab/backups/ on fait un nouveau backup et après essai de restauration, un nouvel échec ! ici les logs

https://paste.yunohost.org/raw/neyoxodogi

Encore ces soucis de permissions !

2023-06-21 09:16:59,622: DEBUG - + ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=last
2023-06-21 09:16:59,622: DEBUG - + [[ 4 -eq 1 ]]
2023-06-21 09:16:59,622: DEBUG - + gitlab-backup restore force=yes BACKUP=last
2023-06-21 09:17:38,726: DEBUG - 2023-06-21 09:17:38 UTC -- Unpacking backup ...
2023-06-21 09:17:38,751: DEBUG - tar: last_gitlab_backup.tar: Cannot open: Permission denied
2023-06-21 09:17:38,752: DEBUG - tar: Error is not recoverable: exiting now
2023-06-21 09:17:38,782: DEBUG - 2023-06-21 09:17:38 UTC -- Unpacking backup failed
2023-06-21 09:17:38,782: DEBUG - 2023-06-21 09:17:38 UTC -- Deleting backup and restore PID file ... done
2023-06-21 09:17:38,845: DEBUG - + ynh_exit_properly

Qu’est-ce qui ne va pas ? Est-ce relier à la mise à jour de Gitlab 16.0.1~ynh1 ?

Hello, I found where was the mistake, in the new server, as I have done a restore system ans datas, I found a directory with /home/gitlab.backup/ and a file inside last_gitlab_backup.tar, owned by my_webapp:my_webapp so I just hace to do a chown git:git /home/gitlab.backup\last_gitlab_backup.tar and a restore, it works !

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.