Discovering Uninstalled Alternatives for /etc/alternatives

Smylers Smylers at stripey.com
Sat Aug 27 08:15:13 UTC 2011


Ric Moore writes [slightly re-ordered, and combining two messages]:

> On Fri, 2011-08-26 at 15:00 +0100, Smylers wrote:
> 
> > Ric Moore writes:
> > 
> > > On Wed, 2011-08-24 at 10:55 +0100, Smylers wrote:
> > > 
> > > > Hi there. How do I find out which packages provide an
> > > > alternative for a particular entry in /etc/alternatives? ...
> > > > update-alternatives only lists alternatives that I already have
> > > > installed.
> > > > 
> > > > What I want is a list of all packages that provide a particular
> > > > alternative, so that I can consider installing them.
> > > 
> > > I just went through the same thing... in synaptic, search on
> > > alternatives and you'll see two different gui's for alternatives.
> > > Works a charm.
> > 
> > Unfortunately not. As it happens I'd already tried galternatives and
> > it doesn't help; it just does the same thing as the
> > update-alternatives command, listing only alternatives I already
> > have installed.
> 
> I'll log into gnome and get back to you... galternatives on my machine
> shows up in applications/system tools/alternatives configurator

As I said, I have already run galternatives, which ran very intuitively
simply by typing galternatives at a command prompt. But galternatives
doesn't do the thing I'm looking for.

> > > It'll show up in your system preferences. I used the KDE one.
> > 
> > kalternatives ... doesn't show up in 'System Settings' ... I then
> > thought I could just run the kalternatives program directly, only
> > there isn't a program of that I name! ... I then used dpkg -L to
> > list the files in the kalternatives package ... the only significant
> > file ... is /usr/lib/kde4/kcm_kalternatives.so -- which isn't
> > something I can run directly.
> > 
> > How can I run kalternatives, please?
> 
> on KDE

As I mentioned, I'm using Gnome. But in general KDE application still
run under Gnome.

> (if you use synaptic, click on kalternatives and "packages" you'll see
> what was installed and where.

As I mentioned, I have already run dpkg -L to list the files in the
kalternatives package, so I know which files were installed and where.
What I was wanting to know was how to run the program installed in
/usr/lib/kde4/kcm_kalternatives.so.

Fortunately I discovered this myself with some guesswork. Since the
filename was prefexied "kcm_" I guessed KCM might be the name of an
overall system that this is a loadable module for. Typing kcm Tab at a
shell lists a command called kcmshell4, whose --help option says it
takes a 'module' argument. And indeed this command did run
kalternatives:

  $ kcmshell4 kalternatives

> It is not installed to /usr/bin.

Indeed; it's installed to the full path I mentioned above in my previous
message.

> Same with galternatives.

Not really. galternatives is installed to /usr/sbin/galternatives and is
runnable as a normal command.

> It will deal with what you already have installed.

Oh. In that case why did you recommend it for my situation? "Discovering
Uninstalled Alternatives" is the title of this thread.

You initially said you'd just been through the same thing and
galternatives/kalternatives works a charm ... and now I've finally got
the thing running you say it is no use at all for what I asked about!
I'm right back where I started.

Would anybody else like to answer my original question?

> There is nothing out there that will tell you what will potentially do
> whatever to alternatives,

Why not? The system has the information in it. Apt knows about
uninstalled packages. command-not-found has information on which
commands are provided by which packages.

> shy of magic beans, that >I< know of. If such a beast existed, it
> would be the closest thing to computer clairvoyance since Edgar Cayce.

This already happens if _no_ commands matching an alternative are
installed.

For example, if mutt isn't installed (which I think it isn't by
default), trying to run it gives a message listing each of the packages
which provide it:

  $ mutt
  The program 'mutt' can be found in the following packages:
  * mutt
  * mutt-patched
  Try: sudo apt-get install <selected package>

That is information about alternatives provided by uninstalled packages.
No magic beans, no clairvoyance, no chicken feet.

However, as soon as I have one of those packages installed, typing mutt
of course runs the one which is installed. I can no longer use that as a
way of discovering which other, currently uninstalled, packages provide
it.

But this information is clearly available to the system, since it can
tell me that when none are installed.

Smylers
-- 
Watch fiendish TV quiz 'Only Connect' (some questions by me)
Mondays at 20:30 on BBC4, or iPlayer: http://www.bbc.co.uk/onlyconnect




More information about the ubuntu-users mailing list