$ sudo -u zammad -H /opt/zammad/contrib/backup/zammad_restore.sh
# Zammad restored started - Sat 20 Nov 2021 01:45:26 PM UTC!
The restore will delete your current config and database!
Be sure to have a backup available!
Enter 'yes' if you want to proceed!
Restore?: yes
Enter file date to restore:
20211120134351
File date: 20211120134351
Enter db date to restore:
20211120134351
DB date: 20211120134351
# Stopping Zammad
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'zammad.service'.
Authenticating as: root
Password: Failed to stop zammad.service: Connection timed out
See system logs and 'systemctl status zammad.service' for details.
# Checking requirements
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
# ... Dropping current database zammad
PG::ObjectInUse: ERROR: database "zammad" is being accessed by other users
DETAIL: There are 6 other sessions using the database.
Couldn't drop database 'zammad'
rake aborted!
ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "zammad" is being accessed by other users
When restoring with root user:
$ /opt/zammad/contrib/backup/zammad_restore.sh
# Zammad restored started - Sat 20 Nov 2021 01:48:10 PM UTC!
The restore will delete your current config and database!
Be sure to have a backup available!
Enter 'yes' if you want to proceed!
Restore?: yes
Enter file date to restore:
20211120134351
File date: 20211120134351
Enter db date to restore:
20211120134351
DB date: 20211120134351
# Stopping Zammad
# Checking requirements
# ... Dropping current database zammad
Dropped database 'zammad'
# ... Creating database zammad for owner zammad
CREATE DATABASE
# Restoring PostgreSQL DB
psql: error: FATAL: Peer authentication failed for user "zammad"
# Restoring Files
# Ensuring correct file rights ...
# Clearing Cache ...
# Starting Zammad
# Zammad restored successfully - Sat 20 Nov 2021 01:48:36 PM UTC!
I am trying to restore a backup on a different server as root user - as you recommended - but I get the same psql: error: FATAL: Peer authentication failed for user "zammad" error:
root@zammad-test:/opt/zammad/contrib/backup# ./zammad_restore.sh
# Zammad restored started - Mon 07 Feb 2022 12:28:40 PM UTC!
The restore will delete your current config and database!
Be sure to have a backup available!
Enter 'yes' if you want to proceed!
Restore?: yes
Enter file date to restore:
20220204002101
File date: 20220204002101
Enter db date to restore:
20220204002101
DB date: 20220204002101
# Stopping Zammad
# Checking requirements
# ... Dropping current database zammad
Dropped database 'zammad'
# ... Creating database zammad for owner zammad
CREATE DATABASE
# Restoring PostgreSQL DB
psql: error: FATAL: Peer authentication failed for user "zammad"
# Restoring Files
# Ensuring correct file rights ...
# Clearing Cache ...
# Starting Zammad
# Zammad restored successfully - Mon 07 Feb 2022 12:28:58 PM UTC!