facter inside docker container missing dmi information

Asked by Anthony Ciaravalo on 2019-07-31

I am trying to upgrade our puppet installation from 2.7 (ubuntu 12.04) to 3.8 (ubuntu 16.04), then to latest on ubuntu 18.04 and one of our templates is failing because it can't find the productname fact in the docker container.

I read through the source code in lib/src/facts/linux/dmi_resolver.cc I see its checking for

if (exists("/sys/class/dmi/", ec)) {
            result.product_name = read("/sys/class/dmi/id/product_name");

which exists when i check it

$ cat /sys/class/dmi/id/product_name
PowerEdge R640

but facter productname does not return anything inside the docker container, so a ruby template using that fact is failing. It looks like all the dmi related facts are missing inside the container.

This is inside an ubuntu 16.04 docker container with facter version 2.4.6 on an ubuntu 18.04 host.

Any suggestions for getting this working correctly?

Question information

English Edit question
Ubuntu facter Edit question
No assignee Edit question
Last query:
Last reply:

Could you put some text in the relevant file using:

echo "PowerEdge R640" | sudo tee /path/to/file > /dev/null

Just to satisfy it for now?

Anthony Ciaravalo (ciaravalo) said : #2

The relevant file which is /sys/class/dmi/id/product_name already shows the product name inside the docker container, but dmi_resolver.cc code is not reading it.

I did not read the source carefully enough to figure out if its running dmidecode even though /sys/class/dmi is available.

Is it possible its defaulting to using dmidecode, instead of reading from /sys/class/dmi/, which does not work in a docker container?

Launchpad Janitor (janitor) said : #3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.