Echec de mise à jour de Immich

What app is this about, and its version: Immich 2.5.6~ynh1
What YunoHost version are you running: 12.1.39
What type of hardware are you using: Old laptop or computer

Describe your issue

Suite à la mise à jour de immich de 2.5.6~ynh1 vers 2.5.6~ynh5, il y a eu une erreur à l’installation et le service immich s’est arrêté.
J’ai tenté de réinstaller la version2.5.6~ynh5 à nouveau mais immich s’est complètement desinstallé avec les 20 ans de photos de toute ma famille.
Je tente de restaurer la sauvegarde que j’ai réalisée juste avant la mise à jour mais j’ai là aussi une erreur : https://paste.yunohost.org/raw/avefaxokal
Pouvez vous m’aider à restaurer cette sauvegarde svp ?

Share relevant logs or error messages

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

Pas d’inquiétude rien n’est perdu.
Le plus simple est de réinstaller en suivant ça : Restauration immich impossible après échec de l'upgrade - #2 by ewilly

Malheureusement, ça a échoué

You select “immich-db-backup-20260228T020000-v2.5.6-pg16.12.sql.gz”.

To proceed we are going to:

  1. stop immich
  2. drop the curent database
  3. restore the databse with the selected backup
  4. restart immich

Are you sure you want to continue restoring? [y/N] y
[+…] Stopping immich…
[#+…] Droping current immich db…
[##+…] Creating an empty immich db…
restore_immich_db_backup.sh: ligne 49: myynh_create_psql_db : commande introuvable

J’ai corrigé le script ici https://raw.githubusercontent.com/YunoHost-Apps/immich_ynh/refs/heads/testing/conf/restore_immich_db_backup.sh
PS : je n’ai pas eu l’occasion de le tester donc dis-moi s’il fonctionne ou retourne un message d’erreur

Bonsoir, malheureusement l’execution du script a échoué à nouveau :

You select “immich-db-backup-20260228T020000-v2.5.6-pg16.12.sql.gz”.

To proceed we are going to:

  1. stop immich
  2. drop the curent database
  3. restore the databse with the selected backup
  4. restart immich

Are you sure you want to continue restoring? [y/N] y
[+…] Stopping immich…
[#+…] Droping current immich db…
/usr/lib/postgresql/17/bin/psql: unrecognized option ‘–cluster=DB_CLUSTER
psql: hint: Try “psql --help” for more information.

Remplace le contenu de restore_immich_db_backup.sh par :

#!/bin/bash

source /etc/yunohost/apps/immich/scripts/_common.sh
YNH_HELPERS_VERSION="2.1" source /usr/share/yunohost/helpers

YNH_STDINFO=1
backup_files=( *.sql.gz )

PS3="Select backup file to restore, or 0 to exit:"
select backup_file in "${backup_files[@]}"
do
	if [[ $REPLY == "0" ]]
	then
		ynh_print_info "[####################] Bye!"
		exit
	elif [[ -z $backup_file ]]; then
        ynh_print_info "[....................] Invalid choice, try again"
	else
		break
	fi
done

cat << EOF

You select "$backup_file".

To proceed we are going to:
 1) stop immich
 2) drop the curent database
 3) restore the databse with the selected backup
 4) restart immich

EOF

read -r -p "Are you sure you want to continue restoring? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
	app="immich"
	db_cluster="17/main"
	db_name="immich"

	ynh_print_info "[+...................] Stopping immich..."
	ynh_systemctl --service="$app-server" --action="stop"

	ynh_print_info "[#+..................] Droping current immich db..."
	myynh_drop_psql_db 1>/dev/null

	ynh_print_info "[##+.................] Creating an empty immich db..."
	if [[ $(lsb_release --codename --short) = "bookworm" ]]
	then
		myynh_provision_postgresql 1>/dev/null
	fi
	myynh_update_psql_db 1>/dev/null

	ynh_print_info "[###++++++++++++++++.] Restoring immich db backup... (Depending on your database size, this may take a long while)"
	{
		gunzip --stdout "$backup_file" > "db.sql"
		myynh_restore_psql_db
		ynh_safe_rm "db.sql"
		set +o xtrace
	} &>/dev/null

	ynh_print_info "[###################+] Restarting immich..."
	ynh_systemctl --service="$app-server" --action="start"

	ynh_print_info "[####################] Restoration of the immich db backup completed!"
else
	ynh_print_info "[####################] Bye!"
fi

echec

You select “immich-db-backup-20260228T020000-v2.5.6-pg16.12.sql.gz”.

To proceed we are going to:

  1. stop immich
  2. drop the curent database
  3. restore the databse with the selected backup
  4. restart immich

Are you sure you want to continue restoring? [y/N] y
[+…] Stopping immich…
[#+…] Droping current immich db…
ERREUR: la base de données « immich » n’existe pas

ah bah oui la base a déjà été “droppée” à la première tentative
Il doit suffire de commenter la ligne 47 ainsi :
# myynh_drop_psql_db 1>/dev/null

caramba, encore raté

ou select “immich-db-backup-20260228T020000-v2.5.6-pg16.12.sql.gz”.

To proceed we are going to:

  1. stop immich
  2. drop the curent database
  3. restore the databse with the selected backup
  4. restart immich

Are you sure you want to continue restoring? [y/N] y
[+…] Stopping immich…
[#+…] Droping current immich db…
[##+…] Creating an empty immich db…
/etc/yunohost/apps/immich/scripts/_common.sh: ligne 303: YNH_DEBIAN_VERSION : variable sans liaison

try to define that in the script with YNH_DEBIAN_VERSION=$(lsb_release --codename --short) just in a line after db_name="immich"

Ca avance

To proceed we are going to:

  1. stop immich
  2. drop the curent database
  3. restore the databse with the selected backup
  4. restart immich

Are you sure you want to continue restoring? [y/N] y
[+…] Stopping immich…
[#+…] Droping current immich db…
[##+…] Creating an empty immich db…

  • return 0
  • LC_ALL=C
  • DEBIAN_FRONTEND=noninteractive
  • apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0 update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/immich.list
  • touch /etc/apt/sources.list.d/immich.list
  • ynh_apt_install_dependencies ‘libpq5 libpq-dev postgresql-17 postgresql-17-pgvector postgresql-client-17’
    ++ sed ‘s/([^<=>])\ ([^(])/\1, \2/g’
    ++ sed ‘s/|/ | /’
  • local ‘dependencies=libpq5, libpq-dev, postgresql-17, postgresql-17-pgvector, postgresql-client-17’
    ++ ynh_read_manifest version
    ++ cat /home/yunohost.app/immich/manifest.toml
    ++ toml_to_json
    ++ python3 -c ‘import toml, json, sys; print(json.dumps(toml.load(sys.stdin)))’
    ++ jq .version --raw-output
    cat: /home/yunohost.app/immich/manifest.toml: Aucun fichier ou dossier de ce type
  • local version=null
  • local app_ynh_deps=immich-ynh-deps
  • grep ‘[<=>]’
    ++ grep -oP ‘(?<=php)[0-9.]+(?=-|>|)’
    ++ sort -u
  • local specific_php_version=
  • [[ -n ‘’ ]]
  • grep --quiet php
    ++ _ynh_apt_package_is_installed postgresql-15
    ++ local package=postgresql-15
    ++ dpkg-query --show ‘–showformat=${db:Status-Status}’ postgresql-15
    ++ grep --quiet ‘^installed$’
    ++ echo yes
  • local psql_installed=yes
  • [[ true == \t\r\u\e ]]
  • YNH_APT_INSTALL_DEPENDENCIES_REPLACE=false
    ++ mktemp --directory
  • local TMPDIR=/tmp/tmp.tymU7XvykK
  • mkdir -p /tmp/tmp.tymU7XvykK/immich-ynh-deps/DEBIAN
  • chmod -R 755 /tmp/tmp.tymU7XvykK/immich-ynh-deps
  • cat
  • _ynh_apt update
  • [[ update == \u\p\d\a\t\e ]]
  • local aptcache=/var/cache/apt/pkgcache.bin
  • sleep 1
  • [[ -e /var/cache/apt/pkgcache.bin ]]
    ++ find /var/cache/apt/pkgcache.bin -mmin -30
  • [[ -n /var/cache/apt/pkgcache.bin ]]
    ++ find /etc/apt/ -newer /var/cache/apt/pkgcache.bin
  • [[ -z /etc/apt/sources.list.d/immich.list ]]
  • _ynh_wait_dpkg_free
  • local try
  • set +o xtrace
  • return 0
  • LC_ALL=C
  • DEBIAN_FRONTEND=noninteractive
  • apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0 update
  • _ynh_wait_dpkg_free
  • local try
  • set +o xtrace
  • return 0
  • LC_ALL=C
  • dpkg-deb --build /tmp/tmp.tymU7XvykK/immich-ynh-deps /tmp/tmp.tymU7XvykK/immich-ynh-deps.deb
  • cat /tmp/tmp.tymU7XvykK/dpkg_log
    dpkg-deb: error: parsing file ‘/tmp/tmp.tymU7XvykK/immich-ynh-deps/DEBIAN/control’ near line 4 package ‘immich-ynh-deps’:
    ‘Version’ field value ‘null’: version number does not start with digit
  • ynh_die ‘Unable to install dependencies’
  • set +o xtrace
    Unable to install dependencies

Bon trop complexe de mettre à jour ce script à la mano.
Il est réparé dans la dernière version de immich 15.6~ynh7 sinon j’ai testé et ça a fonctionné il y a tout simplement l’outil intégré à immich pour restaurer un database (dans le menu administration / maintenance)

Merci, merci, merci, merci, merci

Tout remarche