Linux – How to remove ‘update-alternatives’ links on Linux

centosdebianlinuxsymbolic-link

Sorry for asking this, but I cannot resolve such a simple issue for a few hours:

I made a typo mistake in

update-alternatives --install /usr/lib64/R/lib/libRblapack.so libRblapack.so /usr/lib64/R/lib/libRblapack_native.so 100

It should be libRlapack.so instead of libRblapack. The problem is that if issue a correct command line, i.e.

update-alternatives --install /usr/lib64/R/lib/libRlapack.so libRlapack.so /usr/lib64/R/lib/libRlapack_native.so 100

it returns an error:

the primary link for libRlapack.so must be
/usr/lib64/R/lib/libRblapack.so

I tried

update-alternatives --remove libRblapack.so /usr/lib64/R/lib/libRblapack.so

but it doesn't work – returns the same error when entering a correct command.

How can I get it fixed?

Thanks!

Best Answer

I would try cleaning it up manually. I've never done this so make sure you backup beforehand.

  • Remove the link from /etc/alternatives
  • Remove the relevant file from the admin directory
    • /var/lib/dpkg/alternatives/ on ubuntu (debian may be the same but check the man pages under the FILES section)
    • /var/lib/alternatives/ on CentOS 6&7