Setup:
Host:
mike@ford:~$ uname -a
Linux ford 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
mike@ford:~$ lxc version
Client version: 5.6
Server version: 5.6
mike@ford:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
- One main user - uid 1000 gid 1000
- NFS mounted folders in /etc/fstab
- NFS folders are shared onto other Ubuntu 20.04 desktop environments where each user is either the same uid and gid or they are under the same gid to have rw access to the files and folders on the file server
Container:
- Ubuntu Server 20.04 running Nextcloud 23.05 with LAMP
- Default user (uid 1000 gid 1000), www-data (uid 33 gid 33) for Nextcloud + one I created when I attempted to share the NFS mounted folders from the host to the container (uid 1001 gid 1001)
Goal:
- Have the container user www-data rw access to the NFS mounted folders
- Eventually do the same in other, future containers
- Have the existing nfs mounts outside of this server still continue to maintain their current access and permissions
Reproducible Issues:
- After attempting to use shiftfs I run into the error
Error: Failed to handle idmapped storage: invalid argument - Failed to change ACLs on /var/snap/lxd/common/lxd/storage-pools/default/containers/nextcloud/rootfs/var/log/journal
Try `lxc info --show-log nextcloud` for more info
Let’s see if I can figure out how to explain this… This is the steps, in the order I applied them, and their results:
mike@ford:~$ modinfo shiftfs
filename: /lib/modules/5.4.0-128-generic/kernel/fs/shiftfs.ko
license: GPL v2
description: id shifting filesystem
author: Christian Brauner <christian.brauner@ubuntu.com>
author: Seth Forshee <seth.forshee@canonical.com>
author: James Bottomley
alias: fs-shiftfs
srcversion: 225AF9C817280FFD72CB9A8
depends:
retpoline: Y
intree: Y
name: shiftfs
vermagic: 5.4.0-128-generic SMP mod_unload modversions
sig_id: PKCS#7
signer: Build time autogenerated kernel key
sig_key: 78:F3:A0:F8:41:58:7F:86:D7:73:F7:84:CC:EE:03:B7:33:B2:EC:6C
sig_hashalgo: sha512
signature:
mike@ford:~$ sudo snap set lxd shiftfs.enable=true
mike@ford:~$ sudo systemctl reload snap.lxd.daemon
mike@ford:~$ lxc info
shiftfs: "true"
mike@ford:~$ lxc config set nextcloud security.privileged true
mike@ford:~$ lxc restart nextcloud
Error: Failed to handle idmapped storage: invalid argument - Failed to change ACLs on /var/snap/lxd/common/lxd/storage-pools/default/containers/nextcloud/rootfs/var/log/journal
Try `lxc info --show-log nextcloud` for more info
mike@ford:~$ lxc info --show-log nextcloud
Name: nextcloud
Status: STOPPED
Type: container
Architecture: x86_64
Created: 2022/10/08 20:36 UTC
Last Used: 2022/10/15 00:09 UTC
Log:
Yes, the log is empty.
mike@ford:~$ lxc config show nextcloud -e
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 20.04 LTS amd64 (release) (20221003)
image.label: release
image.os: ubuntu
image.release: focal
image.serial: "20221003"
image.type: squashfs
image.version: "20.04"
security.privileged: "true"
volatile.base_image: 0c3a7ed4f4133852ca2b91d9157082a2cf53498f3c6cec97fb4a48661c01f1c8
volatile.cloud-init.instance-id: ec30b506-0a8e-4f3f-a826-5c3b1249e001
volatile.eth0.hwaddr: 00:16:3e:3c:96:5f
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: STOPPED
volatile.last_state.ready: "false"
volatile.uuid: b6ed334f-bbee-4e90-bd26-54a1ce9b8e54
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
mike@ford:~$ lxc config set nextcloud security.privileged false
mike@ford:~$ lxc start nextcloud
The container starts up successfully now.
mike@ford:~$ lxc config show nextcloud
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 20.04 LTS amd64 (release) (20221003)
image.label: release
image.os: ubuntu
image.release: focal
image.serial: "20221003"
image.type: squashfs
image.version: "20.04"
security.privileged: "false"
volatile.base_image: 0c3a7ed4f4133852ca2b91d9157082a2cf53498f3c6cec97fb4a48661c01f1c8
volatile.cloud-init.instance-id: ec30b506-0a8e-4f3f-a826-5c3b1249e001
volatile.eth0.host_name: vethe8f20c9d
volatile.eth0.hwaddr: 00:16:3e:3c:96:5f
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: RUNNING
volatile.last_state.ready: "false"
volatile.uuid: b6ed334f-bbee-4e90-bd26-54a1ce9b8e54
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""
I used (primarily) the following pages to implement shiftfs:
Sooooo, what did I miss? Where is my mistake, as I’m sure it’s something I can’t quite see, now working on this yesterday and today, and recreating the results each time. Thanks!