Zammad error after upgrade v5

Hi, today i updated my server and zammad upgrae from my 4.x version to 5.x but i lose the access to the portal.

image

when i make a backup appearme this:

# Zammad backup started - jue 28 oct 2021 14:26:45 UTC!

creating file backup...
creating postgresql backup...
pg_dump: error: connection to database "zammad" failed: FATAL:  Peer authentication failed for user "zammad"

# Zammad backuped successfully - jue 28 oct 2021 14:27:06 UTC!


image
image
image

Please help me, how can resolve this.

Hi @YosefAdPro i execute the script as zammad user but nothing, also why appearme errors with postgres?

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

# Zammad backup started - jue 28 oct 2021 16:19:57 UTC!

creating file backup...
tar (child): /var/tmp/zammad_backup/20211028161957_zammad_files.tar.gz: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: /var/tmp/zammad_backup/20211028161957_zammad_files.tar.gz: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ln: failed to create symbolic link '/var/tmp/zammad_backup/latest_zammad_files.tar.gz': Permission denied
creating postgresql backup...
pg_dump: error: could not open output file "/var/tmp/zammad_backup/20211028161957_zammad_db.psql.gz": Permission denied
ln: failed to create symbolic link '/var/tmp/zammad_backup/latest_zammad_db.psql.gz': Permission denied

# Zammad backuped successfully - jue 28 oct 2021 16:19:58 UTC!

What permissions are set on the path “/var/tmp/zammad_backup”?

ls -halFs /var/tmp/zammad_backup

and

stat /var/tmp/zammad_backup

Post the output here.

Hi @YosefAdPro i follow you recommendation but not work for me, i change to zammad session (su - zammad) then i probe executing psql and work i canlist the database zammad, then i execute ./zammad-restore.pl but appearme this message.

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

# Zammad restored started - Sun Oct 31 06:47:23 PM UTC 2021!

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: 
20211030091129
File date: 20211030091129
Enter db date to restore: 
20211030091129
DB date: 20211030091129
# Stopping Zammad
Failed to stop zammad.service: Access denied
See system logs and 'systemctl status zammad.service' for details.
# 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/README.rdoc: 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/lib/minitest/unit.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/pride.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/expectations.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/pride_plugin.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/benchmark.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/test.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/mock.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/hell.rb: 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/hoe/minitest.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/test/minitest/test_minitest_benchmark.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_reporter.rb: 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_assertions.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/History.rdoc: Cannot open: Permission denied
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/Manifest.txt: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
# Ensuring correct file rights ...
# Clearing Cache ...
# Starting Zammad
Failed to start zammad.service: Access denied
See system logs and 'systemctl status zammad.service' for details.

# Zammad restored successfully - Sun Oct 31 06:48:31 PM UTC 2021!

And the path /var/tmp/zammad_backup have the permission on zammad user and group. What could be happen? please help me

Hi, i read that the problem FATAL: Peer authentication failed for user “zammad” then i change pg_hba.conf and i create a line zammad all all peer and restart the postgresql service; i execute the script for restore but dont work.This is a new server cause when i update my system zammad make a upgrade from v4 to v5 and can’t loggin to the system then i make a backup but this dont work in first time i put perssions of user zammad on postgresql and i can make a backup of the database, now in the new system i try restore this nackup but dont work. Why dont work this? The upgrade has errors? this is the message of the error:

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

# Zammad restored started - Sun Oct 31 08:46:08 PM UTC 2021!

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: 
20211030091129
File date: 20211030091129
Enter db date to restore: 
20211030091129
DB date: 20211030091129
# Stopping Zammad
Failed to stop zammad.service: Access denied
See system logs and 'systemctl status zammad.service' for details.
# 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/README.rdoc: 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/lib/minitest/unit.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/pride.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/expectations.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/pride_plugin.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/benchmark.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/test.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/mock.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/hell.rb: 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/hoe/minitest.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/test/minitest/test_minitest_benchmark.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_reporter.rb: 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_assertions.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/History.rdoc: Cannot open: Permission denied
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/Manifest.txt: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
# Ensuring correct file rights ...
# Clearing Cache ...
# Starting Zammad
Failed to start zammad.service: Access denied
See system logs and 'systemctl status zammad.service' for details.

Hi,

Did you install zammad on the new machine before the restore?

@YosefAdPro yes, sure. zammad is correctly installed in v5.

@YosefAdPro i make a backup of the first configuration base, but i probed if this work with the script to restore and this not work and not recovery the database and appearme this message of error:

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

