29

I am running Firefox 15 on Ubuntu 12.04.

If I go to a website with a .deb link, Firefox downloads the file, then tries to open it with gedit. If I use Nautilus to open the .deb file, it runs it in either gdebi or Ubuntu Software Center (I've experimented with both).

Oddly, no matter what I've done I can't seem to get Firefox to believe that debs should not be opened by gedit. See below from my mimeapps.list. Also, there are no references to my .deb files in /usr/share/applications/defaults.list

FF Opening In Dialog

~/.local/share/applications/mimeapps.list

~/.local/share/applications/mimeapps.list

Anwar
  • 76,649
Kendor
  • 4,858
  • Change the mime type settings in firefox application settings.Im not sure what the desktop stuff has to do with your case.For instance if you picked save file instead of open with then clicked the saved .deb it should open as its supposed to however the action taken is through firfox. – damien Sep 07 '12 at 14:42
  • Similar question: http://superuser.com/questions/802628/firefox-opens-pdfs-in-gedit – user31389 Mar 04 '15 at 21:08

6 Answers6

19

I had this behaviour with Firefox too. It was opening PDFs, .DOCs, .DOCXs, etc with Gedit. Very annoying. Didn't matter than the Applications list in Firefox specified LibreOffice, Evince, etc., as the preferred application UNLESS I clicked on the 'Show All Downloads' link at the bottom of the downloads menu (in the firefox taskbar).

To fix this, I opened .local/share/applications/mimeapps.list and removed the association of application/octet-stream with gedit.desktop. Doing that restored the normal/expected behaviour.

This clearly highlights a bug in Firefox, which is that it sometimes uses its applications list, but not always (as of version 35.0.1 on Ubuntu 12.04).

jdpipe
  • 779
14

Firefox also has its own application list. Check Preferences->Applications, then find the Debian files. It probably says "Always ask" next to it if you haven't changed anything. If you click on "Always ask" you can select "Use other" and pick the Ubuntu software center or Synaptic or whatever you'd like it to be (though unfortunately you will have to use the file finder to actually get to the application file, which can be a slight annoyance). The Ubuntu Software Center is in /usr/bin/software-center and gdebi can be found in /usr/bin/gdebi-gtk.

SMeznaric
  • 1,147
  • 8
  • 7
  • 4
    This is where I use gdebi-gtk. It's much smaller and faster than USC or synaptic. Plus, gdebi still provides a description of the app and will handle dependancies. It can be found at /usr/bin/gdebi-gtk. – matt davis Sep 07 '12 at 16:53
  • Thanks both of you. @Matt Davis, I configured your variant as I agree regarding smaller/faster. – Kendor Sep 07 '12 at 20:43
  • To find 'where's an application' You can just use 'which' command. It's like 'which firefox'. – kcpr May 07 '14 at 18:40
  • Changing the setting as described has never worked for me or many others. It is a long-standing bug in Ubuntu Firefox. https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/918019. I can only wonder why something like this has never been fixed. If it affects you or anyone, please add yourself to the list of people affected by logging into Launchpad and clicking "This bug affects me". – authentictech May 07 '16 at 12:47
14

There are default programs xdg-open and gnome-open which automatically select appropriate tool for a file.

I managed to find out that its enough to change association for unknown type and everything works fine.

Solution

This is everything you need BEGIN

sed 's#.*octet-stream.*#application/octet-stream=gnome-open.desktop#' ~/.local/share/applications/mimeapps.list -i

END

I have got to this conclusion by using find, ubuntu-tweak- inotifywatch

test30
  • 517
  • 2
    This works like a charm. Now all previously "unknown" filetypes are downloaded by default. Clicking the downloaded file (for example .ppt) opens it in the appropriate program (LibreOffice), not gedit. – Niko Fohr Nov 29 '14 at 11:17
  • That file location is deprecated. For me the entry was in ~/.config/mimeapps.list (see comment by Cedric Reichenbach) – Flamefire Apr 19 '18 at 10:45
0

This occurs because some packages break your mime-type-application bindings.

I got the same and removed the list file in my home directory but that will only last until you update the software again that is causing this.

To fix the issue, you need to set the apps for the mime-type accordingly. The settings in /usr/share/applications/defaults.list should be correct.

You will notice that these ".desktop" files are located in /usr/share/applications/; you can use any in there and even create your own, with root privileges.

thecarpy
  • 383
  • 4
  • 12
  • I assume the entries "application/x-deb=ubuntu-software-center.desktop & application/x-debian-package=ubuntu-software-center.desktop" are correct in this instance, i.e. if one has this, things are already correct. – dez93_2000 Oct 25 '14 at 18:14
  • I did a fix of this using vi ./.local/share/applications/mimeapps.list and putting a # as follows #application/octet-stream=gedit.desktop; and I also added an extra line as follows, application/octet-stream=evince.desktop; but I still have a problem. The pdf is downloaded and then opened rather than simply opened (like it used to...). Does anyone have any suggestion as to how to modify the line? – DarrenRhodes Jun 21 '15 at 11:39
0

To add to SMeznaric's top post: I checked the Firefox preferences and both deb entries were already ubuntu software center. A workaround was to change the default option to 'save file', since at least this works. Clicking them in the downloads folder in Thunar works as normal and you have a copy in a logical place (rather than /tmp/mozilla-firefox0)

dez93_2000
  • 1,201
0

I had this problem, along with Firefox's Preferences->Applications window being totally blank.

Did the following:

sudo apt-get remove --purge firefox
sudo apt-get install firefox

It fixed both issues (for now, I'll check back in if it recurs) and all of my settings and plugins are still intact.