snap fails when the home directory path contains a symbolic link

Bug #1958983 reported by Albert Flügel
This bug report is a duplicate of:  Bug #1873679: Snap support for non /home homedirs. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
New
Undecided
Unassigned

Bug Description

I'm using microk8s and when it calls snap to run kubectl i get:
"cannot create user data directory: /home/user0815/snap/microk8s/2695: Not a directory"
In strace we can see the truth:
...
4030046 openat(AT_FDCWD, "/", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 4
4030046 mkdirat(4, "home", 0755) = -1 EEXIST (File exists)
4030046 openat(4, "home", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
4030046 close(4) = 0
4030046 mkdirat(5, "user0815", 0755) = -1 EEXIST (File exists)
4030046 openat(5, "user0815", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOTDIR (Not a directory)
4030046 close(5) = 0
4030046 write(2, "cannot create user data directory: /home/user0815/snap/microk8s/2695", 67)
...

and snap is actually the culprit (see the PID):
4030046 execve("/snap/snapd/current/usr/bin/snap", ["microk8s", "kubectl", "get", "pods"], 0xc0000f4180 /* 23 vars */ <unfinished ...>

It wants to create my home directory (!?!?!?!?!???!??!!?) and when encountering the symlink user0815 it fails.
Symlinks in the home directory path are quite common. Probably not at "snapcraft" or "ubuntu one".
So there are several flaws:
The program should not try to create the home directory
The algorithm to determine, if the directory exists, is inappropriate.
The error message is misleading as the issue does not have to do with the entire path /home/user0815/snap/microk8s/2695

An i don't want a visible application-specific directory in my home. Please change it e.g. to .snap

Revision history for this message
Ian Johnson (anonymouse67) wrote :

Snapd does not support using symlinks for home directories, in order to continue using snaps you need to setup a bind mount from /home/user0815 to wherever you actually have your home directory located. This can be done in /etc/fstab, etc.

Revision history for this message
Albert Flügel (afluegel9) wrote :

For me it is really hard to find words to express, what i think about what is going on in the software area since several years (without getting ... harsh). I would not use snap, if some parties had not decided to offer their stuff with snap only. Not only do i not understand, why i need 25 package managers on a single OS installation, that do not know of each other. It is unbelievable for me, that a package manager e.g. requires additional own loopback mounts, what i consider messing up the system setup, just to be usable, and forces users how to administrate and setup their systems. Go ahead. Break everything. Break the world. But do not expect me to recommend snap.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.