<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Just another blog (Posts about ubuntu)</title><link>https://www.setphaserstostun.org/</link><description></description><atom:link href="https://www.setphaserstostun.org/categories/ubuntu.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:gabriele.svelto@gmail.com"&gt;Gabriele Svelto&lt;/a&gt; </copyright><lastBuildDate>Tue, 04 Aug 2026 22:12:35 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Monitoring ECC memory on Linux with rasdaemon</title><link>https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/</link><dc:creator>Gabriele Svelto</dc:creator><description>&lt;p&gt;If you have a workstation built around an AMD Ryzen/Threadripper or Intel Xeon
processor chances are you're using &lt;a class="reference external" href="https://en.wikipedia.org/wiki/ECC_memory"&gt;ECC memory&lt;/a&gt;. ECC memory is a worthy
investment to improve the reliability of your machine and if properly monitored
will allow you to spot memory problems before they become catastrophic.&lt;/p&gt;
&lt;p&gt;On recent Linux kernels the &lt;a class="reference external" href="https://github.com/mchehab/rasdaemon"&gt;rasdaemon&lt;/a&gt; tools can be used to monitor ECC memory
and report both correctable and uncorrectable memory errors. As we'll see with a
little bit of tweaking it's also possible to know exactly which DIMM is
experiencing the errors.&lt;/p&gt;
&lt;nav class="contents" id="contents" role="doc-toc"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#top"&gt;Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#installing-rasdaemon" id="toc-entry-1"&gt;Installing rasdaemon&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#configuring-rasdaemon" id="toc-entry-2"&gt;Configuring rasdaemon&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#configuring-dimm-labels" id="toc-entry-3"&gt;Configuring DIMM labels&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#troubleshooting" id="toc-entry-4"&gt;Troubleshooting&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;
&lt;section id="installing-rasdaemon"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#toc-entry-1" role="doc-backlink"&gt;Installing rasdaemon&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First of all you'll need to intall &lt;strong&gt;rasdeamon&lt;/strong&gt;, it's packaged for most Linux
distributions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debian/Ubuntu&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# apt-get install rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fedora&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# dnf install rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;openSUSE&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# zypper install rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gentoo&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The package is currently marked as unstable so you'll need to unmask it first:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# echo "app-admin/rasdaemon ~amd64" &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;/pre&gt;
&lt;p&gt;Then I recommend enabling sqlite support, this makes rasdaemon record events
to disk and is particularly useful for machines that get rebooted often:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# echo "app-admin/rasdaemon sqlite" &amp;gt;&amp;gt; /etc/portage/packages.use&lt;/pre&gt;
&lt;p&gt;Finally install rasdaemon itself:&lt;/p&gt;
&lt;pre class="literal-block"&gt;emerge rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="configuring-rasdaemon"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#toc-entry-2" role="doc-backlink"&gt;Configuring rasdaemon&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Then we'll setup &lt;strong&gt;rasdaemon&lt;/strong&gt; to launch at startup and to record events to
an on-disk sqlite database.&lt;/p&gt;
&lt;p&gt;Note that when booting with Secure Boot enabled, using the kernel lockdown
facility in &lt;strong&gt;confidentiality&lt;/strong&gt; mode will prevent rasdaemon from running. To
use &lt;strong&gt;rasdaemon&lt;/strong&gt; you'll have to use a different lockdown mode, disable
lockdown entirely or disable Secure Boot. You'll find more information in the
&lt;a class="reference internal" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#troubleshooting"&gt;Troubleshooting&lt;/a&gt; section.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debian/Ubuntu/Fedora/openSUSE and other systemd-based distros&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# systemctl enable rasdaemon
# systemctl start rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gentoo with OpenRC&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Add the following line to &lt;code class="docutils literal"&gt;/etc/conf.d/rasdaemon&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;RASDAEMON_ARGS=--record&lt;/pre&gt;
&lt;p&gt;Add &lt;code class="docutils literal"&gt;rasdaemon&lt;/code&gt; to the &lt;strong&gt;default&lt;/strong&gt; run-level and start it&lt;/p&gt;
&lt;pre class="literal-block"&gt;# rc-config add rasdaemon default
# rc-config start rasdaemon&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="configuring-dimm-labels"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#toc-entry-3" role="doc-backlink"&gt;Configuring DIMM labels&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At this point &lt;strong&gt;rasdaemon&lt;/strong&gt; should already be running on your system. You can
now use the &lt;strong&gt;ras-mc-ctl&lt;/strong&gt; tool to query the errors that have been detected.
From now on I will use data from my machine to give an example of the output.&lt;/p&gt;
&lt;pre class="literal-block"&gt;# ras-mc-ctl --error-count
Label                 CE      UE
mc#0csrow#2channel#0  0   0
mc#0csrow#2channel#1  0   0
mc#0csrow#3channel#1  0   0
mc#0csrow#3channel#0  0   0&lt;/pre&gt;
&lt;p&gt;The CE column represents the number of corrected errors for a given DIMM, UE
represents uncorrectable errors that were detected. The label on the left
shows the EDAC path under &lt;code class="docutils literal"&gt;/sys/devices/system/edac/mc/&lt;/code&gt; of every DIMM.&lt;/p&gt;
&lt;p&gt;This is not very readable. Since the kernel has no idea of the physical layout
of your motherboard it will print the EDAC paths instead of the names of the
DIMM slots. We can confirm that the labels are missing with this command:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# ras-mc-ctl --print-labels
ras-mc-ctl: Error: No dimm labels for ASUSTeK COMPUTER INC. model PRIME B450-PLUS&lt;/pre&gt;
&lt;p&gt;To identify which DIMM slot corresponds to which EDAC path you will have to
reboot your system with only one DIMM inserted, write down the name of the
slot you insterted it in and then printing out the paths with
&lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;ras-mc-ctl&lt;/span&gt; &lt;span class="pre"&gt;--error-count&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In my case this was the mapping:&lt;/p&gt;
&lt;pre class="literal-block"&gt;mc#0csrow#0channel#0  DIMM_A1
mc#0csrow#0channel#1  DIMM_A2
mc#0csrow#1channel#1  DIMM_A2
mc#0csrow#1channel#0  DIMM_A1
mc#0csrow#2channel#0  DIMM_B1
mc#0csrow#2channel#1  DIMM_B2
mc#0csrow#3channel#1  DIMM_B2
mc#0csrow#3channel#0  DIMM_B1&lt;/pre&gt;
&lt;p&gt;Note that there's more than one path per DIMM label, that's fine.&lt;/p&gt;
&lt;p&gt;With this data at hand create a text file under &lt;code class="docutils literal"&gt;/etc/ras/dimm_labels.d/&lt;/code&gt;.
You will need to fill it up with the mapping data in the following format:&lt;/p&gt;
&lt;pre class="literal-block"&gt;Vendor: &amp;lt;motherboard vendor name&amp;gt;
Model: &amp;lt;motherboard model name&amp;gt;
  &amp;lt;label&amp;gt;: &amp;lt;mc&amp;gt;.&amp;lt;row&amp;gt;.&amp;lt;channel&amp;gt;&lt;/pre&gt;
