7

My PC fails to run snap packages, when I try I get:

2021/07/31 20:56:38.255535 cmd_run.go:576: WARNING: XAUTHORITY environment value is not a clean path: "/mnt/e664d184-8567-4278-93ce-c986567c66af/home/iaquobe/.Xauthority"
cannot create user data directory: /home/iaquobe/snap/shapezio/2: Not a directory

The directories do however exist. So far the packages I tested are 0ad shapezio whatsdesk, all of them had the same issue.

Those packages do run on my laptop. One thing that is different is that on my PC /home/iaquobe is a symbolic link to a drive at /mnt/[...]/home.

This is the only cause for this error I could think of, what do you think? And what could I do to fix it?

Thanks in advance :)

iaquobe
  • 281
  • 1
  • 4
  • 13

2 Answers2

9

The /home symlink is indeed causing the issue. This is a known snap bug (or to be more precise design limitation of snap) -- with snap packages home can't be a symlink or a different directory than /home, see this bug for details. Suggested workaround/fix is to run sudo dpkg-reconfigure apparmor but some people in the bug discussion said it didn't help so it might not work.

Vojtech Trefny
  • 16,922
  • 6
  • 24
  • 48
  • Oh, that ain't good news. I did not understand everything in the limitation link you mentioned. Would it work if instead of symlinking, I would mount the drive? Is that what is meant by automount? – iaquobe Jul 31 '21 at 21:54
2

We use domain with realm, so our path home is not /home, instead /home/MYDOMAINCOMPANY/. I fixed by editing /etc/apparmor.d/tunables/home.d/ubuntu with that line:

@{HOMEDIRS}+=/home/MYDOMAINCOMPANY/

After save, just restart some services:

systemctl restart apparmor.service snapd.apparmor.service snapd.service snapd.socket

That way I can run at many computers by script or using Ansible.

AdminBee
  • 21,637
  • 21
  • 47
  • 71