# Zammad restored started - Sun 31 Oct 2021 08:15:00 PM -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: 
20211031194648
File date: 20211031194648
Enter db date to restore: 
20211031194648
DB date: 20211031194648
# Stopping Zammad
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'zammad.service'.
Authenticating as: Ubuntu (adminhds)
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
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/hell.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/expectations.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/pride.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/benchmark.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/mock.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/lib/minitest/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_spec.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_reporter.rb: Cannot open: Permission denied
tar: opt/zammad/vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/test/minitest/test_minitest_assertions.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: opt/zammad/config/database.yml: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
# Ensuring correct file rights ...
chown: changing ownership of '/opt/zammad/config/database.yml': Operation not permitted
# Clearing Cache ...
# Starting Zammad
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'zammad.service'.
Authenticating as: Ubuntu (adminhds)
Password: 
==== AUTHENTICATION COMPLETE ===

# Zammad restored successfully - Sun 31 Oct 2021 08:16:22 PM -05!

zammad@hds:/opt/zammad/contrib/backup$

Please anybody can help me? or that has a the same problem?

I also had these errors when I did not initiate the restore as user “zammad”.

Zammad needs the postgres socket connection for the restore.

Also the user rights from the backup must match.

A backup where the data contained therein belongs to user “XYZ” (i.e. not to user zammad) led to errors for me.

I manually edited the backup in such a case and corrected all owners.
(Unpack, adjust, recompress). However, utmost caution is required when doing so. The structure must not be changed. It is best to make another copy of the backup.

PS: I also ended up installing/setup a completely new OS with completely fresh Zammad to rule out all sources of error.

Hi @Anagastes i try newly restore the backup first i put the owner as zammad:zammad and execute the ./zammad_restore with zammad user but appearme some alerts and finish as successfull, then i try restore the backup with postgresql command, with zammad user i execute psql -U zammad zammad < 20211030.psql and all work but when i see inside the database with commands not appear me my users only 2 users. Why this, please help me.

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:

I can also confirm the Issue on a fresh installed instance.

We had the same or a similar problem after updating from 4.x to 5.x (see All logins denied after update 4.1.0 -> 5.0.2). In our case it was a database migration issue which was solved by (thanks to @MrGeneration)

systemctl stop zammad
zammad run rails r "Cache.clear"
zammad run rake db:migrate
systemctl start zammad

Still getting the error:
Peer auth error.

root@host:~# /opt/zammad/contrib/backup/zammad_restore.sh

# Zammad restored started - Thu 09 Dec 2021 12:43:37 AM 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
could not change directory to "/root": Permission denied
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 - Thu 09 Dec 2021 12:43:58 AM UTC!

And when trying

root@host:~# cd /opt/zammad/contrib/backup/ && sudo -u zammad -H ./zammad_restore.sh

# Zammad restored started - Thu 09 Dec 2021 12:51:01 AM 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:

It can’t stop zammad service as zammad user.

I normally do this as root user

Hi guys, @Lapotor well i have a solution but very manual cause i make a restore with commands of postgres; before i execute the script .zammad_restore.pl and finnish with error after i execute

psql -U username -d dbname < filename.sql

And i can restore all my data and the zammad can start, but yet the script not work i tryed execute as zammad user.

Will try it hope that it helps.

Tbh.
@MrGeneration still don’t believe that failing restore script on fresh install is not a bug.

Hello guys!

Thank you, @klausneil. May I ask, when do you import the psql-file?
I have a fresh install of zammad on Lubuntu. Do you run the zammad-Wizard to “Setup new System” before executing the import command? I take it that the “dbname” is zammad, but what user do you use? Is it zammad as well? I am asking because I tried your approach and I did not succeed. In my case the backup restore script finishes deleting the zammad database and throwing out the same errors you posted earlier (“authentification failure…”). So, I cannot even login to the psql-terminal with the zammad user anymore after executing the restore-script, like you described. I would have to recreate the zammad database manually…

As far as I can tell, and I am sorry to say that, we are still groping in the dark. Moreover, I am not sure if it is a good idea to fiddle with the database manually. Who knows what other surprises might be in store for us after the next future update…

@Lapotor I totally agree. Has @MrGeneration posted anything on this matter? Be that as it may, I had tested the backup and restore functions quite a bit before I started using zammad. Everything worked just fine, until the upgrade. I did that hoping to prevent finding myself in a situation I am finding myself now.