apt-get dist-upgrade -y can break your zammad install

Used Zammad Version

6.3.1

Environment

  • Installation method: package
  • Operating system Ubuntu 24.04 LTS
  • Database + version: (PostgreSQL) 16.4 (Ubuntu 16.4-0ubuntu0.24.04.1)
  • Elasticsearch version: 7.17.23
  • Browser + version: ----

Actual behaviour

I had upgrades pending for zammad but also:

postgresql-16/noble-updates 16.4-0ubuntu0.24.04.2 amd64
postgresql-client-16/noble-updates 16.4-0ubuntu0.24.04.2 amd64

Doing a apt-get dist-upgrade -y gave this error:

Preparing to unpack .../12-zammad_6.3.1-1724757244.41b98ccb.noble_amd64.deb ...
!!! ERROR !!!
Your database does not seem to be online!
Please check your configuration in config/database.yml and ensure the configured database server is online.
Exiting Zammad package installation / upgrade - try again.
dpkg: error processing archive /tmp/apt-dpkg-install-iusG7U/12-zammad_6.3.1-1724757244.41b98ccb.noble_amd64.deb (--unpack):
 new zammad package pre-installation script subprocess returned error exit status 1
# Enforcing Redis...
# Creating Redis bootstart
Synchronizing state of redis-server.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/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...
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (ActiveRecord::ConnectionNotEstablished)
        Is the server running locally and accepting connections on that socket?

As this was a VM, I just reverted to a previous snapshot and did:

sudo apt-mark hold postgresql-16 postgresql-client-16

so this packaged wouldn’t upgrade. After that I went:

sudo apt-get update
sudo apt-get dist-upgrade -y

And zammad upgraded successfully.

After that I did:

sudo apt-mark unhold postgresql-16 postgresql-client-16

and

sudo apt-get update
sudo apt-get dist-upgrade -y

And everything went fine.

I don’t know if this is documented and can be somehow improved in terms of the upgrade process via apt-get

Expected behaviour

apt-get dist-upgrade -y shouldn’t break the current install

Steps to reproduce the behaviour

This rarely happens. Mostly, when your psql-upgrade hasn’t finished when the zammad upgrade runs. I usually use the apt-mark hold on the zammad package whenever there is also a psql or es update in queue. And upgrade zammad seperatly after that.

Zammad should be stopped during a postgres update. It theoretically restores the db connection, however, may cause race conditions in e.g. email fetching you could spare yourself with.

Should this then not recommended in the docs? I heard this apt-mark hold trick a couple of times, but it is not mentioned in Updating Zammad — Zammad System Documentation documentation

ah lol it is thx @YetAnotherGerrit Add "apt-mark hold zammad" to the update suggestion · Issue #525 · zammad/zammad-documentation · GitHub