Snap install of gedit fails to run: "cannot create directory '/run/user/1000' permission denied"

Hi,

I’m testing running x-11 apps from within an lxc fossa container, using very close to the method outlined in Simos’s blog: https://blog.simos.info/running-x11-software-in-lxd-containers/. I’m testing loading an x-11 app using gedit.

I’m struggling with some permissions errors. I’d appreciate some help with a solution, or at least a clear diagnosis.

gedit

sudo snap install gedit seems to work ok. When I try to run gedit

I get a cascade of permission denied errors, then the app window opens.
starting with:

cannot create directory '/run/user/1000' permission denied

I think the user is set-up OK:

$ id ubuntu
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),118(lxd)

I restored to a clean x-11 snapshot, and did sudo apt install gedit - 540MB later…

ubuntu@fossa:~$ gedit

(gedit:9406): dbind-WARNING **: 23:11:15.880: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-AZ1nDuhshH: Connection refused!

gedit opens relatively quickly.

vs-code

I tried restoring to a clean x11 snapshot, and installing vs-code. I get a cleaner diagnostic and a warning dialog when I try to run code .

ubuntu@fossa:~$ sudo snap install code --classic
code e5a624b7 from Visual Studio Code (vscode✓) installed
ubuntu@fossa:~$ which code
/snap/bin/code
ubuntu@fossa:~$ code .
mkdir: cannot create directory ‘/run/user/1000’: Permission denied

All the x-11 diagnostic apps run except the sound subsystem. I’ve never had this able to run. Unless its relevant to this problem, I’ll try to solve it later.