Upgrade Zammad 6.0 to 6.1 failed

I want to add that the mysqladmin command uses credentials found in /etc/mysql/debian.cnf for the root user and it also works as expected:

# mysqladmin -h localhost -u root ping
mysqld is alive

This however fails in dpkg pre-install phase - as previous logged installation error suggests.

1 Like

The 6.1 dpkg preinst script looks like

...
elif [ -n "$(which mysql 2> /dev/null)" ]; then
   if [ "${DB_PORT}x" == "x" ]; then
      DB_PORT="3306"
   fi

   mysqladmin status -h $DB_HOST -P $DB_PORT
   state=$?
fi

# Check error state to ensure database is online
if [[ $state -gt 0 ]]; then
   echo "!!! ERROR !!!"
   echo "Your database does not seem to be online!"
   echo "Please check your configuration in config/database.yml and ensure the configured database server is online."
   echo "Exiting Zammad package installation / upgrade - try again."

   exit 1
fi
...

The bug/issue seems to be caused by the fact that following call succeeds:

# mysqladmin status -h localhost
Uptime: 2603  Threads: 36  Questions: 209452  Slow queries: 0  Opens: 170  Open tables: 163  Queries per second avg: 80.465

But the one with port specified (as in preinst script) fails:

# mysqladmin status -h localhost -P 3306
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost''

I’ve confirmed that the server is listening at 127.0.0.1:3306 and localhost resolves to 127.0.0.1, but database credentials do not allow mysqladmin root connection from network interface (default debian configuration).

There should not be any difference between calling mysqladmin with -P 3306 and without it but there is.

Maybe preinst script could take this difference in account and bypass the port parameter if it matches the default value of 3306?

MySQL user db lists ‘root@localhost’ (checked that!):

]> SELECT user,host FROM mysql.user;
+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| zammad      | %         |
| mariadb.sys | localhost |
| mysql       | localhost |
| root        | localhost |
+-------------+-----------+
4 rows in set (0.002 sec)
1 Like

We disabled the connectivity check temporarily in Maintenance: Temporarily disable db connectivity check in binary pack… · zammad/zammad@2776710 · GitHub until the issues are sorted. As soon as the builds are finished, you should be able to update without this issue.

I can confirm that package build 6.1.0-1694675110.2776710a skips the failing connectivity check and installs without issue.

Thank you for your quick response.

1 Like

(MySQL scope)
As Zammad supports external databases, the port technically is required because admins may use different ports. That’s the reason it’s in the script.

Using the credentials from the OS most often does not work because most users don’t have that in scope and may not adjust the configuration accordingly. With this we’d rely on something potentially non functional. The aim for this change was to help admins not nuke them (we’ll I managed that any way…)

Can you please run

mysqladmin status -h localhost -P 3306 -u <zammaduser> -p <zammaddbpassword>
echo $?

for me?
Adjust -u and -p with your database credentials and remove them from the command before posting them here please. As we’re checking the error code the echo is relevant for me as well. I’m on vacation so if you could help me with that cross check it would be a huge help for me to get this sorted out asap in a functional way.

mysqladmin -p parameter does not accept password from command line but can be used to enable password prompting. With that, and correct password:

# mysqladmin status -h localhost -P 3306 -u zammad -p ; echo $?
Enter password: 
Uptime: 10912  Threads: 13  Questions: 17237  Slow queries: 0  Opens: 227  Open tables: 164  Queries per second avg: 1.579
0
1 Like

I have to add that this is contrary to the mysqladmin docs:

-p, --password[=name] 
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty.

Not directly related to this, but no matter what I try, I cant get mysqladmin to accept password from command line parameters. It always falls back to tty prompting.

Not only with the -P parameter for port, but with this, mysqladmin is does not seem to work consistently and match the behaviour of other CLI tools with similar parameters.

# mysqladmin --version
mysqladmin  Ver 9.1 Distrib 10.6.15-MariaDB, for debian-linux-gnu on x86_64
1 Like

Confirmed similar behaviour with next MariaDB LTS version 10.11:

# mysqladmin --version
mysqladmin  Ver 9.1 Distrib 10.11.5-MariaDB, for debian-linux-gnu on x86_64

This means that authentication with -h localhost -P 3306 differs from -h localhost even when default port is in use and -p / --password never accepts cmdline argument as value; password is instead incorrectly passed as command.

1 Like

Okay that sucks. I did check the docs.
Does the check work without trouble if you just leave the password be and provide port, host and user?

For me, in two Zammad installations, preinst check works if -P 3306 is omitted when defaut MySQL port is used by the server. Plain -h localhost works, -h localhost -P 3306 does not work. There is no obvious reason for this as database has user credentials for root@localhost and zammad@% - looks more like bug than mismatched credentials.

Passing custom user with -u works, but -p does not work as documented for command line supplied passwords.

I do not run Zammad db in non-standard port so I have not tested that scenario.

1 Like

Thank you very much for your help on that regard.
A colleague is already verifying our adjustments.

For now it’s working but still would be great to ensure the database is available during the upgrade :slight_smile:

1 Like

Agreed. Hopefully you find a working solution.

Maybe there is something I’m missing here, but this result was not what I expected:

# mysqladmin ping -u root -h localhost 
mysqld is alive

# mysqladmin ping -u root -h localhost -P 3306
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost''

For now it seems that the temporary solution allows the upgrade to proceed as expected.

mysqladmin -p parameter does not accept password from command line but can be used to enable password prompting.

The -p flag cannot be used with whitespace between the flag and the password. Otherwise it prompts for a password interactively.

-p mysupersecret will prompt for a password.
-pmysupersecret will not.

I am as well trying to upgrade from 6.0 to 6.1 i have installed redis and updated all system packages before zammad upgrade , Now i am stuck with more than 2 hours with the below progress

The following packages will be upgraded:
zammad
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 141 MB of archives.
After this operation, 2,495 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 18.04/main amd64 zammad amd64 6.1.0-1695897125.3f8a4154.bionic [141 MB]
Fetched 141 MB in 27min 20s (85.8 kB/s)
(Reading database … 710276 files and directories currently installed.)
Preparing to unpack …/zammad_6.1.0-1695897125.3f8a4154.bionic_amd64.deb …
Unpacking zammad (6.1.0-1695897125.3f8a4154.bionic) over (6.0.0-1694581997.6c378be7.bionic) …
Setting up zammad (6.1.0-1695897125.3f8a4154.bionic) …

Enforcing Redis…

Creating Redis bootstart

Synchronizing state of redis-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable redis-server

Starting Redis server

Redis server is running.

(Re)creating init scripts

Nothing to do.
Nothing to do.
Nothing to do.

Enabling Zammad on boot

Stopping Zammad

Clear cache…

database.yml found. Updating db…

== 20230508101744 TechDebt297ThreeStateBoolean: migrating =====================
– change_column_null(:users, :vip, false, false)

Progress: [ 67%] [###############################################################################################################################################…]

Its been at 67% since 2 hours

@kushalg-1212 Please don’t hijack posts with your issues. It doesn’t fit. Open your own thread if you still need help please.