config container
option name lms
option timeout 60
in `/etc/config/lxc-auto. However, the container does not autostart on boot of the router. What am I missing here? Is the fact that the container is stored on a hard disk relevant?
/etc/init.d/lxc-auto is enabled. When I run it manually, it will correctly start/stop the container.
I’ll try your debugging suggestion later, can’t reboot the router just now. My suspicion would be that lxc-auto runs before the HD is mounted. If that is the case, is there any way to make it depend on the HD? I can always put a sleep in there, but that seems like an ugly solution.
a) add a long-enough pause (e.g. sleep 15) to /etc/init.d/lxc-auto to wait until the right file appears (non-deterministic)
b) add a flag to mount point: touch /srv/lxc/FLAG_UMOUNTED and (after mounted) touch /srv/lxc/FLAG_MOUNTED_VFAT (or _EXT4, etc.) and add code to /etc/init.d/lxc-auto to wait until the right file appears (deterministic)
c) increase the START=xx of /etc/init.d/lxc-auto (which is 00) relative to /etc/init.d/mountd (80)
or is it /etc/init.d/fstab (40) ?? - I can’t recall.
I generally use a variation/combination of b) plus one of the others…
Actually, I read your post too quickly. I agree a sleep is unsatisfactory, but it is simple.
I also suggested changing the init script, but a better option (especially if only one container is affected) may be to add something to the config file:
root@router:~# cat /etc/config/lxc-auto
config container
option name ‘ubuntu’
list command ‘sleep 15’
Sorry, this has partly been my mistake for not remembering my own setup. The lxc path actually sits on a RAID1 which only gets mounted after I execute mdadm --assemble --scan in /etc/rc.local, so it’s no wonder is’s not mounted when S99lxc-auto runs.
I’d like to find the canonical way to mount an md volume at boot, but I’ll open a separate thread for that.