[Bug 1851675] Re: dpkg fails to properly invoke ldconfig
Alexander Thomas
doctor.lex at gmail.com
Thu Nov 7 16:51:23 UTC 2019
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:
http://launchpadlibrarian.net/433311114/dpkg_1.19.0.5ubuntu2.1_1.19.0.5ubuntu2.2.diff.gz
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.
** Description changed:
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])
+ 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
+ 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.
+ 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.
+
+ 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...
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/1851675
Title:
dpkg fails to properly invoke ldconfig
Status in dpkg package in Ubuntu:
New
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/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 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-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 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...
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1851675/+subscriptions
More information about the foundations-bugs
mailing list