13

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!

user2723490
  • 267
  • 1
  • 3
  • 9

2 Answers2

9

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
user9517
  • 115,471
  • 20
  • 215
  • 297
8

Removing them manually resulted in ... is already managed by ... error in my case. Aside from that, the manual removal also didn't scale, as i've had added multiple multiple alternatives for the centralized symlink. It's just a mess.
When it comes to either update-alternatives or alternatives, they both provide the --remove and --remove-all flags. As for the former flag, it only removes one single alternative of the link group. For example

$ update-alternatives --list python3
/usr/bin/python3.8
/usr/bin/python3.9

$ sudo update-alternatives --remove python3 /usr/bin/python3.9

$ update-alternatives --list python3
/usr/bin/python3.8

The form of the --remove flag goes by update-alternatives --remove symlink-generic-name /path/to/one/executable/alternative

However, if you want to outright erase the generic name with all of its associated alternatives all at once, then --remove-all is the way to go.

$ update-alternatives --list python3
/usr/bin/python3.8
/usr/bin/python3.9

$ sudo update-alternatives --remove-all python3

$ update-alternatives --list python3
update-alternatives: error: no alternatives for python3

$ update-alternatives --query python3
update-alternatives: error: no alternatives for python3
polendina
  • 91
  • 1
  • 4