GIMP very unexpectedly took over opening PDF files a while ago when issuing the see command. It is listed in /etc/mailcap before the more appropriate evince. Of course I can edit this file by hand, but since it is managed by the system, the next update-mime run will overwrite these changes.

There is a file called /etc/mailcap.order that promises to help to achieve exactly what I want. I added and entry there:


However, the next update-mime run answers with:

Warning: package evince listed in /etc/mailcap.order does \
    not have mailcap entries.

Changing the package name to evince-common or changing the media type to */* did not achieve anything. So what is the right format?

  • 1
    Did you create an entry for evince in /usr/lib/mime/packages? According to man mailcap.order, that is where update-mime looks.
    – Jos
    Feb 15, 2019 at 8:34
  • Or maybe you can just remove the gimp entry there.
    – Jos
    Feb 15, 2019 at 8:35
  • I missed that bit… However, in /usr/lib/mime/packages there are entries for neither gimp nor evince. Adding a file there seems just as bad as editing /etc/mailcap itself.
    – MPi
    Feb 15, 2019 at 14:56
  • You can add the line between the "User Section Begins" and "User Section Ends" lines in /etc/mailcap. These lines should not be overwritten.
    – loxo
    Aug 6, 2020 at 15:22
  • The lines seem to come from /usr/share/applications/*.desktop, where * matches, in particular, gimp (and google-chrome) before org.gnome.Evince.desktop. I cannot find an exact reference, but it looks like update-mime first processes files /usr/lib/mime/packages/* (in an order which is governed by 1) /etc/mailcap.order (see man mailcap.order) and 2) the alphabetical order of the files) and then /usr/share/applications/*.desktop, again in an alphabetical order of the files.
    – loxo
    Aug 6, 2020 at 15:31

2 Answers 2


Just following @Jos suggestion, I fixed this annoying issue with:

echo 'application/pdf; evince %s; test=test -n "$DISPLAY"' | sudo tee /usr/lib/mime/packages/evince
echo 'evince:application/pdf'| sudo tee -a /etc/mailcap.order 
sudo update-mime
  • 1
    I still believe it’s wrong from Ubuntu’s side. But this is a working work-around.
    – MPi
    Apr 9, 2019 at 9:41
  • It looks like the second line is, in fact, not needed: update-mime seems to process files in /usr/lib/mime/packages before those in /usr/share/applications/*.desktop. The latter is where it gathers the information for Gimp and Evince from. (See the "desktop entries" section towards the end of the update-mime manpage.)
    – loxo
    Aug 6, 2020 at 15:20

You can add the line between the "User Section Begins" and "User Section Ends" lines in /etc/mailcap. These lines should not be overwritten by update-mime.

However, at least if you are managing more computers through some deployment system, the solution by fuujuhi may be better.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .