Xdg-open defaults to opening everything in firefox, complains of no mimeinfo database

Somehow I’ve messed up my xdg-mime info. I’m not sure how.

When I try to open pdfs from xdg-mime, it defaults to opening them in firefox, and then complains:

WARNING: You don't seem to have a mime-info database. The shared-mime-info package is available from http://freedesktop.org/ at /usr/bin/vendor_perl/mimetype line 175.
No mimeinfo database found
xdg-mime: mimetype argument missing
Try 'xdg-mime --help' for more information.
WARNING: You don't seem to have a mime-info database. The shared-mime-info package is available from http://freedesktop.org/ at /usr/bin/vendor_perl/mimeopen line 129.
No mimeinfo database found

I’ve tried renaming .config/mimeapps.list to something else, but that didn’t help.

I also tried reinstalling:

  • xdg-utils
  • libxdg-basedir
  • shared-mime-info
  • perl-file-mimeinfo
  • python-pyxdg
  • xdg-dbus-proxy
  • xdg-desktop-portal-gtk
  • xdg-desktop-portal
  • xdg-user-dirs
  • xdg-user-dirs-gtk

via pacman -S, but that didn’t help.

Any ideas?

inxi system info
$ inxi -Fxxxza --no-host
System:    Kernel: 5.11.14-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.11-x86_64 root=UUID=954cf137-75f3-4e46-8682-9f013e1bd856 rw quiet 
           cryptdevice=UUID=4110f216-65f4-48f0-8bbe-81a930fc1c74:luks-4110f216-65f4-48f0-8bbe-81a930fc1c74 
           root=/dev/mapper/luks-4110f216-65f4-48f0-8bbe-81a930fc1c74 apparmor=1 security=apparmor 
           resume=/dev/mapper/luks-c6d6abb3-a33a-4e43-b48c-c6131a7cb028 udev.log_priority=3 
           Desktop: i3 4.19.1 info: i3bar vt: 7 dm: GDM, LightDM 1.30.0, SDDM Distro: Manjaro Linux base: Arch Linux 
Machine:   Type: Portable System: Dell product: Inspiron 5720 v: N/A serial: <filter> Chassis: type: 8 v: 0.1 serial: <filter> 
           Mobo: Dell model: 023HTX v: FAB1 serial: <filter> UEFI-[Legacy]: Dell v: A03 date: 05/04/2012 
Battery:   ID-1: BAT0 charge: 21.8 Wh (67.9%) condition: 32.1/48.8 Wh (65.8%) volts: 11.7 min: 11.1 model: SANYO Dell 
           type: Li-ion serial: <filter> status: Charging 
           Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M325 serial: <filter> charge: 55% (should be ignored) 
           rechargeable: yes status: Discharging 
CPU:       Info: Quad Core model: Intel Core i7-3612QM bits: 64 type: MT MCP arch: Ivy Bridge family: 6 model-id: 3A (58) 
           stepping: 9 microcode: 21 cache: L2: 6 MiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 33543 
           Speed: 1197 MHz min/max: 1200/3100 MHz Core speeds (MHz): 1: 1197 2: 1197 3: 2139 4: 2319 5: 1373 6: 1300 7: 1242 
           8: 1197 
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: srbds status: Vulnerable: No microcode 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel 3rd Gen Core processor Graphics vendor: Dell driver: i915 v: kernel bus-ID: 00:02.0 
           chip-ID: 8086:0166 class-ID: 0300 
           Device-2: Microdia Laptop_Integrated_Webcam_HD type: USB driver: uvcvideo bus-ID: 1-1.5:4 chip-ID: 0c45:648d 
           class-ID: 0e02 
           Display: x11 server: X.Org 1.20.11 compositor: picom v: git-60eb0 driver: loaded: intel unloaded: modesetting 
           alternate: fbdev,vesa display-ID: :0 screens: 1 
           Screen-1: 0 s-res: 3520x1080 s-dpi: 96 s-size: 930x285mm (36.6x11.2") s-diag: 973mm (38.3") 
           Monitor-1: LVDS1 res: 1600x900 hz: 60 dpi: 107 size: 380x220mm (15.0x8.7") diag: 439mm (17.3") 
           Monitor-2: HDMI1 res: 1920x1080 hz: 75 dpi: 102 size: 480x270mm (18.9x10.6") diag: 551mm (21.7") 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 4000 (IVB GT2) v: 4.2 Mesa 21.0.3 compat-v: 3.0 direct render: Yes 
