Debian package installation script overwrite debian dpkg statoverride.

From: Олег Самойлов <od(dot)samoylov(at)interfax(dot)ru>
To: "pgsql-pkg-debian(at)postgresql(dot)org" <pgsql-pkg-debian(at)postgresql(dot)org>
Cc: Роман Сутемьев <Roman(dot)Sutemiev(at)interfax(dot)ru>
Subject: Debian package installation script overwrite debian dpkg statoverride.
Date: 2026-08-01 09:28:04
Message-ID: cdf808f5b18b4097b816b9bf6049decf@interfax.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-debian

Hi all.

Original ticket:
https://github.com/EnterpriseDB/barman/issues/1211

I tried to use barman to backup on mounted NFS in "local" way. Here is some conflict with ownership, because barman by default work under user barman, but backup files must have owner postgres. So I changed user for barman to postgres and so do for barman directories. There is mechanics in Debian how to do this permanently. Need to use dpkg-statoverride:

dpkg-statoverride --add postgres postgres 750 /var/lib/barman
dpkg-statoverride --add postgres postgres 750 /var/log/barman
But this is dont work, the directory still change ower to user barman after package upgrading, because in the installation script there is the code that overwrite dpkg-statoverride, in "postinst" script is:

# Make sure the home and log directories exist
for dir in /var/lib/barman /var/log/barman
do
mkdir -p $dir
chown barman:barman $dir
chmod 750 $dir
done
Instead of this "make sure" code the directory must be correctly created in the debian package.

In the file barman.dirs exists only:

/var/lib/barman
But /var/log/barman must be here too.

As for permissions and ownership, the debian policy said
https://www.debian.org/doc/debian-policy/policy.txt
10.10.1. The use of "dpkg-statoverride"

If a system administrator wishes to have a file (or directory or other
such thing) installed with owner and permissions different from those
in the distributed Debian package, they can use the "dpkg-
statoverride" program to instruct "dpkg" to use the different settings
every time the file is installed.

But you use debhelper and I don't see easy method to change ownership of the directory created by dh_installdirs.
But some solutions can be googled.

Browse pgsql-pkg-debian by date

  From Date Subject
Next Message apt.postgresql.org Repository Update 2026-08-02 17:36:52 pg-rational updated to version 0.0.3-1.pgdg+1
Previous Message Christopher Lorenz 2026-08-01 08:19:37 Bullseye v18 repo not working