Permission issues with LXC container on GlusterFS volume

I’m trying to use LXC on a GlusterFS volume so the containers are synced between two nodes. The host machine is Ubuntu 18.04 LTS with the latest GlusterFS and LXC 3.0.

# mount -t glusterfs node1:/gv0 /mnt/replicated
# lxc storage create cont-storage dir source=/mnt/replicated
# lxc launch images:ubuntu/xenial cont -s cont-storage
# lxc start cont

The machine starts with success. The issue now is with permissions. This is what I get when I try apt-get update:

# lxc exec cont bash
root@cont:~# apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
0% [1 InRelease gpgv 247 kB] [2 InRelease 57.6 kB/109 kB 53%]Splitting up /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_xenial_InRelease into data and signErr:1 http://archive.ubuntu.com/ubuntu xenial InRelease      
  Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)
Reading package lists... Done                                
W: chown to _apt:root of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_xenial_InRelease - PrepareFiles (13: Permission denied)
W: chown to _apt:root of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_xenial_InRelease failed - Item::QueueURI (1: Operation not permitted)
W: chown to root:root of file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease failed - 201::URIDone (1: Operation not permitted)
W: chmod 0644 of file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease failed - 201::URIDone (1: Operation not permitted)
W: chown to _apt:root of file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease failed - Item::QueueURI (1: Operation not permitted)
W: chmod 0600 of file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease failed - Item::QueueURI (1: Operation not permitted)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.ubuntu.com/ubuntu xenial InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)
W: chown to root:root of file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_xenial-updates_InRelease failed - 201::URIDone (1: Operation not permitted)
W: chmod 0644 of file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_xenial-updates_InRelease failed - 201::URIDone (1: Operation not permitted)
W: Problem unlinking the file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease - PrepareFiles (13: Permission denied)
E: can not open /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease - fopen (13: Permission denied)
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_xenial-updates_InRelease - PrepareFiles (13: Permission denied)
E: can not open /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_xenial-updates_InRelease - fopen (13: Permission denied)

How do I fix this?

You may want to strace apt-get to see exactly what’s failing on glusterfs.

My guess is that it’s going to be some locking or xattr lacking. I don’t know if those are things that can be enabled in glusterfs or if it’s just going to be missing, if the latter, then there’s not going to be much you can do.