Tag Archives: alternatives

Trading Places on Debian

To fit a particular job, several choices are often available. For softwares, it the same!

For example, while configuring a system we need a text editor. On recent distros, we get nano, on others we have vi (or a variant like nvi, vim…). On debian the defaukt editor is simply called editor.

Let’s see that:

$ which editor
/usr/bin/editor
$ ls -la /usr/bin/editor
lrwxrwxrwx 1 root root 24 mar  4 09:01 /usr/bin/editor -> /etc/alternatives/editor

So editor is not a program, simply a symbolic link to the same file name in /etc/alternatives and that last on is an other link to the actual editor program.

To update the editor we could change the link, but that’s quite direct were debian gives us a nice way to do it with the command: update-alternatives.
Obviously to update system configuration you have to be root (use su or sudo whatever you like best)

# update-alternatives --config editor

A text menu will propose you the available alternatives.

That’s for the big picture, I was first on using this on the case of the flash plugin for firefox (well iceweasel). Even after installing flash form debian-multimedia repository, firefox was still using swfdec, ad removing swfdec was breaking gnome’s dependencies… The solution is above, firefox uses a flash-mozilla.so plugin, this is an alternative! So:

# update-alternatives --config flash-mozilla.so
There are 2 choices for the alternative flash-mozilla.so
  Selection    Path
-----------------------------------------------
*+        1    /usr/lib/swfdec-mozilla/libswfdecmozilla.so
          2    /usr/lib/flashplayer-mozilla/libflashplayer.so
Press enter to keep the current choice[*], or type selection number:2
update-alternatives: using /usr/lib/flashplayer-mozilla/libflashplayer.so to provide flash-mozilla.so.

You did it!

That’s no because flash is not open source that we have to read on debian or ubuntu forums that the solution is to remove manually libswfdecmozilla.so or any similar nonsense, there is a way to do it, that what new users should learn.