Refresh and remove failures

We are experiencing failures to remove and/or refresh an installed snap.

This problem occurs when a user managed by an active directory realm with an NFS home uses a snap and any $SNAP_USER_* directories are created on the NFS home. This is preventing us from refreshing and/or removing snaps on nodes that are members of an active directory realm. I know the user home tree has been barked up many times, so I’m not trying to beat a dead horse here, but instead report an occurrence of an issue we are experiencing and see if there is a path around it.

When a user managed via offsite identity management issues any commands provided by a snap the following happens on snap refresh or removal:

# Log into node as active directory user and see that ~/snap/slurm exists

$ juju ssh jbemfv@1
Last login: Wed Feb 24 18:04:38 2021 from engineering00.example.com
-bash-4.2$ ls -la ~/snap/slurm/
total 15
drwxr-sr-x 5 jbemfv scaniausers 91 Mar  4 14:07 .
drwxr-sr-x 3 jbemfv scaniausers 23 Feb  9 15:13 ..
drwxr-sr-x 2 jbemfv scaniausers  0 Feb  9 15:13 341
drwxr-sr-x 2 jbemfv scaniausers  0 Feb 16 15:07 351
drwxr-sr-x 2 jbemfv scaniausers  0 Feb  9 15:13 common
lrwxrwxrwx 1 jbemfv scaniausers  3 Mar  4 14:07 current -> 341


-bash-4.2$ ls -la /snap/slurm/
total 8
drwxr-xr-x.  3 root root 4096 Feb  9 13:32 .
drwxr-xr-x.  7 root root 4096 Feb 16 13:23 ..
drwxr-xr-x  15 root root  236 Nov 26 01:59 341
lrwxrwxrwx.  1 root root    3 Feb  9 13:32 current -> 341

# Try to refresh the snap

$ juju ssh 1
Last login: Thu Mar  4 14:06:19 2021 from engineering00.example.com
[ubuntu@p-c40 ~]$ sudo snap refresh slurm --beta --classic
error: cannot perform the following tasks:
- Copy snap "slurm" data (cannot copy "/home/jbemfv/snap/slurm/341" to "/home/jbemfv/snap/slurm/361": failed to copy all: "cp: cannot create directory ‘/home/jbemfv/snap/slurm/361’: Permission denied" (1))

Is there a way to disable $SNAP_USER_* directories?

Any insight or thoughts on how we might go about getting through this would be greatly appreciated.

Thanks