Audio:     Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel 
           bus-ID: 00:1b.0 chip-ID: 8086:1e20 class-ID: 0403 
           Sound Server-1: ALSA v: k5.11.14-1-MANJARO running: yes 
           Sound Server-2: JACK v: 0.125.0 running: no 
           Sound Server-3: PulseAudio v: 14.2 running: yes 
           Sound Server-4: PipeWire v: 0.3.26 running: yes 
Network:   Device-1: Intel Centrino Wireless-N 2230 driver: iwlwifi v: kernel port: efa0 bus-ID: 01:00.0 chip-ID: 8086:0887 
           class-ID: 0280 
           IF: wlp1s0 state: down mac: <filter> 
           Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell driver: r8169 v: kernel port: 2000 
           bus-ID: 02:00.0 chip-ID: 10ec:8136 class-ID: 0200 
           IF: enp2s0 state: down mac: <filter> 
           Device-3: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152 bus-ID: 4-3:3 chip-ID: 0bda:8153 
           class-ID: 0000 serial: <filter> 
           IF: enp0s20u3 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Bluetooth: Device-1: Intel Centrino Bluetooth Wireless Transceiver type: USB driver: btusb v: 0.8 bus-ID: 2-1.5:3 
           chip-ID: 8087:07da class-ID: e001 
           Report: rfkill ID: hci0 rfk-id: 8 state: down bt-service: enabled,running rfk-block: hardware: no software: yes 
           address: see --recommends 
Drives:    Local Storage: total: 931.51 GiB used: 366.36 GiB (39.3%) 
           SMART Message: Required tool smartctl not installed. Check --recommends 
           ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT1000BX500SSD1 size: 931.51 GiB block-size: physical: 512 B 
           logical: 512 B speed: 6.0 Gb/s rotation: SSD serial: <filter> rev: 030 scheme: MBR 
Partition: ID-1: / raw-size: 922.71 GiB size: 907.23 GiB (98.32%) used: 365.79 GiB (40.3%) fs: ext4 dev: /dev/dm-0 
           maj-min: 254:0 mapped: luks-4110f216-65f4-48f0-8bbe-81a930fc1c74 
Swap:      Kernel: swappiness: 60 (default) cache-pressure: 100 (default) 
           ID-1: swap-1 type: partition size: 8.8 GiB used: 578.7 MiB (6.4%) priority: -2 dev: /dev/dm-1 maj-min: 254:1 
           mapped: luks-c6d6abb3-a33a-4e43-b48c-c6131a7cb028 
Sensors:   System Temperatures: cpu: 51.0 C mobo: 43.0 C sodimm: SODIMM C 
           Fan Speeds (RPM): cpu: 2591 
Info:      Processes: 302 Uptime: 13d 10h 00m wakeups: 272 Memory: 7.64 GiB used: 5.17 GiB (67.6%) Init: systemd v: 247 
           tool: systemctl Compilers: gcc: 10.2.0 Packages: pacman: 1556 lib: 371 Shell: Bash v: 5.1.0 running-in: lxterminal 
           inxi: 3.3.04 

Bumping is against the rules… This is your first and only warning. Next time your post will be closed without any further info. :man_shrugging:

What is the output of:

locate --existing mipeapps

If command not found, what’s the output of:

find / -iname \*mimeapps\* -print 2> /dev/null

If there is an output, please provide the first 25 lines of those files.

:+1:

Sorry.

Here’s the output:

