To make something work, I need a shared memory device (/dev/shm) inside an LXD container. My exact problem is described here, but the solution does not apply to me as I am using LXD.
How do I accomplish this: lxc.mount.entry = none dev/shm tmpfs nodev,nosuid,noexec,mode=1777,create=dir 0 0
in an LXD container?
There is an existing rc init script, /etc/init.d/devfs, that is supposed to mount devfs at sysinit. It appears that it is affected by the very same problem that the Alpine image had (there was a post on this that I lost and cannot find), the init script has the keyword ‘-lxc’, indicating it should never run inside a container. Here’s how I fixed it:
#!/sbin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
description="Set up the /dev directory"
depend()
{
provide dev-mount
before dev
# defaults: keyword -docker -lxc -prefix -systemd-nspawn -vserver
keyword -docker lxc -prefix -systemd-nspawn -vserver
}
It mounts /dev. Setting keyword ‘lxc’ fixed the problems I was having and the container works for me in this state. We could try making it the default and revert if there are problems.