Zammad problems with restore

Hi anybody can tell me if has the same proble when make a backup and execute the restore?

root@hds:~# ls -lla /var/tmp/zammad_backup/
total 800516
drwxr-xr-x 2 zammad zammad      4096 nov 16 10:35 .
drwxrwxrwt 9 root   root        4096 nov 16 10:01 ..
-rw-rw-r-- 1 zammad zammad  21045426 nov 15 22:38 20211115223828_zammad_db.psql
-rw-r--r-- 1 zammad zammad   5263967 nov 16 10:35 20211115223828_zammad_db.psql.gz
-rw-rw-r-- 1 zammad zammad 129064511 nov 15 22:38 20211115223828_zammad_files.tar.gz
lrwxrwxrwx 1 zammad zammad        55 nov 15 22:38 latest_zammad_db.psql.gz -> /var/tmp/zammad_backup/20211115223828_zammad_db.psql.gz
lrwxrwxrwx 1 zammad zammad        57 nov 15 22:38 latest_zammad_files.tar.gz -> /var/tmp/zammad_backup/20211115223828_zammad_files.tar.gz
-rw-r--r-- 1 zammad zammad 664333092 nov  6 15:31 OneDrive_1_27-10-2021.zip
root@hds:~# su - zammad 
zammad@hds:~$ cd /opt/zammad/contrib/
apache2/                   mac_developer_scripts.app/ packager.io/
backup/                    nginx/                     
zammad@hds:~$ cd /opt/zammad/contrib/backup/
zammad@hds:/opt/zammad/contrib/backup$ ls
config	config.dist  functions	zammad_backup.sh  zammad_restore.sh

Before of this i make a backup with the tool of zammad, how you can see i have this files, then i execute the restore script

zammad@hds:/opt/zammad/contrib/backup$ ./zammad_restore.sh

# Zammad restored started - mar 16 nov 2021 10:42:38 -05!

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: 
20211115223828
File date: 20211115223828
Enter db date to restore: 
20211115223828
DB date: 20211115223828
# Stopping Zammad
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'zammad.service'.
**Authenticating as: Ubuntu (adminsoc)**
Password: 
==== AUTHENTICATION COMPLETE ===
# Checking requirements
# ... Dropping current database zammad
Dropped database 'zammad'
# ... Creating database zammad for owner zammad
Password: 
su: Authentication failure
# Restoring PostgreSQL DB
psql: error: FATAL:  database "zammad" does not exist
# Restoring Files
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/design_rationale.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/.autotest: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/Manifest.txt: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/autorun.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/assertions.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/parallel.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/unit.rb: Cannot open: Permission denied
....
....
test.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/pride_plugin.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/hoe/minitest.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/Rakefile: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/History.rdoc: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/README.rdoc: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_mock.rb: Cannot open: Permission denied
...
...
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_test.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/metametameta.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_benchmark.rb: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
# Ensuring correct file rights ...
# Clearing Cache ...
# Starting Zammad
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'zammad.service'.
Authenticating as: Ubuntu (adminsoc)
Password: 
==== AUTHENTICATION COMPLETE ===

# Zammad restored successfully - mar 16 nov 2021 10:44:17 -05!

zammad@hds:/opt/zammad/contrib/backup$ psql 
psql: error: FATAL:  database "zammad" does not exist
zammad@hds:/opt/zammad/contrib/backup$ exit
logout
root@hds:~# su - postgres 
postgres@hds:~$ psql 
psql (13.5 (Ubuntu 13.5-0ubuntu0.21.10.1))
Type "help" for help.

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | es_ES.UTF-8 | es_ES.UTF-8 | 
 template0 | postgres | UTF8     | es_ES.UTF-8 | es_ES.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | es_ES.UTF-8 | es_ES.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

postgres=#

First i dont know why appear “Authenticating as: Ubuntu (adminsoc)” because the hostname is hds also not is a session on this server, The same is with the message “su: Authentication failure” because i put th root password, then i see the databases but only delete zammad database and not restore.

The only one way that i can restore is uncompress the backup.tar.gz and with command postgresql i restore the psql file and i can restore all my information. Anybody can the same problem?

Greetings, guys!

I happen to have the same problem on Ubuntu Server LTS 20.04 with Zammad 5.0x installed as a package.

After the last zammad update (from version 5.0x to 5.0y), the backup script, that had always worked before, didn’t work anymore. Before the update, I was able to run the script with sudo, after the update, I encountered exactly the same error as @klausneil when executing it. I was able to bypass the problem by executing the backup script by the zammad user. Doing so, the backup completed without any errors.

Now, when I try to restore the backup files, I get exactly the same error as klaus, no matter if I use sudo or the zammad user.

Any constructive suggestions or hints to solve this are very welcome. And I am happy to buy you a beer :wink: