A Nifty Way To Access Linux Memory/RAM Information

Written by Michael Larabel in Hardware on 9 January 2024 at 04:00 AM EST. 21 Comments
HARDWARE
Making use of dmidecode is the go-to way of being able to read various DIMM memory information on Linux systems like the model number, speed, and other attributes. But sadly using dmidecode is restricted to root due to needing to access /dev/mem. But it turns out there is another less reported way to receive much the same information.

Recently a number of readers have been inquiring about memory details on a number of my benchmark articles in curious about the memory type/frequency and other details with some of the new laptops and other devices. With the automated system details that information isn't reported unless I'm benchmarking as root due to depending upon dmidecode for parsing that memory information.

But Red Hat engineer Hans de Goede recently pointed out an alternative. During the boot process on recent Linux distributions, udev extracts the DMI information and stores it in the udev database.

udevadm info output


So on recent Linux distributions with the likes of running udevadm info -e | grep -e MEMORY_DEVICE as a normal user it's possible to access the DIMM memory device information. E.g.
$ udevadm info -e | grep -e MEMORY_DEVICE -e MEMORY_ARRAY
E: MEMORY_ARRAY_LOCATION=System Board Or Motherboard
E: MEMORY_ARRAY_MAX_CAPACITY=68719476736
E: MEMORY_DEVICE_0_TOTAL_WIDTH=32
E: MEMORY_DEVICE_0_DATA_WIDTH=32
E: MEMORY_DEVICE_0_SIZE=17179869184
E: MEMORY_DEVICE_0_FORM_FACTOR=Other
E: MEMORY_DEVICE_0_LOCATOR=DIMM 0
E: MEMORY_DEVICE_0_BANK_LOCATOR=P0 CHANNEL A
E: MEMORY_DEVICE_0_TYPE=
E: MEMORY_DEVICE_0_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
E: MEMORY_DEVICE_0_SPEED_MTS=6400
E: MEMORY_DEVICE_0_MANUFACTURER=Micron Technology
E: MEMORY_DEVICE_0_SERIAL_NUMBER=00000000
E: MEMORY_DEVICE_0_ASSET_TAG=Not Specified
E: MEMORY_DEVICE_0_PART_NUMBER=MT62F4G32D8DV-026 WT
E: MEMORY_DEVICE_0_RANK=2
E: MEMORY_DEVICE_0_CONFIGURED_SPEED_MTS=6400
E: MEMORY_DEVICE_0_MINIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_0_MAXIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_0_CONFIGURED_VOLTAGE=0.5
E: MEMORY_DEVICE_0_MEMORY_TECHNOLOGY=DRAM
E: MEMORY_DEVICE_0_MEMORY_OPERATING_MODE_CAPABILITY=Volatile memory
E: MEMORY_DEVICE_0_FIRMWARE_VERSION=Unknown
E: MEMORY_DEVICE_0_MODULE_MANUFACTURER_ID=Bank 1, Hex 0x2C
E: MEMORY_DEVICE_0_VOLATILE_SIZE=17179869184
E: MEMORY_DEVICE_1_TOTAL_WIDTH=32
E: MEMORY_DEVICE_1_DATA_WIDTH=32
E: MEMORY_DEVICE_1_SIZE=17179869184
E: MEMORY_DEVICE_1_FORM_FACTOR=Other
E: MEMORY_DEVICE_1_LOCATOR=DIMM 0
E: MEMORY_DEVICE_1_BANK_LOCATOR=P0 CHANNEL B
E: MEMORY_DEVICE_1_TYPE=
E: MEMORY_DEVICE_1_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
E: MEMORY_DEVICE_1_SPEED_MTS=6400
E: MEMORY_DEVICE_1_MANUFACTURER=Micron Technology
E: MEMORY_DEVICE_1_SERIAL_NUMBER=00000000
E: MEMORY_DEVICE_1_ASSET_TAG=Not Specified
E: MEMORY_DEVICE_1_PART_NUMBER=MT62F4G32D8DV-026 WT
E: MEMORY_DEVICE_1_RANK=2
E: MEMORY_DEVICE_1_CONFIGURED_SPEED_MTS=6400
E: MEMORY_DEVICE_1_MINIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_1_MAXIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_1_CONFIGURED_VOLTAGE=0.5
E: MEMORY_DEVICE_1_MEMORY_TECHNOLOGY=DRAM
E: MEMORY_DEVICE_1_MEMORY_OPERATING_MODE_CAPABILITY=Volatile memory
E: MEMORY_DEVICE_1_FIRMWARE_VERSION=Unknown
E: MEMORY_DEVICE_1_MODULE_MANUFACTURER_ID=Bank 1, Hex 0x2C
E: MEMORY_DEVICE_1_VOLATILE_SIZE=17179869184
E: MEMORY_DEVICE_2_TOTAL_WIDTH=32
E: MEMORY_DEVICE_2_DATA_WIDTH=32
E: MEMORY_DEVICE_2_SIZE=17179869184
E: MEMORY_DEVICE_2_FORM_FACTOR=Other
E: MEMORY_DEVICE_2_LOCATOR=DIMM 0
E: MEMORY_DEVICE_2_BANK_LOCATOR=P0 CHANNEL C
E: MEMORY_DEVICE_2_TYPE=
E: MEMORY_DEVICE_2_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
E: MEMORY_DEVICE_2_SPEED_MTS=6400
E: MEMORY_DEVICE_2_MANUFACTURER=Micron Technology
E: MEMORY_DEVICE_2_SERIAL_NUMBER=00000000
E: MEMORY_DEVICE_2_ASSET_TAG=Not Specified
E: MEMORY_DEVICE_2_PART_NUMBER=MT62F4G32D8DV-026 WT
E: MEMORY_DEVICE_2_RANK=2
E: MEMORY_DEVICE_2_CONFIGURED_SPEED_MTS=6400
E: MEMORY_DEVICE_2_MINIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_2_MAXIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_2_CONFIGURED_VOLTAGE=0.5
E: MEMORY_DEVICE_2_MEMORY_TECHNOLOGY=DRAM
E: MEMORY_DEVICE_2_MEMORY_OPERATING_MODE_CAPABILITY=Volatile memory
E: MEMORY_DEVICE_2_FIRMWARE_VERSION=Unknown
E: MEMORY_DEVICE_2_MODULE_MANUFACTURER_ID=Bank 1, Hex 0x2C
E: MEMORY_DEVICE_2_VOLATILE_SIZE=17179869184
E: MEMORY_DEVICE_3_TOTAL_WIDTH=32
E: MEMORY_DEVICE_3_DATA_WIDTH=32
E: MEMORY_DEVICE_3_SIZE=17179869184
E: MEMORY_DEVICE_3_FORM_FACTOR=Other
E: MEMORY_DEVICE_3_LOCATOR=DIMM 0
E: MEMORY_DEVICE_3_BANK_LOCATOR=P0 CHANNEL D
E: MEMORY_DEVICE_3_TYPE=
E: MEMORY_DEVICE_3_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
E: MEMORY_DEVICE_3_SPEED_MTS=6400
E: MEMORY_DEVICE_3_MANUFACTURER=Micron Technology
E: MEMORY_DEVICE_3_SERIAL_NUMBER=00000000
E: MEMORY_DEVICE_3_ASSET_TAG=Not Specified
E: MEMORY_DEVICE_3_PART_NUMBER=MT62F4G32D8DV-026 WT
E: MEMORY_DEVICE_3_RANK=2
E: MEMORY_DEVICE_3_CONFIGURED_SPEED_MTS=6400
E: MEMORY_DEVICE_3_MINIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_3_MAXIMUM_VOLTAGE=0.5
E: MEMORY_DEVICE_3_CONFIGURED_VOLTAGE=0.5
E: MEMORY_DEVICE_3_MEMORY_TECHNOLOGY=DRAM
E: MEMORY_DEVICE_3_MEMORY_OPERATING_MODE_CAPABILITY=Volatile memory
E: MEMORY_DEVICE_3_FIRMWARE_VERSION=Unknown
E: MEMORY_DEVICE_3_MODULE_MANUFACTURER_ID=Bank 1, Hex 0x2C
E: MEMORY_DEVICE_3_VOLATILE_SIZE=17179869184
E: MEMORY_ARRAY_NUM_DEVICES=4

What you may notice though is the DIMM type information being reported "out of spec"... I've seen this on several systems over the past two weeks of testing. DDR5/LPDDR5-based systems on modern Linux distributions are unfortunately reporting the memory type as "out of spec" with not recognizing the newer memory. However, dmidecode as root does successfully report this information correctly. There's also the matter of the voltage information being seemingly inaccurate but that's a lesser problem and haven't investigated that as extensively.

In any event with my testing thus far the DIMM vendor/model number, MT/s reporting, and other metrics have otherwise been working out well. Thus moving forward able to provide better transparency in those areas when not running as root and a handy hint for others looking at finding out system memory details while not having root access. The "udevadm info -e" can also be used for accessing other DMI information that otherwise is normally restricted to root access. Too bad though there isn't a universal solution for Linux like dmidecode being able to fallback to the udev database where available or similar rather than this existing fragmented mess since the failure of HAL and not as many accepted standards as Windows.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week