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.
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, только один)
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.
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.
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.
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.
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:
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.