[Dbconfig-common-devel] Package fails to remove database on
postgresql
Michael Ablassmeier
abi at grinser.de
Fri Sep 15 08:02:29 UTC 2006
hi,
im currently working on implementing postgreSQL support in one of my
packages. One problem i have faced is: the Package fails to deconfigure
the database if the username used for Postgresql user is the same as the
local system user created by the package.
To be more specific: the package creates an system user "zabbix" which
is used for the zabbix-server Process to run with:
zabbix:x:105:107::/var/run/zabbix-server/:/bin/false
while setting up the database, all goes well (auth unix/socket and
ident):
Setting up zabbix-server-pgsql (1.1.2-2) ...
[..]
Creating config file /etc/zabbix/zabbix_server.conf with new version
creating postgres user zabbix: already exists.
resetting password: success.
creating database MYDATABASE: success.
verifying database MYDATABASE exists: success.
populating database via sql... done.
dbconfig-common: flushing administrative password
Starting Zabbix server: zabbix_server
so, dbconfig-common simply tells me the zabbix user does already exist.
the packages .postinst does:
#!/bin/sh
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
[..]
dbc_go zabbix-server-pgsql $@
if [ "$1" = "configure" ]; then
[..]
if ! getent passwd zabbix > /dev/null 2>&1 ; then
adduser --quiet \
--system --disabled-login --ingroup zabbix \
--home /var/run/zabbix-server/ --no-create-home \
zabbix
fi
chown zabbix:zabbix /var/log/zabbix-server -R
chown zabbix:zabbix /var/run/zabbix-server -R
fi
dbconfig-common then behaves weird on removing the database:
Removing zabbix-server-pgsql ...
dbconfig-common: dumping pgsql database MYDATABASE to
/var/tmp/zabbix-server-pgsql.MYDATABASE.2006-09-15-09.58.pgsql.q27709.
dbconfig-common: dropping pgsql database MYDATABASE.
dropping database MYDATABASE: does not exist.
dbconfig-common: revoking privileges for user zabbix on MYDATABASE.
revoking access to database MYDATABASE from zabbix at localhost: failed.
Stopping Zabbix server: zabbix_server
Purging configuration files for zabbix-server-pgsql ...
postrm looks like:
#!/bin/sh
[..]
if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postrm.pgsql
fi
dbc_go zabbix-server-pgsql $@
case "$1" in
[..]
purge)
rm -fr /var/log/zabbix-server
rm -fr /var/run/zabbix-server
rm -f /etc/zabbix/zabbix_server.conf
ucf --purge /etc/zabbix/zabbix_server.conf
;;
[..]
when selecting another username during the installation, i get the
following warning during installation:
populating database via sql... warning: ident method specified but
local account doesn't exist.
but removing the database works well. This leads to one question:
Shouldn't the creation and removal of the Database done by some Adminstrative
postgresql user to be fully independend on what user the package
creates?
bye,
- michael
More information about the Dbconfig-common-devel
mailing list