Permission for snap applications

36,170

Solution 1

Snap problem

I got similar error message on 16.04 LTS MATE with Xorg:

$ cat /etc/os-release | grep PRETTY
PRETTY_NAME="Ubuntu 16.04.3 LTS"

$ export | grep XDG_SESSION
declare -x XDG_SESSION_DESKTOP="mate"
declare -x XDG_SESSION_ID="c2"
declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"
declare -x XDG_SESSION_TYPE="x11"

$ snap list | grep notepadqq
notepadqq  1.2.0-2    115   danieleds  -

$ which notepadqq 
/snap/bin/notepadqq

$ sudo snap run notepadqq
mkdir: cannot create directory '/run/user/0': Permission denied
No protocol specified
QXcbConnection: Could not connect to display :0.0
Aborted (core dumped)

$ pkexec snap run notepadqq
mkdir: cannot create directory '/run/user/0': Permission denied
QXcbConnection: Could not connect to display 
Aborted (core dumped)

$ sudo notepadqq 
mkdir: cannot create directory '/run/user/0': Permission denied
No protocol specified
QXcbConnection: Could not connect to display :0.0
Aborted (core dumped)

$ gksudo notepadqq 
No protocol specified
QXcbConnection: Could not connect to display :0.0

$ sudo -u www-data notepadqq /var/www/html/index.html 
2018/02/25 22:40:11.162682 cmd_run.go:562: WARNING: cannot create user data directory: cannot create "/var/www/snap/notepadqq/115": mkdir /var/www/snap: permission denied
cannot create user data directory: /var/www/snap/notepadqq/115: Read-only file system

So it is not Wayland issue.

May be it is other limitation of Snap. Anyway I reported bug 1751634 to launchpad.

Get deb-packaged Notepadqq and run it

We discovered, that notepadqq snap does not launch as root, so we

  1. Removing it and installing normal version from “Notepadqq Team” team PPA

    snap remove notepadqq
    sudo add-apt-repository -y ppa:notepadqq-team/notepadqq
    sudo apt-get update
    sudo apt-get install notepadqq
    
  2. Then run it as normal user:

    notepadqq
    
  3. And as root:

    gksudo notepadqq
    

Hope this helps.

Solution 2

So, I was having the same problem. Searching the Web, I found a solution in a brazilian website. Obs: the apt repository version worked fine besides being deprecated, but it was ugly in my system...

Install notepadqq with snap as you normally would:

sudo snap install notepadqq

Then, run this commmand:

sudo snap connect notepadqq:removable-media

It solved for me, as the file I was trying to open was in another partition... Or so I think!

Solution 3

For anyone from Ubuntu 18.04

snap install notepadqq --devmode
Share:
36,170
lukasl1991
Author by

lukasl1991

Updated on September 18, 2022

Comments

  • lukasl1991
    lukasl1991 almost 2 years

    I have some trouble with the Ubuntu notepadqq package. After opening a file from my apache webroot I cannot see any content. Saving the file is also not possible. I thougt this would be a classic permission issue. Therefore, I changed the group of the webroot from root to www-data and added my user to this group. Permissions are 775, so in theory it should now be possible for me to edit files in my webroot. But nevertheless, when I open a file of this directory with notepadqq, it still only shows an empty file.

    When using gksudo notepadqq I get the following error message:

    No protocol specified
    QXcbConnection: Could not connect to display :0
    

    I figured out that notepadqq is a so called snap application and I wonder if this is the reason for my problems.

    Can someone give me a hint how I could fix this issue (without using 777 permissions)?

  • lukasl1991
    lukasl1991 over 6 years
    Thank you very much! The deb-packaged notepadqq works fine!
  • lukasl1991
    lukasl1991 about 6 years
    I now run 18.04 but this doesn't work for me.
  • lukasl1991
    lukasl1991 about 6 years
    I've tried this but it does not work. Notepadd++ tells me that the file cannot be opened because its parent directory does not exist.
  • Geoffrey Wheeler
    Geoffrey Wheeler about 5 years
    From 'sudo add-apt-repository -y ppa:notepadqq-team/notepadqq' I get ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu cosmic Release 404 Not Found [IP: 91.189.95.83 80] E: The repository 'ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu cosmic Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
  • N0rbert
    N0rbert about 5 years
    @GeoffreyWheeler It seems that the package is not available for cosmic. You have to write package request to the PPA owner to support this release using special form.
  • user1708042
    user1708042 about 4 years
    not available even in eoan (19.10)