python-augeas may fail to load libaugeas0 in postinst script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-augeas (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Seen on: Ubuntu 18.04.3 LTS
dpkg version: 1.19.0.5ubuntu2.3 (also in 1.19.0.5ubuntu2.2)
Regression compared to dpkg 1.19.0.5ubuntu2.1
To reproduce this:
1. You need a package that depends on a library for running a script in its postinst hook. For instance, the attached minimal package has `Depends: python-augeas`, and tries to do “from augeas import Augeas” in a script invoked from the postinst hook. (It does nothing else.)
2. Make sure the dependent library is not yet installed. In this example: libaugeas0, which is a dependency of python-augeas.
3. apt-get install the package. For the attached exmple, you can use `dpkg -i`, followed by `apt-get -f install`.
Result:
Setting up the-package (1.2.3ubuntu1-2-1) ...
Traceback (most recent call last):
File "/usr/lib/
from augeas import Augeas
File "/usr/lib/
class Augeas(object):
File "/usr/lib/
_libaugeas = _dlopen("augeas")
File "/usr/lib/
raise ImportError("Unable to import lib%s!" % args[0])
ImportError: Unable to import libaugeas!
dpkg: error processing package the-package (--configure):
installed the-package package post-installation script subprocess returned error exit status 1
Simply running apt-get -f install afterwards will succeed and run the postinst script.
The cause of this problem seems to be either that any invocations of `ldconfig` during the installation of the dependent libraries, do nothing at all, or rather that `ldconfig` is not invoked when it should be.
When adding `ldconfig -p >/tmp/ldconfig-
Even when trying to perform an ugly workaround by adding an explicit `ldconfig` invocation in the postinst script before running the python script, it still fails.
Very curiously, calling `ldconfig -v >/dev/null` instead, somehow makes ldconfig work. This is probably because ldconfig calls are actively blocked in maintainer scripts, but adding the argument and redirect circumvents this block...
description: | updated |
After some further investigation, this problem is probably not Ubuntu-specific but originated in upstream Debian and was cherry-picked as part of these changes: launchpadlibrar ian.net/ 433311114/ dpkg_1. 19.0.5ubuntu2. 1_1.19. 0.5ubuntu2. 2.diff. gz
http://
These changes include attempts to avoid trigger loops. One of the triggers is ldconfig (see /var/lib/ dpkg/info/ libc-bin. triggers) . It seems that the changes have caused certain triggers to be postponed too much. If a package states it depends (directly or indirectly) on a library, one expects that this library is not just unpacked, but also available at the moment the package enters its setup phase.
We have also tried to move python-augeas to Pre-Depends: instead in the hopes of causing the ldconfig to be triggered before the postinst is invoked, but this makes no difference.