LXC Container Mount CIFS - Sporadically Hangs

Jim J

New Member
Oct 26, 2016
17
1
1
55
I've pieced together a few instructions from here and there to allow my Prox Containers to mount CIFS shares but I have the sporadic problem where accessing the shares hangs with no response for a few minutes. It clears...eventually.

In my case, multiple containers attempt to access the same Samba machine. Those containers are on the same host machine and tellingly, they both experience the hang problem at the same time. I think the problem lies with the host machine but can't be sure.

My setup involves the following apparmour.d changes
Code:
root@prox:/var/log# cat /etc/apparmor.d/lxc/lxc-default
.....
  # allow containers to mount CIFS connections
  allow mount fstype=cifs,
}

Code:
root@prox2:/var/log# cat /etc/apparmor.d/lxc/lxc-default-cgns
......
  # allow lxc to mount cifs
  allow mount fstype=cifs,
.....
}

My containers occasionally throw up these errors:
Code:
root@container1:~/scripts# cat /var/log/kern.log | grep cifs
Dec 19 19:15:41 container1 kernel: [  275.442318] CIFS VFS: cifs_mount failed w/return code = -101
Dec 20 14:41:32 container1 kernel: [70229.986146] CIFS VFS: cifs_mount failed w/return code = -101
Dec 20 14:41:32 container1 kernel: [70230.043271] CIFS VFS: cifs_mount failed w/return code = -101

Container /etc/fstab is...
Code:
//HOST/SHARE /mnt/DIRECTORY cifs credentials=/CRED-FILE,noexec,rw,uid=33,gid=33 0 0
 
I've been wondering if this is related the Samba server itself, so I'm going to try touching a file on the other end of the CIFS mount every 5 minutes to see if that makes a difference.
 
Thanks for providing the steps you used to allow CIFS mounts in LXC containers, it's much appreciated! :)