Public bug reported:

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/the-package/setup-package.py", line 3, in <module>
    from augeas import Augeas
  File "/usr/lib/python2.7/dist-packages/augeas.py", line 78, in <module>
    class Augeas(object):
  File "/usr/lib/python2.7/dist-packages/augeas.py", line 82, in Augeas
    _libaugeas = _dlopen("augeas")
  File "/usr/lib/python2.7/dist-packages/augeas.py", line 75, in _dlopen
    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 that any invocations of `ldconfig` during 
the installation of the dependent libraries, do nothing at all.
When adding `ldconfig -p >/tmp/ldconfig-output` to the postinst hook, one can 
see that neither libaugeas0 nor any other libraries that were just installed, 
are in the ldconfig cache at the moment the script is invoked.
Even when adding an explicit `ldconfig` 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 seems to indicate that there is some problem with I/O 
redirection, but for some reason the `-v` is also essential.

** Affects: dpkg (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Minimal example package that demonstrates the problem"
   
https://bugs.launchpad.net/bugs/1851675/+attachment/5303512/+files/the-package_1.2.3ubuntu1-2-1_all.deb

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1851675

Title:
  dpkg fails to properly invoke ldconfig

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1851675/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to