Could not open file lol.json: Permission denied using Jq? Could not open file lol.json: Permission denied using Jq? bash bash

Could not open file lol.json: Permission denied using Jq?


sudo snap remove jqsudo apt install jq

You installed jq through Ubuntu's snap.

Snap packages have "confinement" which is either "strict" or "classic". In this case jq must've been packaged as "strict" meaning it has its own /tmp/snap.jq/ directory and cannot read the system /tmp directory and a bunch of other directories. Snap packages that want to use "classic confinement" have to be manually approved by the people in charge of snap and you must pass --classic when installing them, like this: sudo snap install <package name> --classic.

Anyway, uninstalling the snap version of jq and reinstalling it from apt (the above two commands) fixed the permissions error for me. The jq in apt is a more recent version than the one in snap anyway (as of Jul 2020 on Ubuntu 20.04 at least).


In my opinion, installing command line tools through snap is a mistake, at least without --classic because you're going to get errors like the above. This is intended behaviour and it's not likely to change, because the designers of snap don't think there's anything wrong with software telling you a file that exists doesn't exist. See this thread about this issue on the snapcraft forums: https://forum.snapcraft.io/t/jq-cant-read-some-files/17835