&lt;p&gt;You can obtain the motherboard vendor and model name with the following
command:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# sudo ras-mc-ctl --mainboard
ras-mc-ctl: mainboard: ASUSTeK COMPUTER INC. model PRIME B450-PLUS&lt;/pre&gt;
&lt;p&gt;The label lines take a string (the name of the physical DIMM slot), then the
numbers in the EDAC path corresponding to the physical slot. You can put
more than one label entry per line by separating them with a semicolon. If a
given label is associated with more than one EDAC path you can add the separate
&lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;lt;mc&amp;gt;.&amp;lt;row&amp;gt;.&amp;lt;channel&amp;gt;&lt;/span&gt;&lt;/code&gt; sequences by separating them with a comma.&lt;/p&gt;
&lt;p&gt;In my case the resulting file (&lt;code class="docutils literal"&gt;/etc/ras/dimm_labels.d/asus&lt;/code&gt;) looks like this:&lt;/p&gt;
&lt;pre class="literal-block"&gt;Vendor: ASUSTeK COMPUTER INC.
Model: PRIME B450-PLUS
  DIMM_A1:  0.0.0, 0.1.0;    DIMM_A2:   0.0.1, 0.1.1;
  DIMM_B1:  0.2.0, 0.3.0;    DIMM_B2:   0.2.1, 0.3.1;&lt;/pre&gt;
&lt;p&gt;You can find another example of this, with configuration entries for a bunch of
other motherboards, in the &lt;a class="reference external" href="https://github.com/grondo/edac-utils/blob/master/src/etc/labels.db"&gt;edac-utils&lt;/a&gt; repo.&lt;/p&gt;
&lt;p&gt;Once the file is ready it's time to load the labels in the kernel with the
following command:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# ras-mc-ctl --register-labels&lt;/pre&gt;
&lt;p&gt;Printing out labels and error counts will now use the physical DIMM slot names.
This is much better if you need to figure out which of your DIMMs is faulty and
needs to be replaced:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# ras-mc-ctl --print-labels
LOCATION                            CONFIGURED LABEL     SYSFS CONTENTS
                                    DIMM_A1              0:0:0 missing
                                    DIMM_A2              0:0:1 missing
                                    DIMM_A1              0:1:0 missing
                                    DIMM_A2              0:1:1 missing
mc0 csrow 2 channel 0               DIMM_B1              DIMM_B1
mc0 csrow 2 channel 1               DIMM_B2              DIMM_B2
mc0 csrow 3 channel 0               DIMM_B1              DIMM_B1
mc0 csrow 3 channel 1               DIMM_B2              DIMM_B2

# ras-mc-ctl --error-count
Label   CE      UE
DIMM_B2 0       0
DIMM_B1 0       0
DIMM_B1 0       0
DIMM_B2 0       0&lt;/pre&gt;
&lt;p&gt;To persist the DIMM names across reboots load the &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;rac-mc-ctl&lt;/span&gt;&lt;/code&gt; service at
startup:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debian/Ubuntu/Fedora and other systemd-based distros&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# systemctl enable ras-mc-ctl
# systemctl start ras-mc-ctl&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gentoo with OpenRC&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;# rc-config add ras-mc-ctl default
# rc-config start ras-mc-ctl&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You're done! After rebooting your system rasdaemon will be continually running
and recording errors. You can use &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;ras-mc-ctl&lt;/span&gt;&lt;/code&gt; to print out a summary of all
the errors that have been seen and recorded. Since the counts are stored on
disk they will be persisted across reboots. Here's some example output from my
machine:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# ras-mc-ctl --summary
Memory controller events summary:
  Corrected on DIMM Label(s): 'DIMM_B1' location: 0:2:0:-1 errors: 5

PCIe AER events summary:
  1 Uncorrected (Non-Fatal) errors: BIT21

No Extlog errors.

No devlink errors.
Disk errors summary:
  0:0 has 6646 errors
No MCE errors.&lt;/pre&gt;
&lt;/section&gt;
&lt;section id="troubleshooting"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/#toc-entry-4" role="doc-backlink"&gt;Troubleshooting&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;ras-mc-ctl&lt;/span&gt; &lt;span class="pre"&gt;--status&lt;/span&gt;&lt;/code&gt; prints out &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;ras-mc-ctl:&lt;/span&gt; drivers are not loaded&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;rasdaemon&lt;/strong&gt; to work the EDAC kernel drivers for your particular
machine need to be loaded. They are usually loaded automatically at boot. You
can check out which ones are loaded with this command:&lt;/p&gt;
&lt;pre class="literal-block"&gt;# lsmod | grep edac
amd64_edac_mod         32768  0
edac_mce_amd           28672  1 amd64_edac_mod&lt;/pre&gt;
&lt;p&gt;If the EDAC drivers haven't been loaded automatically either your kernel
doesn't provide one for your machine or you need to manually load it. Check
the &lt;a class="reference external" href="https://www.kernel.org/doc/html/latest/driver-api/edac.html"&gt;EDAC kernel documentation&lt;/a&gt; for more details.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;rasdaemon&lt;/code&gt; fails to start, complaining it can't access the debugfs
filesystem&lt;/p&gt;
&lt;p&gt;You're likely using the kernel lockdown module in &lt;strong&gt;confidentiality&lt;/strong&gt; mode.
When Secure Boot is enabled this will prevent &lt;strong&gt;rasdaemon&lt;/strong&gt; from reading the
files it needs to gather its statistics. &lt;strong&gt;rasdaemon&lt;/strong&gt; can work with kernel
lockdown when using the &lt;strong&gt;integrity&lt;/strong&gt; mode. To switch to &lt;strong&gt;integrity&lt;/strong&gt; mode
add the &lt;cite&gt;lockdown=integrity&lt;/cite&gt; option to the Linux kernel command line in your
boot loader.&lt;/p&gt;
&lt;p&gt;When using &lt;strong&gt;GRUB&lt;/strong&gt; this can usually be achieved by editing
&lt;code class="docutils literal"&gt;/etc/default/grub&lt;/code&gt; and changing the &lt;code class="docutils literal"&gt;GRUB_CMDLINE_LINUX_DEFAULT&lt;/code&gt;
variable to include the option, e.g.:&lt;/p&gt;
&lt;pre class="literal-block"&gt;GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lockdown=integrity"&lt;/pre&gt;
&lt;p&gt;Keep in mind that &lt;strong&gt;integrity&lt;/strong&gt; mode is less strict than &lt;strong&gt;confidentiality&lt;/strong&gt;
mode, as it permits userspace applications to access a fair amount of
information that lives in the kernel. This might not be suitable for some
deployments - such as those that must run untrusted userspace code.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>debian</category><category>ecc</category><category>fedora</category><category>gentoo</category><category>linux</category><category>memory</category><category>opensuse</category><category>ubuntu</category><guid>https://www.setphaserstostun.org/posts/monitoring-ecc-memory-on-linux-with-rasdaemon/</guid><pubDate>Thu, 13 Feb 2020 22:31:44 GMT</pubDate></item></channel></rss>