[SOLVED] LXC container fails to start because of bindmount

Joeman79

Active Member
Jul 1, 2018
2
0
41
46
Hi

I have been struggling with this problem for several weeks and I can't find what I may be missing.
On proxmox 5.2, following a tutorial from plex forums (I do not have the right to post the link), I have setup a privileged container using the available debian 9.3.1 template.
No difficulty so far.

Next step has been to mount several NFS shares from my nas on the host. This was done without problem on the host.
All shares are mounted via entries in fstab file. All shares mount without error and can be accessed via a test non root user.

It is when I try to bindmount those shares in my container that I hit a roadblock: the following lines were added in /etc/pve/lxc/103.conf
Code:
mp0: /mnt/hecate/films,mp=/mnt/hecate/films,quota=0,replicate=0,ro=1,shared=0
mp1: /mnt/hecate/series,mp=/mnt/hecate/series,quota=0,replicate=0,ro=1,shared=0
mp2: /mnt/hecate/musique,mp=/mnt/hecate/musique,quota=0,replicate=0,ro=1,shared=0
mp3: /mnt/hecate/photos,mp=/mnt/hecate/photos,quota=0,replicate=0,ro=1,shared=0
mp4: /mnt/hecate/anime,mp=/mnt/hecate/anime,quota=0,replicate=0,ro=1,shared=0
All /mnt/hecate/* are valid (at least it seems to me) nfs mounts on the host.
All /mnt/hecate/* exist inside the container.

When I try to start the container using this conf file via GUI, it fails with
Code:
vzstart:103:root@pam: command 'systemctl start pve-container@103' failed: exit code 1

I then tried to manually start the container in foreground using
Code:
vzstart:103:root@pam: command 'systemctl start pve-container@103' failed: exit code 1
The operation fails with
Code:
root@proxmox3:~# lxc-start -n 103 -F -l DEBUG -o /tmp/lxc-103.log -l DEBUG
lxc-start: 103: conf.c: run_buffer: 347 Script exited with status 13
lxc-start: 103: start.c: lxc_init: 815 Failed to run lxc.hook.pre-start for container "103"
lxc-start: 103: start.c: __lxc_start: 1849 Failed to initialize container "103"
The container failed to start.
Additional information can be obtained by setting the --logfile and --logpriority options.
This does not really help.

In the generated log file (attached to the post), the only relevant line seems to be
Code:
lxc-start 103 20180701192950.314 DEBUG    lxc_conf - conf.c:run_buffer:338 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 103 lxc pre-start with output: read-only check failed: Permission denied
Is it trying to check read only status for the hosts source directories? As a matter of fact, the nfs mounts on the host are all readonly.

To be sure, I tried commenting out all five mount points in the conf file. The container then starts correctly. There is some problem with the mount points.

After some fiddling, I managed to start the container with four out of the five bindmounts. I do not know how exactly I did this.
At the following reboot of the container, it failed to start again. I had to comment again some of the previously working bindmounts and uncomment them, one by one, rebooting each time.
With luck (really?), I managed to start it with almost all bindmounts. There is one I could never start the container with. I could not see what was different regarding this one from the others.

I have run ouf of ideas. I would gladly take any advice where to look for my (likely) mistake.

tldr: a privileged lxc container fails to start when using several bindmounts from nfs share on the host.

Jose
 

Attachments

I did not find a way make what I wanted, instead, I found a workaround: instead of having 5 nfs mounts on the host passed through bindmounts to the container, I bindmounted my 5 shares on the nas, exported them on one nfs share and bindmounted this unique nfs share to the container.
This works perfectly as far as I know