6

I've logged in to my Google account in the Ubuntu 22.04 settings. A link to my Google drive appears in Nautilus. I'm able to open photos and doc files, but when I try to open PDFs I receive an error message, "Unable to open document "[file:// etc.] ... Error opening file ... Permission denied.

How can I fix this problem? I've looked online and mostly am finding information regarding the Google desktop version of google drive.

5
  • 1
    This is happening for me as well Apr 24, 2022 at 7:10
  • 1
    I know, that doesn't help much, but I'm experiencing the same problems with Google Drive on Ubuntu 22.04 Desktop. Opening PDF files with the default PDF viewer fails, even from the default file manager Files. But PDF is not the only content type, it also fails for e.g html files: if you try to open them, instead of in the default browser they are opened in the Text Editor. Any advice? Apr 24, 2022 at 17:31
  • 1
    I am experiencing the same problem. I tried to install another pdf application and made it default to open the pdf files. But that application is also unable to open the pdf. Perhaps, this means that the bug is with Nautilus and not pdf application. I tried to file the bug but found it quite tedious. Will prefer to wait and let this bug be resolved. Apr 26, 2022 at 1:54
  • 2
    From Stephane V: bugs.launchpad.net/ubuntu/+source/evince/+bug/867749 Modify the Apparmor security profile with these two commands : sudo apt-get install apparmor-utils , sudo aa-complain /usr/bin/evince May 12, 2022 at 18:37
  • 1
    @HaywardOblad thanks for that, you should turn that comment into an answer.
    – Janos
    May 29, 2022 at 14:00

3 Answers 3

2

I would not recommend messing with the AppArmor settings as it's a safety-critical feature of Linux kernel and it's a workaround rather than providing a lasting solution.

I solved this by re-installing the Document Viewer (Evince) but instead of using the Ubuntu .deb distribution, installing as a Flatpak (from Flathub). The sandbox distribution design of Flatpak seems not to suffer from this issue with AppArmor permissions.

  1. You need to uninstall the current package installation.
sudo apt-get remove evince
  1. If you already haven't done so, you need to install & activate Flatpak.
sudo apt install flatpak
  1. Activate the Flathub repository.
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  1. Finally, install Document Viewer again (as a Flatpak distribution package).
flatpak install flathub org.gnome.Evince
5
  • 1
    If one wants to install a different packaging format only to fix this evince issue, using the built-in 'sudo snap install evince' will also fix it. No permission issue from evince on gio mounted volume. Dec 14, 2022 at 22:44
  • @OmidKhalili the snap version is way behind the other packaging formats, one disadvantage Dec 20, 2022 at 17:27
  • I agree some packages are outdated, but at least I have a unified experience and can only type the package name on the terminal to open what I want. Typing evince on the terminal when the deb version is installed or the snap version is installed has the same result. Instead with flatpak I have to flatpak run org.gnome.Evince (This is nonsense to me and reading github.com/flatpak/flatpak/issues/994 says I'm not alone.) Dec 20, 2022 at 23:22
  • Thank you for this answer! I was also hesitant to mess around with AppArmor settings.
    – DanM87
    Feb 9, 2023 at 15:22
  • sudo snap install evince only seems to fix it on Ubuntu 24.04 until you restart, at least he error comes back after a few days.
    – hb0
    May 14 at 9:04
1

This is problem with the Document Viewer(Evince) not Nautilus

Disable One Profile

sudo ln -s /etc/apparmor.d/usr.bin.evince /etc/apparmor.d/disable/

If this doesn't work, you can install atril document viewer and set that as your default, it should work.

2
  • Thank you for your help! I didn't want to mess around with the persmission on AppArmor so I installed Atril and set it as default PDF viewer. Thanks!
    – DanM87
    May 8, 2022 at 22:09
  • The above tip didn't help me for evince, also I have the same problem with other PDV viewers and editors I tried (e.g. qpdfview). But thanks for the tip with atril, that one works!
    – Janos
    May 29, 2022 at 13:56
0

This also happens with a fresh Ubuntu 24.04 installation.

As @Omid Khalili pointed out in a comment, you can just reinstall evince with snap:

sudo apt remove evince
sudo snap install evince

This fixes "permission denied" for Google Drive, but not for Cryptomator, in case you use this, too.

update: sudo snap install evince only seems to fix it on Ubuntu 24.04 until you restart, at least he error comes back after a few days.

You must log in to answer this question.

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