Problem getting machineid on LXC/LXD container

When you install Trisul packages like the probe or hub on a LXC/LXD linux container you might face an error where Trisul is unable to get the machineID of the container.

The error could be something like the following ; when you try to get the machineID from the hub or probe node from the admin panel.

Fix this error to allow LXC nodes to get the machineID

Essentially you need to set the container permissions to allow access to the /dev/mem device from the host which is used as part of dmidecode. Do the following steps.

lxc stop <container_name>
lxc config set <container_name> security.privileged true
lxc config device add <container_name> devmem unix-char source=/dev/mem
lxc restart <container_name>

To test if it works do

lxc exec <container_name> dmidecode

If that does not work add the following commands and retry

lxc config set <container_name> raw.lxc 'lxc.cap.drop='
lxc config set <container_name> raw.lxc 'lxc.cap.keep='