Broken link? How to fix?

I am now seeing this message during an update in Ubuntu 20.04.

/sbin/ldconfig.real: /usr/lib/ is not a symbolic link

How do I fix this? I have searched the net without finding a solution at this time.


First of all. Welcome to the community.

Try running “ldconfig -v” to find the link then you can ID the errant link.

Thanks, did that with a huge amount of data displayed and identified, how do I fix this ‘broken’ link?

Copy of part of the data displayed. →
/sbin/ldconfig.real: /usr/local/lib/ is for unknown machine 40. -> ->

/sbin/ldconfig.real: /usr/local/lib/ is not a symbolic link -> ->


The question is: Do you even need to bother?

ldconfig caches recently used libraries and the symbolic links to them.

Say, a program foo needs a certain library bar.1, but bar.1 gets updated, and hence gets a new name bar.2.
If you now run foo, it won’t find the library it needed and will crash.

In order to avoid this kind of problems, a symbolic link bar is created, which will always point to the current version bar.X.

ldconfig keeps a list of these most recently links in order to speed up access.

If during an update, the need for the library bar.X is removed, so is the symbolic link bar to the library bar.X, but the information about it is still stored in ldconfig's database and hence, it will complain about this missing link.

I make the educated guess that, after complaining, it will eventually remove the corresponding entry in its database after a certain time.

As long as bar is really not needed any more, everything’s fine, and you won’t get any further complaints during future updates.

However, when updating my system or a certain program, I often get the question:

The following packages/libraries/programs are no longer needed. Do you want to remove them? (y/n)

Seems sensible not to clutter your system with unused programs and libraries. So far the theory. In practice, I often found these x is no longer needed to be far too optimistic, and I had to reinstall stuff that was automatically removed.

So, as a matter of precaution, I always say no to automatic removals unless I’m absolutely sure. As I’m a hoarder and lazy by nature, I prefer keeping a few MB of useless data to having to reinstall accidentally deleted packages.