ram@frigate:~$ locate --existing mimeapps
/home/ram/.config/mimeapps.list
/home/ram/oldhome/.config/mimeapps.list
/home/ram/oldhome/oldhome/.config/mimeapps.list
contents of ~/.config/mimeapps.list
[Added Associations]
application/pdf=qpdfview.desktop;okularApplication_pdf.desktop;atril.desktop;xpdf.desktop;epdfview.desktop;xreader.desktop;libreoffice-draw.desktop;com.github.jeromerobert.pdfarranger.desktop;gimp.desktop;org.kde.itinerary.desktop;com.github.xournalpp.xournalpp.desktop;org.inkscape.Inkscape.desktop;firefox.desktop;
application/x-bittorrent=deluge.desktop;
application/x-extension-htm=firefox.desktop;
application/x-extension-html=firefox.desktop;
application/x-extension-shtml=firefox.desktop;
application/x-extension-xht=firefox.desktop;
application/x-extension-xhtml=firefox.desktop;
application/xhtml+xml=firefox.desktop;
image/gif=sxiv.desktop;viewnior.desktop;
image/jpeg=sxiv.desktop;gimp.desktop;viewnior.desktop;gpicview.desktop;
image/png=gimp.desktop;viewnior.desktop;gpicview.desktop;
inode/directory=thunar.desktop;
message/rfc822=userapp-Evolution-N79Q10.desktop;
text/html=firefox.desktop;
text/plain=mousepad.desktop;
x-scheme-handler/chrome=firefox.desktop;
x-scheme-handler/ftp=firefox.desktop;
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
x-scheme-handler/mailto=userapp-Evolution-N79Q10.desktop;
x-scheme-handler/tg=userapp-Telegram Desktop-1385Z0.desktop;

[Default Applications]
application/pdf=atril.desktop
application/x-bittorrent=deluge.desktop
application/x-extension-htm=firefox.desktop
application/x-extension-html=firefox.desktop
application/x-extension-shtml=firefox.desktop
application/x-extension-xht=firefox.desktop
application/x-extension-xhtml=firefox.desktop
application/x-remmina=org.remmina.Remmina.desktop
application/xhtml+xml=firefox.desktop
image/gif=viewnior.desktop
image/jpeg=viewnior.desktop;gpicview.desktop;
image/png=viewnior.desktop;gpicview.desktop;
inode/directory=thunar.desktop
message/rfc822=userapp-Evolution-N79Q10.desktop
text/html=firefox.desktop
text/plain=mousepad.desktop
x-scheme-handler/chrome=firefox.desktop
x-scheme-handler/ftp=firefox.desktop
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
x-scheme-handler/mailto=userapp-Evolution-N79Q10.desktop;
x-scheme-handler/rdp=org.remmina.Remmina.desktop
x-scheme-handler/remmina=org.remmina.Remmina.desktop
x-scheme-handler/spice=org.remmina.Remmina.desktop
x-scheme-handler/tg=userapp-Telegram Desktop-1385Z0.desktop
x-scheme-handler/vnc=org.remmina.Remmina.desktop
application/x-directory=thunar.desktop

You have 12 PDF viewers installed???

:open_mouth:

Which one do you want to use???

:thinking:

In search of the right one, I guess. Atril does the job most of the time, but there are some contracts that cause Atril (and others) to go into a berserk memory leak. qpdfview doesn’t have that bug, but also lacks some functionality. I will try thinning the herd, but I doubt it’ll have much effect on this issue.

Ok, I’ve removed epdfview, xpdf, and xreader, leaving me with Atril, Firefox, GIMP, Inkscape, Libreoffice Draw, PDF Arranger, qpdfview, and Xournal++ as possible PDF “readers” listed in Thunar (only Atril and qpdfview are actually PDF readers).

Trying to query a filetype with xdg-mime still gives me that weird error:

ram@frigate:Documents$ xdg-mime query filetype rice-The_Tragedy_of_systemd.pdf 
WARNING: You don't seem to have a mime-info database. The shared-mime-info package is available from http://freedesktop.org/ at /usr/bin/vendor_perl/mimetype line 175.
No mimeinfo database found

Opening it with xdg-open still opens Firefox.

I’ve also cleaned out the remaining cruft in the mimeapps.list file, including PDF viewers I had already removed.

Here’s what it looks like now:

ram@frigate:~$ grep -i pdf .config/mimeapps.list 
application/pdf=qpdfview.desktop;libreoffice-draw.desktop;com.github.jeromerobert.pdfarranger.desktop;gimp.desktop;com.github.xournalpp.xournalpp.desktop;org.inkscape.Inkscape.desktop;firefox.desktop;
application/pdf=atril.desktop

