Re: Delayed ldconfig execution in postinst step
Eduard Bloch <email@example.com> writes:
> Hi people,
> I just wondered why exactly my laptop uses that much time for updates
> and I think that calling ldconfig is a main problem. In theory, it
> should not cost much time because VFS cache has the relevant file parts.
> However, if memory is limited and there are other applications running,
> the VFS cache is flushed sooner thank you think, especially with
> today's count of various libraries in /usr/lib.
> I think, it would be enough to call ldconfig only once after dpkg is
> trough. Reasons:
> - there are no dangerous transitions (libc5->libc6) that would require
> having updated ld.so.cache immediately
> - all applications should follow the ld.so.conf paths if something is
> not in the cache. No problem here.
> The simplest idea for implementation is just having a script called
> ldconfig, put in the PATH of dpkg. It registers ldconfig calls, waits
> for the termination dpkg and runs /sbin/ldconfig.
> Any objections, ideas? There may be corner cases where that assumptions
> do not work but if we integrate this into the distribution, we can find
> and fix the problems really soon.
I've suggested this in the past but let me repeat it.
I think it would be a good idea to have a general dpkg hook to
register a command to be run at the end of dpkg. The syntax would be
something like this:
dpkg-hook /usr/lib/man/update-manpages - run only once in total
dpkg-hook --on-depends foobar ldconfig - run once before depends of foobar
dpkg-hook --add-option add-font -- path - add argument 'path' to a
previous add-font hook
dpkg-hook --no-wait foobar - run foobar in the background
When dpkg is invoked it woul run those hook between depends of
packages or before terminating. When apt is run it could pass an
option to dpkg (except on the last run) to not run the hooks on exit
and they would be gathered for the full apt run.
Your option has the benefit of working NOW while mine would be more
general and work for manpages, fonts, menus, .... But one could
combine the two, make /usr/lib/dpkg/ldconfig into a script that calls
'dpkg-hook --on-depends foobar /sbin/ldconfig'. The --on-depends might
not be needed as you said, one would have to try that.