Home / “/sys/devices/virtual/dmi/id/product_uuid” file permission changes

“/sys/devices/virtual/dmi/id/product_uuid” file permission changes

When the server is restarted, or a patch is installed, the permissions on the file /sys/devices/virtual/dmi/id/product uuid are permanently changed from 444 to 400.
The permission 444 on /sys/devices/virtual/dmi/id/product uuid can be hard-coded by the following steps.

First, check the corresponding uuid.

# cat /sys/devices/virtual/dmi/id/product_uuid
<should_output_your_uuid> <--This is the required product_uuid

Set an udev rule by making the file /etc/udev/rules.d/99-dmi.rules and putting your UUID in it.

# vim /etc/udev/rules.d/99-dmi.rules
---
ACTION!="add|change", GOTO="dmi_end"
ATTR{[dmi/id]product_uuid}=="", RUN+="/usr/bin/chmod 444 /sys/devices/virtual/dmi/id/product_uuid" 
LABEL="dmi_end"
---

Trigger udev to test it.

# udevadm control --reload
# udevadm trigger

Check to see if the permission is now 444.

# ls -l /sys/devices/virtual/dmi/id/product_uuid
-r--r--r--. 1 root root 4096 Jun 10 11:26 /sys/devices/virtual/dmi/id/product_uuid

The root cause of this permission issue is that 400 has been set due to a change in dmi-id.c code as shown below. Here is a piece of the corresponding code.

- drivers/firmware/dmi-id.c
...
DEFINE_DMI_ATTR_WITH_SHOW(bios_vendor,          0444, DMI_BIOS_VENDOR);
DEFINE_DMI_ATTR_WITH_SHOW(bios_version,         0444, DMI_BIOS_VERSION);
DEFINE_DMI_ATTR_WITH_SHOW(bios_date,            0444, DMI_BIOS_DATE);
DEFINE_DMI_ATTR_WITH_SHOW(sys_vendor,           0444, DMI_SYS_VENDOR);
DEFINE_DMI_ATTR_WITH_SHOW(product_name,         0444, DMI_PRODUCT_NAME);
DEFINE_DMI_ATTR_WITH_SHOW(product_version,      0444, DMI_PRODUCT_VERSION);
DEFINE_DMI_ATTR_WITH_SHOW(product_serial,       0400, DMI_PRODUCT_SERIAL);
DEFINE_DMI_ATTR_WITH_SHOW(product_uuid,         0400, DMI_PRODUCT_UUID);    <--- Permission set to '400'
DEFINE_DMI_ATTR_WITH_SHOW(board_vendor,         0444, DMI_BOARD_VENDOR);
DEFINE_DMI_ATTR_WITH_SHOW(board_name,           0444, DMI_BOARD_NAME);
DEFINE_DMI_ATTR_WITH_SHOW(board_version,        0444, DMI_BOARD_VERSION);
DEFINE_DMI_ATTR_WITH_SHOW(board_serial,         0400, DMI_BOARD_SERIAL);
DEFINE_DMI_ATTR_WITH_SHOW(board_asset_tag,      0444, DMI_BOARD_ASSET_TAG);
DEFINE_DMI_ATTR_WITH_SHOW(chassis_vendor,       0444, DMI_CHASSIS_VENDOR);
DEFINE_DMI_ATTR_WITH_SHOW(chassis_type,         0444, DMI_CHASSIS_TYPE);
DEFINE_DMI_ATTR_WITH_SHOW(chassis_version,      0444, DMI_CHASSIS_VERSION);
DEFINE_DMI_ATTR_WITH_SHOW(chassis_serial,       0400, DMI_CHASSIS_SERIAL);
DEFINE_DMI_ATTR_WITH_SHOW(chassis_asset_tag,    0444, DMI_CHASSIS_ASSET_TAG);

Leave a Reply