I also tried reinstalling anything I could find related to mime:
sudo pacman -S perl perl-file-mimeinfo shared-mime-info

…but that didn’t seem to have any effect:

ram@frigate:~$ xdg-mime query filetype Documents/rice-The_Tragedy_of_systemd.pdf 
WARNING: You don't seem to have a mime-info database. The shared-mime-info package is available from http://freedesktop.org/ at /usr/bin/vendor_perl/mimetype line 175.
No mimeinfo database found

I was just asking which one (=1) you wanted to use but as you

can I have the output of:

sudo updatedb
locate --existing mimeapps

again?

And please:

  • don’t change anything else as I’m shooting at a moving target now
  • give me one application only? (un seul, solo uno, только один) :stuck_out_tongue_winking_eye:

What you were missing was a system-wide mimeapps.list but until you provide the above, I don’t know what you have right now and as I’m on KDE and you’re on Xfce, I cant just post mine for you to use.

:cry:

Actually, I’ve flopped around a bit (which might have been the cause of the problem).

I started with i3 community edition, tried KDE Plasma, then GNOME. I finally went back to using i3wm, which is where I am now. I actually hadn’t installed XFCE this time around, although I’ve used it in the past.

ram@frigate:~$ sudo updatedb
[sudo] password for ram: 
ram@frigate:~$ locate --existing mimeapps
/home/ram/.config/mimeapps.list
/home/ram/oldhome/.config/mimeapps.list
/home/ram/oldhome/oldhome/.config/mimeapps.list

Ok, I won’t try any more troubleshooting. I know everyone says to create a new userid when switching desktops, and yeah, stuff like this is probably why. I’ve done it in the past without issue, but that doesn’t mean I didn’t b0rk myself this time.

Well @fabby, I’m sorry.

I had to blitz my homedir. Something got VERY dodgy out of nowhere, and neither i3 nor xfce (installed just to troubleshoot after i3 completely broke) would start at all.

I ended up moving my entire homedir into a sub directory within a now completely blank home directory.

XFCE started working out of the blue. I then moved my entire home directory back into place (after I already removed a lot of .config, .local, and .cache subdirectories in order to troubleshoot the latest breakage), and now everything is hunky dory again, except I’m now on xfce for the time being.

Thanks so much for wanting to help. I’m actually NOT a crazy distrohopper who always breaks his system… this is my WORK machine (and I’m not in IT), but I guess I broke it, so I had to fix it.

Learned my lesson (I hope) – no more DE hopping. Just WAAAY too much bitrot when you do that.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

Solution found!

I nuked and paved my box, and everything seemed fine for a bit, but then I started getting the mime error again, and at that point, I knew something was up. I knew that my ~/.config and ~/.local directories weren’t to blame, since I had a completely new setup. What remained was my custom bash profile.

So, I removed the line in .bashrc that loaded my custom .bashrc2 profile, and everything was FINE. Then it was a process of elimination: I put a HERE document line (cat <<EOF) at the beginning of my .bashrc2 profile, which had the effect of commenting out the rest of the file after that line. I gradually moved that line down 10 lines at a time until my xdg-open ~ command stopped working again. I found the culprit!:

At some point, flatpak had instructed me to add some directories to the $XDG_DATA_DIRS variable. This got left in my .bashrc for ages, and moved from system to system. Here’s the actual code I was using:

XDG_DATA_DIRS="$XDG_DATA_DIRS:/var/lib/flatpak/exports/share:/home/ram/.local/share/flatpak/exports/share"
XDG_DATA_DIRS=$(echo "$XDG_DATA_DIRS" |tr ":" "\n" |sort -u |tr "\n" ":" |sed -E 's/(^:|:$)//')
export XDG_DATA_DIRS

The thing is, for some reason, the variable didn’t have the system XDG directories in the first place. So, while everything worked fine with the variable not set, as soon as you put something into that variable that doesn’t include whatever directories the system expects (/usr/local/share, I think), things broke.

The solution was to just comment out those lines. I’m not even using flatpak at this point.

Summary

The problem was caused by not having the proper value in the $XDG_DATA_DIRS variable. The solution is to either add the default system data directory (not able to ascertain what that is supposed to be at this point) to $XDG_DATA_DIRS or to not set the variable.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.