7
$ xdg-open
The program 'xdg-open' is currently not installed. You can install it by typing:
sudo apt-get install xdg-utils

$ sudo apt-get install xdg-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
xdg-utils is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 89 not upgraded.

$ whereis xdg-open
xdg-open: /usr/bin/xdg-open /usr/bin/X11/xdg-open /usr/share/man/man1/xdg-open.1.gz

$ which xdg-open

$ xdg-open
The program 'xdg-open' is currently not installed. You can install it by typing:
sudo apt-get install xdg-utils

No, I didn't mean "recursion".

I'm on Linux Mint 15 MATE, but instead of MATE I'm using the i3 window manager.

Edit taking @slm's advice

$ type -a xdg-open
type: xdg-open not found

But it's in /usr/bin/xdg-open. I checked.

$ dpkg -S /usr/bin/xdg-open
xdg-utils: /usr/bin/xdg-open

The next one was even more interesting.

$ dpkg -S xdg-open
git-annex: /usr/share/doc/git-annex/html/bugs/Fix_for_opening_a_browser_on_a_mac___40__or_xdg-open_on_linux__47__bsd__63____41__.html
xdg-utils: /usr/bin/xdg-open
xdg-utils: /usr/share/man/man1/xdg-open.1.gz

The bug-fix is just a mail archive of a patch for an OSX problem. Anyway, I guess I could try using the full path:

$ /usr/bin/xdg-open
/usr/bin/xdg-open: No such file or directory
  • Someone with 300+ reputation might like to create a more appropriate tag. – nacnudus Nov 16 '13 at 3:49
  • 2
    +1 This made me laugh. Maybe it's a zen koan, in apt form? – ire_and_curses Nov 16 '13 at 3:51
  • I found what's wrong. Just writing up an answer. Wouldn't have found it without @slm's suggestion of dpkg -S xdg-open. – nacnudus Nov 16 '13 at 7:33
  • See updates to my answer on how to reinstall a broken package safely on Debian/Ubuntu based distros. – slm Nov 16 '13 at 8:30
6

This sounds like your package database is screwed up. First I'd identify all the versions of xdg-open that you have on your system. The type should always be used for doing this task, never rely on which or whereis.

Example

Identify all xdg-open's.

$ type -a xdg-open
xdg-open is /usr/bin/xdg-open

Find out which packages they're a part of.

$ dpkg -S /usr/bin/xdg-open
xdg-utils: /usr/bin/xdg-open

You'll want to either repeat the above dpkg -S .. for each match returned by type -a or use this dpkg -S .. search instead.

$ dpkg -S xdg-open
xdg-utils: /usr/bin/xdg-open
xdg-utils: /usr/share/man/man1/xdg-open.1.gz

I would do each, one at a time.

Reinstalling xdg-utils

If you'd like to refresh this package's installation do this:

$ sudo apt-get --reinstall xdg-utils
  • I shouldha waited! Don't worry - I cancelled the uninstall asap and managed to recover by pasting the list of programs it said it would uninstall into a sudo apt-get install command. Phew. – nacnudus Nov 16 '13 at 8:59
2

Thanks to @slm's tip, I tracked this down.

A while back, I followed some bad advice to make chromium-browser the default on Linux Mint. The advice was, delete usr/bin/xdg-open, then create a symlink in its place to chromium-browser.

It sure made Chromium the default browser. It made Chromium the default for lots of things.

Since then, of course, I installed the official Chrome for Linux from Google. It worked as the default automatically and I forgot about the kludge.

Unfortunately, it's hard to fix. You can remove the symlink okay, but how to retrieve the original? sudo apt-get install xdg-utils doesn't bother because it thinks it's already up-to-date. sudo apt-get remove xdg-utils is currently busy uninstalling virtually my entire system.

  • Don't remove it!!! See my updates. – slm Nov 16 '13 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.