Apt/Dpkg issue: libc6 config error & ldconfig: /usr/lib/libndi.so.3 is not a symbolic link

As an example. If I want to remove gnome-menus (which I dont need, then I get the following error.

# apt remove gnome-menus
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  clamav-base clamav-freshclam gedit-common gir1.2-gmenu-3.0 gir1.2-gtksource-3.0 gir1.2-peas-1.0 kio libclamav9 libgnome-menu-3-0 libgspell-1-1 libgspell-1-common libgtksourceview-3.0-1 libgtksourceview-3.0-common libplacebo4
  libqapt3 libspatialaudio0 libtext-csv-perl libtfm1 libva-wayland2 libvulkan1 linux-headers-5.2.0-17.2-liquorix-amd64 linux-image-5.2.0-17.2-liquorix-amd64 mruby-zest postfix-sqlite python3-psutil
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  alacarte gnome-menus menulibre
0 upgraded, 0 newly installed, 3 to remove and 384 not upgraded.
7 not fully installed or removed.
After this operation, 2,997 kB disk space will be freed.
Do you want to continue? [Y/n] y
Setting up libc-bin (2.24-11+deb9u4) ...
ldconfig: /usr/lib/libndi.so.3 is not a symbolic link

dpkg: error: error executing hook 'if { test "$DPKG_HOOK_ACTION" = add-architecture || test "$DPKG_HOOK_ACTION" = remove-architecture; } && test -x /usr/share/pkg-config-dpkghook; then /usr/share/pkg-config-dpkghook update; fi', exit code 11
E: Sub-process /usr/bin/dpkg returned an error code (2)
E: Sub-process dpkg --set-selections received a segmentation fault.
E: Couldn't revert dpkg selection for approved remove/purge after an error was encountered!

This happens trying to install some packages that triggers the same error.

The similarities are e.g

  1. ldconfig: /usr/lib/libndi.so.3 is not a symbolic link
  2. libc6 configure fail

It seems there is a stale package that is unreported as I have to reinstall libc6 to uinbrick the system every time.

Anyone has an idea to fix this ?
The hint ios that it seems something reconfigures libc6 if I try to install or remove some packages.

Here is another screenshot of another apt/dpkg install fail
screenshot.

Have you tried

apt-get install -f

Yes sure I tried that;
I just did it again to confirm and it listed to fix the install of LMMS which a while ago triggered something to try and reconfigure libc6 and then fail and as a result of this reconfiguration brick the system.
I then have to reboot and follow “my own advice” see THIS to get the OS to boot again.

There is a stale package trying to upgrade libc or an apt/dpkg misconfig.
I am a bit out of ideas how to fix this one. I install new packages from sourced to avoid the bricking issue using apt.

Here is the output following your advice:

# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  clamav-base clamav-freshclam gedit-common gir1.2-gtksource-3.0
  gir1.2-peas-1.0 kio libclamav9 libgspell-1-1 libgspell-1-common
  libgtksourceview-3.0-1 libgtksourceview-3.0-common libplacebo4 libqapt3
  libspatialaudio0 libtext-csv-perl libtfm1 libva-wayland2 libvulkan1
  linux-headers-5.2.0-17.2-liquorix-amd64
  linux-image-5.2.0-17.2-liquorix-amd64 mruby-zest postfix-sqlite
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 384 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up lmms-common (1.1.3-7) ...
Setting up man-db (2.7.6.1-2) ...
Updating database of manual pages ...
Setting up shared-mime-info (1.8-1+deb9u1) ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'

Setting up gnome-menus (3.13.3-9) ...
Setting up hicolor-icon-theme (0.15-1) ...
Setting up lmms (1.1.3-7) ...
Processing triggers for menu (2.1.47+b1) ...
/usr/share/menu/w3m: 1: /usr/share/menu/w3m: Syntax error: word unexpected (expecting ")")
/usr/share/menu/galternatives: 1: /usr/share/menu/galternatives: Syntax error: word unexpected (expecting ")")
/usr/share/menu/tcl8.5: 1: /usr/share/menu/tcl8.5: Syntax error: word unexpected (expecting ")")
/usr/share/menu/gnome-ppp: 1: /usr/share/menu/gnome-ppp: Syntax error: word unexpected (expecting ")")

Truncated..a lot of similar errors as above

W: APT had planned for dpkg to do more than it reported back (3 vs 19).
   Affected packages: gnome-menus:amd64 hicolor-icon-theme:amd64 lmms-common:amd64 man-db:amd64 shared-mime-info:amd64

Another hint is how this ended … a dpkg error (see end of above) , but I cannot find the source of the problem. Only knowing that iot is apt/dpkg doing it and that dpkg triggers a failed reconfigure of libc.

I cannot reinstall this server. It works like greased lighning and took a long time to set up. It will have to do what it does for 3 years before I upgrade, so i need to rather try and find why this happens with dpkg and fix it.

Installing from sources is absolutely no problem.

Also what is important:
libc6 reconfigure error that creates terminal segfaults doesnt occur for every apt package installed. Only some triggers the libc6 reconfigure. I couldnt find a pattern yet, but one that came up is gnome menus.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki