I've encountered the following problem when using
debconf to configure a package in Ubuntu 16.04 during installation.
More precisely, the package uses
debconf to save configurations files, and right after, in the
postinst script, a service is started. This service also uses a
debconf module to load the configurations saved in the previous step.
However, the service started with
systemd fails with the error:
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
From what I could find,
dpkg is still accessing this file with the
debconf frontend, and the service crashes when it tries to start another frontend (the environmental variable
DEBIAN_HAS_FRONTEND is not passed to the service). I have tried forcing the env variable
DEBIAN_HAS_FRONTEND in the script, but then other errors appear.
I think I should force starting the daemon after the
dpkg process has ended, and
debconf has already finished, any ideas?