package: add rasdaemon support.
v2 cover package: add rasdaemon support.
Hi all,
Rasdaemon is a tool that provides a way to collect all hardware error events reported by the Linux kernel in a common framework.
My use case is on a PowerPC P2020. I use to it to monitor and react to the PCIe AER events caught by the SoC's EDAC.
The first patch adds the package. The second one adds a small test for it in support/testing. Adding fake error injections in the selftest isn't trivial so it only ensures the daemon does run.
---
Changes in v2:
- PATCH 1:
Init script: Use a PID file
Config.in: Add comment for the BR2_SHARED_LIBS dependency, fix the AER feature description rasdaemon.mk: Add License's hash
- PATCH 2:
Add a check to ensure the daemon does run once started by the init
script.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Bastien Curutchet (2):
package/rasdaemon: Add rasdaemon package
support/testing: add rasdaemon tests
DEVELOPERS | 4 ++ package/Config.in | 1 + package/rasdaemon/Config.in | 25 ++++++++ package/rasdaemon/S95rasdaemon | 69 ++++++++++++++++++++++ package/rasdaemon/rasdaemon.hash | 3 + package/rasdaemon/rasdaemon.mk | 33 +++++++++++ support/testing/tests/package/test_rasdaemon.py | 46 +++++++++++++++ .../package/test_rasdaemon/linux-debugfs.fragment | 8 +++ 8 files changed, 189 insertions(+)
---
base-commit: c8cb1a238de5a803228f12ad32b36cae2acfc778
change-id: 20251125-rasdaemon-1df4904ddfde
Best regards,
Signature · 6 lines
Bastien Curutchet <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/2 package/rasdaemon: Add rasdaemon package
Rasdaemon is a tool that aims to replace the edac-tool and provide a way to collect all hardware error events reported by the Linux kernel in a common framework.
Add a new package to support rasdaemon in the 'Hardware handling' section. It depends on libtraceevents to detect the ftrace events generated by the kernel and on sqlite to store these events.
Support for the PCIe AER events is optionnal and implies a dependency on pciutils so also add a dedicated 'sub-option' to enable it.
Add a SYSV init script to start / stop the daemon
Add myself to the DEVELOPERS file.
--- DEVELOPERS | 3 ++ package/Config.in | 1 + package/rasdaemon/Config.in | 25 +++++++++++++++ package/rasdaemon/S95rasdaemon | 69 ++++++++++++++++++++++++++++++++++++++++ package/rasdaemon/rasdaemon.hash | 3 ++ package/rasdaemon/rasdaemon.mk | 33 +++++++++++++++++++ 6 files changed, 134 insertions(+)
DEVELOPERS +3 -0
@@ -341,6 +341,9 @@ F: package/tcpdump/ F: package/ti-uim/ F: package/uhubctl/ +N: Bastien Curutchet <[email protected]> +F: package/rasdaemon/ + N: Baxiche Su <[email protected]> F: package/qt6/qt6multimedia/
package/Config.in +1 -0
@@ -584,6 +584,7 @@ endmenu source "package/pru-software-support/Config.in" source "package/pulseview/Config.in" source "package/qoriq-cadence-dp-firmware/Config.in" + source "package/rasdaemon/Config.in" source "package/raspi-gpio/Config.in" source "package/rdma-core/Config.in" source "package/read-edid/Config.in"
package/rasdaemon/Config.in new file +25 -0
@@ -0,0 +1,25 @@ +config BR2_PACKAGE_RASDAEMON + bool "rasdaemon" + depends on !BR2_STATIC_LIBS # libtraceevent + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_SQLITE + select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL + help + rasdaemon is a tool that collects all hardware error events + reported by the Linux Kernel from several sources (EDAC, MCE + PCI, ...) into one common framework. + See https://github.com/mchehab/rasdaemon for details. + +if BR2_PACKAGE_RASDAEMON + +config BR2_PACKAGE_RASDAEMON_AER + bool "Enable AER support" + select BR2_PACKAGE_PCIUTILS + help + Enable handling of AER (Advanced Error Reporting) events on + PCIe + +endif + +comment "rasdaemon needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS
package/rasdaemon/S95rasdaemon new file +69 -0
69 lines not on this page · raw message
package/rasdaemon/rasdaemon.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a rasdaemon-0.8.4.tar.gz +sha256 39bc367cd7cd291d217447632b28a74be414a52b142b1875ac8789184aeca7b2 COPYING
package/rasdaemon/rasdaemon.mk new file +33 -0
@@ -0,0 +1,33 @@ +################################################################################ +# +# rasdaemon +# +################################################################################ + +RASDAEMON_VERSION = 0.8.4 +RASDAEMON_SITE = $(call github,mchehab,rasdaemon,v$(RASDAEMON_VERSION)) +RASDAEMON_LICENSE = GPL-2.0+ +RASDAEMON_LICENSE_FILES = COPYING +RASDAEMON_AUTORECONF = YES + +RASDAEMON_DEPENDENCIES = libtraceevent sqlite +# rasdaemon uses argp.h which is not provided by uclibc or musl by default. +# Use the argp-standalone package to provide this. +ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y) +RASDAEMON_DEPENDENCIES += argp-standalone +RASDAEMON_CONF_ENV += LIBS="-largp" +endif + +ifeq ($(BR2_PACKAGE_RASDAEMON_AER),y) +RASDAEMON_DEPENDENCIES += pciutils +RASDAEMON_CONF_OPTS += --enable-aer +else +RASDAEMON_CONF_OPTS += --disable-aer +endif + +define RASDAEMON_INSTALL_INIT_SYSV + $(INSTALL) -m 0755 -D package/rasdaemon/S95rasdaemon \ + $(TARGET_DIR)/etc/init.d/S95rasdaemon +endef + +$(eval $(autotools-package))
Signature · 6 lines
2.51.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 1/2] package/rasdaemon: Add rasdaemon package
Hi Bastien!
Am 27.11.25 um 15:14 schrieb Bastien Curutchet:
Quoted 104 lines
Rasdaemon is a tool that aims to replace the edac-tool and provide a way to collect all hardware error events reported by the Linux kernel in a common framework.
Add a new package to support rasdaemon in the 'Hardware handling' section. It depends on libtraceevents to detect the ftrace events generated by the kernel and on sqlite to store these events.
Support for the PCIe AER events is optionnal and implies a dependency on pciutils so also add a dedicated 'sub-option' to enable it.
Add a SYSV init script to start / stop the daemon
Add myself to the DEVELOPERS file.
Signed-off-by Bastien Curutchet <[email protected]>--- DEVELOPERS | 3 ++ package/Config.in | 1 + package/rasdaemon/Config.in | 25 +++++++++++++++ package/rasdaemon/S95rasdaemon | 69 ++++++++++++++++++++++++++++++++++++++++ package/rasdaemon/rasdaemon.hash | 3 ++ package/rasdaemon/rasdaemon.mk | 33 +++++++++++++++++++ 6 files changed, 134 insertions(+)DEVELOPERS +3
-0@@ -341,6 +341,9 @@ F: package/tcpdump/ F: package/ti-uim/ F: package/uhubctl/ +N: Bastien Curutchet <[email protected]> +F: package/rasdaemon/ + N: Baxiche Su <[email protected]> F: package/qt6/qt6multimedia/package/Config.in +1
-0@@ -584,6 +584,7 @@ endmenu source "package/pru-software-support/Config.in" source "package/pulseview/Config.in" source "package/qoriq-cadence-dp-firmware/Config.in" + source "package/rasdaemon/Config.in" source "package/raspi-gpio/Config.in" source "package/rdma-core/Config.in" source "package/read-edid/Config.in"package/rasdaemon/Config.in new file +25
-0@@ -0,0 +1,25 @@ +config BR2_PACKAGE_RASDAEMON + bool "rasdaemon" + depends on !BR2_STATIC_LIBS # libtraceevent + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_SQLITE + select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL + help + rasdaemon is a tool that collects all hardware error events + reported by the Linux Kernel from several sources (EDAC, MCE + PCI, ...) into one common framework. + See https://github.com/mchehab/rasdaemon for details. + +if BR2_PACKAGE_RASDAEMON + +config BR2_PACKAGE_RASDAEMON_AER + bool "Enable AER support" + select BR2_PACKAGE_PCIUTILS + help + Enable handling of AER (Advanced Error Reporting) events on + PCIe + +endif + +comment "rasdaemon needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBSpackage/rasdaemon/S95rasdaemon new file +16
-0@@ -0,0 +1,69 @@ +#!/bin/sh +# +# S95rasdaemon Starts Rasdaemon. +# +# shellcheck disable=SC2317 # functions are called via variable + +DAEMON="rasdaemon" +PIDFILE="/var/run/$DAEMON.pid" + +start() { + printf "Starting %s: " "$DAEMON" + + if ! grep -q debugfs /proc/mounts ; then + echo "FAIL : debugfs is missing" + return 1 + fi
package/rasdaemon/S95rasdaemon line 26
Quoted 10 lines
package/rasdaemon/S95rasdaemon new file +10
-0+ + start-stop-daemon --start --pidfile "$PIDFILE" --make-pidfile \ + --exec "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + # rasdaemon automatically forks itself into background + # so the $PIDFILE created by start-stop-daemon doesn't match + # the final's rasdaemon PID. + pidof "/usr/sbin/$DAEMON" > "$PIDFILE"
For a service that can't create a PID file, please make it run in foreground (no forking) [1] and use start-stop-daemon --background together with --make-pidfile. That way the PID file created by start-stop-daemon will be correct. See the S01syslogd example in the docs, it's doing exactly that. :-)
Creating the PID file using pidof has the same problem as implementing "stop" with "killall": There's no check you're getting the right process (even though it might mostly work, as long as there never is more than one instance running).
[1] At a glance, rasdaemon seems to have an option: https://github.com/mchehab/rasdaemon/blob/2f461caf9613e8dfe87be315dbe083b60560d1e7/man/rasdaemon.1.in#L54-L57
Quoted 33 lines
package/rasdaemon/S95rasdaemon new file +33
-0+ else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf "Stopping %s: " "$DAEMON" + start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + return "$status" + fi + while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \ + --exec "/sbin/$DAEMON"; do + sleep 0.1 + done + rm -f "$PIDFILE" + return "$status" +} + +restart() { + stop + start +} + +reload() { + restart +} +
package/rasdaemon/S95rasdaemon line 69
Quoted 10 lines
package/rasdaemon/S95rasdaemon new file +10
-0+case "$1" in + start|stop|reload|restart) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|reload|restart}" + exit 1 +esac + +exit $?
Not needed, the exit code of the last command in the script automatically becomes the exit code of the script.
Best regards,
Fiona
Quoted 39 lines
package/rasdaemon/rasdaemon.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally calculated +sha256 7e12459f9477036491ac2b1e4c07cc3e8efea6dcd30525a263ab1f83910b773a rasdaemon-0.8.4.tar.gz +sha256 39bc367cd7cd291d217447632b28a74be414a52b142b1875ac8789184aeca7b2 COPYINGpackage/rasdaemon/rasdaemon.mk new file +23
-0@@ -0,0 +1,33 @@ +################################################################################ +# +# rasdaemon +# +################################################################################ + +RASDAEMON_VERSION = 0.8.4 +RASDAEMON_SITE = $(call github,mchehab,rasdaemon,v$(RASDAEMON_VERSION)) +RASDAEMON_LICENSE = GPL-2.0+ +RASDAEMON_LICENSE_FILES = COPYING +RASDAEMON_AUTORECONF = YES + +RASDAEMON_DEPENDENCIES = libtraceevent sqlite +# rasdaemon uses argp.h which is not provided by uclibc or musl by default. +# Use the argp-standalone package to provide this. +ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y) +RASDAEMON_DEPENDENCIES += argp-standalone +RASDAEMON_CONF_ENV += LIBS="-largp" +endif + +ifeq ($(BR2_PACKAGE_RASDAEMON_AER),y) +RASDAEMON_DEPENDENCIES += pciutils +RASDAEMON_CONF_OPTS += --enable-aer
package/rasdaemon/rasdaemon.mk line 33
Quoted 10 lines
package/rasdaemon/rasdaemon.mk new file +10
-0+else +RASDAEMON_CONF_OPTS += --disable-aer +endif + +define RASDAEMON_INSTALL_INIT_SYSV + $(INSTALL) -m 0755 -D package/rasdaemon/S95rasdaemon \ + $(TARGET_DIR)/etc/init.d/S95rasdaemon +endef + +$(eval $(autotools-package))
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 1/2] package/rasdaemon: Add rasdaemon package
Hi Fiona!
Quoted 120 lines · Fiona Klute
Hi Bastien!
Am 27.11.25 um 15:14 schrieb Bastien Curutchet:
Quoted 104 lines
Rasdaemon is a tool that aims to replace the edac-tool and provide a way to collect all hardware error events reported by the Linux kernel in a common framework.
Add a new package to support rasdaemon in the 'Hardware handling' section. It depends on libtraceevents to detect the ftrace events generated by the kernel and on sqlite to store these events.
Support for the PCIe AER events is optionnal and implies a dependency on pciutils so also add a dedicated 'sub-option' to enable it.
Add a SYSV init script to start / stop the daemon
Add myself to the DEVELOPERS file.
Signed-off-by Bastien Curutchet <[email protected]>---
DEVELOPERS | 3 ++ package/Config.in | 1 + package/rasdaemon/Config.in | 25 +++++++++++++++ package/rasdaemon/S95rasdaemon | 69 ++++++++++++++++++++++++++++++
++++++++++
package/rasdaemon/rasdaemon.hash | 3 ++ package/rasdaemon/rasdaemon.mk | 33 +++++++++++++++++++6 files changed, 134 insertions(+)DEVELOPERS +0
-0@@ -341,6 +341,9 @@ F: package/tcpdump/F: package/ti-uim/
F: package/uhubctl/DEVELOPERS +3
-0+N: Bastien Curutchet <[email protected]> +F: package/rasdaemon/ +N: Baxiche Su <[email protected]>
F: package/qt6/qt6multimedia/package/Config.in +0
-0@@ -584,6 +584,7 @@ endmenusource "package/pru-software-support/Config.in" source "package/pulseview/Config.in"
source "package/qoriq-cadence-dp-firmware/Config.in" + source "package/rasdaemon/Config.in"
source "package/raspi-gpio/Config.in" source "package/rdma-core/Config.in"
source "package/read-edid/Config.in"package/rasdaemon/Config.in new file +6
-0@@ -0,0 +1,25 @@ +config BR2_PACKAGE_RASDAEMON + bool "rasdaemon" + depends on !BR2_STATIC_LIBS # libtraceevent + select BR2_PACKAGE_LIBTRACEEVENT + select BR2_PACKAGE_SQLITE + select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC||
BR2_TOOLCHAIN_USES_MUSL
+ help
+ rasdaemon is a tool that collects all hardware error events + reported by the Linux Kernel from several sources (EDAC, MCE + PCI, ...) into one common framework.
+ See https://github.com/mchehab/rasdaemon for details.package/rasdaemon/Config.in new file +14
-0+ +if BR2_PACKAGE_RASDAEMON + +config BR2_PACKAGE_RASDAEMON_AER + bool "Enable AER support" + select BR2_PACKAGE_PCIUTILS + help + Enable handling of AER (Advanced Error Reporting) events on + PCIe + +endif + +comment "rasdaemon needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBSpackage/rasdaemon/S95rasdaemon new file +16
-0@@ -0,0 +1,69 @@ +#!/bin/sh +# +# S95rasdaemon Starts Rasdaemon. +# +# shellcheck disable=SC2317 # functions are called via variable + +DAEMON="rasdaemon" +PIDFILE="/var/run/$DAEMON.pid" + +start() { + printf "Starting %s: " "$DAEMON" + + if ! grep -q debugfs /proc/mounts ; then + echo "FAIL : debugfs is missing" + return 1 + fipackage/rasdaemon/S95rasdaemon line 26
Quoted 10 lines
package/rasdaemon/S95rasdaemon new file +10
-0+ + start-stop-daemon --start --pidfile "$PIDFILE" --make-pidfile \ + --exec "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + # rasdaemon automatically forks itself into background + # so the $PIDFILE created by start-stop-daemon doesn't match + # the final's rasdaemon PID. + pidof "/usr/sbin/$DAEMON" > "$PIDFILE"For a service that can't create a PID file, please make it run in foreground (no forking) [1] and use start-stop-daemon --background together with --make-pidfile. That way the PID file created by start- stop-daemon will be correct. See the S01syslogd example in the docs, it's doing exactly that. :-)
Quoted 2 lines
Creating the PID file using pidof has the same problem as implementing "stop" with "killall": There's no check you're getting the right process (even though it might mostly work, as long as there never is more than one instance running).
Oh right, I hadn't thought about the case with multiple instances running. I'll respin with this fixed.
Quoted 40 lines
[1] At a glance, rasdaemon seems to have an option: https://github.com/ mchehab/rasdaemon/blob/2f461caf9613e8dfe87be315dbe083b60560d1e7/man/ rasdaemon.1.in#L54-L57
Quoted 38 lines
package/rasdaemon/S95rasdaemon new file +9
-0+ else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf "Stopping %s: " "$DAEMON" + start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ return "$status"
+ fi
+ while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
+ --exec "/sbin/$DAEMON"; do
+ sleep 0.1
+ done
+ rm -f "$PIDFILE"
+ return "$status"package/rasdaemon/S95rasdaemon new file +15
-0+} + +restart() { + stop + start +} + +reload() { + restart +} + +case "$1" in + start|stop|reload|restart) + "$1" + ;;
Quoted 9 lines
package/rasdaemon/S95rasdaemon line 69
Quoted 6 lines
+ *)
+ echo "Usage: $0 {start|stop|reload|restart}" + exit 1package/rasdaemon/S95rasdaemon new file +3
-0+esac + +exit $?Not needed, the exit code of the last command in the script automatically becomes the exit code of the script.
Ok, I'll remove it.
Best regards,
Bastien
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 2/2 support/testing: add rasdaemon tests
In reply to Bastien Curutchet via buildrootRasdaemon was added in previous patch.
Add a test_rasdaemon that allows to test it.
Test is done on x86. It first checks the daemon's version, then mounts debugfs and finally ensures that the init script allows to start/restart/stop the daemon.
--- DEVELOPERS | 1 + support/testing/tests/package/test_rasdaemon.py | 46 ++++++++++++++++++++++ .../package/test_rasdaemon/linux-debugfs.fragment | 8 ++++ 3 files changed, 55 insertions(+)
DEVELOPERS +1 -0
@@ -343,6 +343,7 @@ F: package/uhubctl/ N: Bastien Curutchet <[email protected]> F: package/rasdaemon/ +F: support/testing/tests/package/test_rasdaemon.py N: Baxiche Su <[email protected]> F: package/qt6/qt6multimedia/
support/testing/tests/package/test_rasdaemon.py new file +46 -0
46 lines not on this page · raw message
support/testing/tests/package/test_rasdaemon/linux-debugfs.fragment new file +8 -0
@@ -0,0 +1,8 @@ +CONFIG_DEBUG_FS=y +CONFIG_FTRACE=y +CONFIG_USER_EVENTS=y +CONFIG_TRACE_EVENT_INJECT=y +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +CONFIG_MEMORY_FAILURE=y
Signature · 6 lines
2.51.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot