* [bug#47905] gnu: Add rasdaemon. @ 2021-04-20 4:24 elaexuotee--- via Guix-patches via 2021-04-20 5:04 ` Leo Famulari ` (3 more replies) 0 siblings, 4 replies; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-20 4:24 UTC (permalink / raw) To: 47905 [-- Attachment #1: Type: text/plain, Size: 341 bytes --] This is my first patch to gnu/services (and by inclusion doc/guix.texi), so please scrutinize with abandon! I did all the standard sanity checks for the package definition (guix lint, etc/indent-code.el, guix build --check); however, I wasn't sure about the service, so the sanity checks were limited to testing in a vm. Cheers! [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-gnu-Add-rasdaemon.patch --] [-- Type: text/x-patch, Size: 7973 bytes --] From 1d4e60a9578d3572bf1caff11d0b17e4bc8f1ea9 Mon Sep 17 00:00:00 2001 From: "B. Wilson" <elaexuotee@wilsonb.com> Date: Tue, 20 Apr 2021 11:49:26 +0900 Subject: [PATCH] gnu: Add rasdaemon. To: guix-patches@gnu.org * gnu/packages/linux.scm (rasdaemon): New variable. * gnu/services/linux.scm (rasdaemon-configuration) (rasdaemon-configuration?, rasdaemon-configuration-record?) (rasdaemon-service-type): New variables. * doc/guix.texi (Linux Services): Document it. --- doc/guix.texi | 29 +++++++++++++++++++++++++ gnu/packages/linux.scm | 45 ++++++++++++++++++++++++++++++++++++++ gnu/services/linux.scm | 49 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 58bcfbdbb5..73479b8fcf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -88,6 +88,7 @@ Copyright @copyright{} 2020 John Soo@* Copyright @copyright{} 2020 Jonathan Brielmaier@* Copyright @copyright{} 2020 Edgar Vincent@* Copyright @copyright{} 2021 Maxime Devos@* +Copyright @copyright{} 2021 B. Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -31457,6 +31458,34 @@ parameters, can be done as follow: @end lisp @end deffn +@cindex rasdaemon +@cindex Platform Reliability, Availability and Serviceability daemon +@subsubheading Rasdaemon Service + +The Rasdaemon service provides a monitor for Platform Reliability, +Availability, and Serviceability (RAS) events in the Linux kernel. + +@defvr {Scheme Variable} rasdaemon-service-type +Service type for the @command{rasdaemon} service. It accepts a +@code{rasdaemon-configuration} object. Instantiating like + +@lisp +(service rasdaemon-service-type) +@end lisp + +will load with a default configuration. +@end defvr + +@deftp {Data Type} rasdaemon-configuration +The data type representing the configuration of @command{rasdaemon}. + +@table @asis +@item @code{record?} (default: @code{#f}) +A boolean indicating whether to record the events in an SQLite database. The +database location is hard-coded to @file{/var/lib/rasdaemon/ras-mc_event.db}. +@end table +@end deftp + @cindex zram @cindex compressed swap @cindex Compressed RAM-based block devices diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1ea9d80834..fe464bcc8e 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -53,6 +53,7 @@ ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com> ;;; Copyright © 2020 David Dashyan <mail@davie.li> ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,6 +131,7 @@ #:use-module (gnu packages sdl) #:use-module (gnu packages serialization) #:use-module (gnu packages slang) + #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) @@ -8037,3 +8039,46 @@ kernel side implementation.") read-only file system optimized for resource-scarce devices. This package provides user-space tools for creating EROFS file systems.") (license license:gpl2+))) + +(define-public rasdaemon + (package + (name "rasdaemon") + (version "0.6.6") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mchehab/rasdaemon") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "13g39x19lfjf9izdcb0nlyfjrgpliivhv4nw3ndgyzi59l3yqc0v")))) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (inputs `(("sqlite" ,sqlite))) + (arguments + `(#:configure-flags '("--enable-all" + "--localstatedir=/var") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'munge-autotools + (lambda _ + ;; For some reason upstream forces sysconfdir=/etc. This results + ;; in EPERM during the install phase. Removing the offending + ;; line lets sysconfdir correctly pick up DESTDIR. + (substitute* "configure.ac" + (("^test .* sysconfdir=/etc\n$") "")) + ;; Upstream tries to create /var/lib/rasdaemon at install time. + ;; This results in EPERM on guix. Instead, the service should + ;; create this at activation time. + (substitute* "Makefile.am" + (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") ""))))))) + (build-system gnu-build-system) + (home-page "https://github.com/mchehab/rasdaemon") + (synopsis "Platform Reliability, Availability and Serviceability tools") + (description "The @code{rasdaemon} program is a daemon which monitors the +platform Reliablity, Availability and Serviceability (RAS) reports from the +Linux kernel trace events. These trace events are logged in +/sys/kernel/debug/tracing, reporting them via syslog/journald.") + (license license:gpl2+))) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 340b330030..01723efc07 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,11 @@ kernel-module-loader-service-type + rasdaemon-configuration + rasdaemon-configuration? + rasdaemon-configuration-record? + rasdaemon-service-type + zram-device-configuration zram-device-configuration? zram-device-configuration-size @@ -188,6 +194,49 @@ representation." (extend append) (default-value '()))) +\f +;;; +;;; Reliability, Availability, and Servicability (RAS) daemon +;;; + +(define-record-type* <rasdaemon-configuration> + rasdaemon-configuration make-rasdaemon-configuration + rasdaemon-configuration? + (record? rasdaemon-configuration-record? (default #f))) + +(define (rasdaemon-configuration->command-line-args config) + "Translate <rasdaemon-configuration> to its command line arguments + representation" + (let ((record? (rasdaemon-configuration-record? config))) + `(,(file-append rasdaemon "/sbin/rasdaemon") + "--foreground" ,@(if record? '("--record") '())))) + +(define (rasdaemon-activation config) + (let ((record? (rasdaemon-configuration-record? config)) + (rasdaemon-dir "/var/lib/rasdaemon")) + (with-imported-modules '((guix build utils)) + #~(if #$record? (mkdir-p #$rasdaemon-dir))))) + +(define (rasdaemon-shepherd-service config) + (shepherd-service + (documentation "Run rasdaemon") + (provision '(rasdaemon)) + (start #~(make-forkexec-constructor + '#$(rasdaemon-configuration->command-line-args config) + #:log-file "/var/log/rasdaemon.log")) + (stop #~(make-kill-destructor)))) + +(define rasdaemon-service-type + (service-type + (name 'rasdaemon) + (default-value (rasdaemon-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + (compose list rasdaemon-shepherd-service)) + (service-extension activation-service-type rasdaemon-activation))) + (compose concatenate) + (description "Run @command{rasdaemon}, the RAS monitor"))) + \f ;;; ;;; Kernel module loader. -- 2.31.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 4:24 [bug#47905] gnu: Add rasdaemon elaexuotee--- via Guix-patches via @ 2021-04-20 5:04 ` Leo Famulari 2021-04-20 5:07 ` Leo Famulari ` (2 subsequent siblings) 3 siblings, 0 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-20 5:04 UTC (permalink / raw) To: 47905 On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > This is my first patch to gnu/services (and by inclusion doc/guix.texi), so > please scrutinize with abandon! > > I did all the standard sanity checks for the package definition (guix lint, > etc/indent-code.el, guix build --check); however, I wasn't sure about the > service, so the sanity checks were limited to testing in a vm. Thanks for letting us know how you tested it. That's really valuable for reviewers. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 4:24 [bug#47905] gnu: Add rasdaemon elaexuotee--- via Guix-patches via 2021-04-20 5:04 ` Leo Famulari @ 2021-04-20 5:07 ` Leo Famulari 2021-04-20 5:54 ` elaexuotee--- via Guix-patches via 2021-04-20 5:30 ` Leo Famulari 2021-04-20 5:33 ` Leo Famulari 3 siblings, 1 reply; 15+ messages in thread From: Leo Famulari @ 2021-04-20 5:07 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > +(define-public rasdaemon Overall LGTM. > + (license license:gpl2+))) I checked the license headers of the ras-*.c files. Some of them are GPL2+, and some are GPL2 only. I think that we should mark it GPL2 only, based on that. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 5:07 ` Leo Famulari @ 2021-04-20 5:54 ` elaexuotee--- via Guix-patches via 2021-04-20 16:08 ` Leo Famulari 0 siblings, 1 reply; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-20 5:54 UTC (permalink / raw) To: Leo Famulari; +Cc: 47905 Leo Famulari <leo@famulari.name> wrote: > On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > > +(define-public rasdaemon > > Overall LGTM. > > > + (license license:gpl2+))) > > I checked the license headers of the ras-*.c files. > > Some of them are GPL2+, and some are GPL2 only. I think that we should > mark it GPL2 only, based on that. Oh! Thanks. Nice catch. This is not the first time I have missed license details, so I looked for some method to find all licenses in a project: $ licensecheck --recursive --machine . | awk -F$'\t' '{print $2}' | sort -u FSF All Permissive License GNU Lesser General Public License (v2.1) GPL (v2 or later) GPL (v2 or later) (with incorrect FSF address) GPL (v2) UNKNOWN The `FSF All Permissive License' just comes from the INSTALL file. In general, I'm aware that we can include multiple licenses, so the above output would look like: (license `(,license:fsf-free ,license:lgpl2.1 ,license:gpl2 ,license:gpl2+)) However, legally-speaking, was is the correct approach here? ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 5:54 ` elaexuotee--- via Guix-patches via @ 2021-04-20 16:08 ` Leo Famulari 0 siblings, 0 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-20 16:08 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 02:54:49PM +0900, elaexuotee@wilsonb.com wrote: > The `FSF All Permissive License' just comes from the INSTALL file. In general, > I'm aware that we can include multiple licenses, so the above output would look > like: > > (license `(,license:fsf-free ,license:lgpl2.1 ,license:gpl2 ,license:gpl2+)) > > However, legally-speaking, was is the correct approach here? Overall, the program is distributed under the GPL version 2, based on COPYING (whether or not "later versions" are allowed depends on license headers of individual files). Some components may have other licenses, but I'd say the whole thing — the "program" as we use it — is GPL 2. In general, we redistribute the program under a single license, so that is what the license field should say. Maybe if there is some really valuable component that can be used under a different license, we can add a code comment about it. But, I don't think it's helpful to list the licenses of files such as INSTALL, nor is it unusual that they have a different license than the whole. I would refer to this page for more advice about the GPL: https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility I'm not a legal expert, and my understanding is that none of this stuff is really "settled" or "well understood" legally — that would require extensive and repeated litigation, at least in the USA, which has not occurred. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 4:24 [bug#47905] gnu: Add rasdaemon elaexuotee--- via Guix-patches via 2021-04-20 5:04 ` Leo Famulari 2021-04-20 5:07 ` Leo Famulari @ 2021-04-20 5:30 ` Leo Famulari 2021-04-20 6:18 ` elaexuotee--- via Guix-patches via 2021-04-20 5:33 ` Leo Famulari 3 siblings, 1 reply; 15+ messages in thread From: Leo Famulari @ 2021-04-20 5:30 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > * doc/guix.texi (Linux Services): Document it. It could be added to Monitoring Services instead. Although, RAS is Linux-only, so I leave that decision up to you. > +@cindex rasdaemon > +@cindex Platform Reliability, Availability and Serviceability daemon > +@subsubheading Rasdaemon Service > + > +The Rasdaemon service provides a monitor for Platform Reliability, > +Availability, and Serviceability (RAS) events in the Linux kernel. It would be nice to link to some upstream documentation of RAS, as we do for the documentation of the Zram Device Service. I think it could also be improved with addition of one or two sentences about how to make use of the service. As logging appears to be disabled by default, how are users expected to learn of the events monitored by rasdaemon? After writing that, I looked at rasdaemon-shepherd-service and see that it keeps a log file. Is that the same data as the optional SQLite database, but unstructured? Overall, the docs should clarify this :) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 5:30 ` Leo Famulari @ 2021-04-20 6:18 ` elaexuotee--- via Guix-patches via 2021-04-20 16:19 ` Leo Famulari 0 siblings, 1 reply; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-20 6:18 UTC (permalink / raw) To: Leo Famulari; +Cc: 47905 Leo Famulari <leo@famulari.name> wrote: > On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > > * doc/guix.texi (Linux Services): Document it. > > It could be added to Monitoring Services instead. Although, RAS is > Linux-only, so I leave that decision up to you. Hrm. Monitoring Services does make sense. Kind of a tough call. Will give it more thought but probably keep in Linux since anyone wanting this service probably knows exactly what they are looking for. > It would be nice to link to some upstream documentation of RAS, as we do > for the documentation of the Zram Device Service. > > I think it could also be improved with addition of one or two sentences > about how to make use of the service. As logging appears to be disabled > by default, how are users expected to learn of the events monitored by > rasdaemon? > > After writing that, I looked at rasdaemon-shepherd-service and see that > it keeps a log file. Is that the same data as the optional SQLite > database, but unstructured? > > Overall, the docs should clarify this :) Agreed. My documentation was lazy. Will improve. Thanks for the specific pointers. About the sqlite db, I honestly don't know much about how it compares to the logs. From a cursory glance at the code it looks basically like what you said, a structured rendering of the logs. Will make some kind of note about this. Speaking of, the log output looks like "rasdaemon: <message>", so it's probably just as good to put this in the syslog rather than a dedicated file. How can one do that? ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 6:18 ` elaexuotee--- via Guix-patches via @ 2021-04-20 16:19 ` Leo Famulari 0 siblings, 0 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-20 16:19 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 03:18:19PM +0900, elaexuotee@wilsonb.com wrote: > Speaking of, the log output looks like "rasdaemon: <message>", so it's probably > just as good to put this in the syslog rather than a dedicated file. How can > one do that? I poked around in the existing services, and it seems that the service daemons themselves have the ability to log to syslog, based upon their own configuration. For example, the OpenSSH service 'requires' syslogd, but only in terms of making sure that syslogd is running before sshd starts. I don't see any extension of the syslog service. (I could be wrong — services are my weak point) So, I guess that rasdaemon needs to learn how to find and use syslog, if it hasn't yet. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 4:24 [bug#47905] gnu: Add rasdaemon elaexuotee--- via Guix-patches via ` (2 preceding siblings ...) 2021-04-20 5:30 ` Leo Famulari @ 2021-04-20 5:33 ` Leo Famulari 2021-04-20 6:23 ` elaexuotee--- via Guix-patches via 2021-04-20 7:10 ` elaexuotee--- via Guix-patches via 3 siblings, 2 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-20 5:33 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > +;;; > +;;; Reliability, Availability, and Servicability (RAS) daemon Typo -------------------------------> Serviceability Otherwise, this LGTM. I'm no expert on Guix services but this one seems simple and straightforward. You mentioned that you tested in a VM. What should I look for in the VM to verify that the service is working? ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 5:33 ` Leo Famulari @ 2021-04-20 6:23 ` elaexuotee--- via Guix-patches via 2021-04-20 16:20 ` Leo Famulari 2021-04-20 7:10 ` elaexuotee--- via Guix-patches via 1 sibling, 1 reply; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-20 6:23 UTC (permalink / raw) To: Leo Famulari; +Cc: 47905 Leo Famulari <leo@famulari.name> wrote: > On Tue, Apr 20, 2021 at 01:24:37PM +0900, elaexuotee--- via Guix-patches via wrote: > > +;;; > > +;;; Reliability, Availability, and Servicability (RAS) daemon > > Typo -------------------------------> Serviceability > > Otherwise, this LGTM. I'm no expert on Guix services but this one seems > simple and straightforward. > > You mentioned that you tested in a VM. What should I look for in the VM > to verify that the service is working? Ah, good catch. Just check that the daemon is running and log/database files exist. For a non-broken system, the sqlite database will just contain a few empty tables and the logs will just notify you that the various monitors are active: $ herd status rasdaemon $ pgrep -a rasdaemon $ cat /var/log/rasdaemon $ sqlite3 /var/lib/rasdaemon/ras-mc_event.db I honestly don't know a lot about RAS, yet, so that's the extent of what I can easily probe. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 6:23 ` elaexuotee--- via Guix-patches via @ 2021-04-20 16:20 ` Leo Famulari 0 siblings, 0 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-20 16:20 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 03:23:14PM +0900, elaexuotee@wilsonb.com wrote: > Just check that the daemon is running and log/database files exist. For a > non-broken system, the sqlite database will just contain a few empty tables and > the logs will just notify you that the various monitors are active: > > $ herd status rasdaemon > $ pgrep -a rasdaemon > $ cat /var/log/rasdaemon > $ sqlite3 /var/lib/rasdaemon/ras-mc_event.db > > I honestly don't know a lot about RAS, yet, so that's the extent of what I can > easily probe. Thanks, I'll try it out. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 5:33 ` Leo Famulari 2021-04-20 6:23 ` elaexuotee--- via Guix-patches via @ 2021-04-20 7:10 ` elaexuotee--- via Guix-patches via 2021-04-20 16:23 ` Leo Famulari 1 sibling, 1 reply; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-20 7:10 UTC (permalink / raw) To: Leo Famulari; +Cc: 47905 [-- Attachment #1: Type: text/plain, Size: 298 bytes --] This patch updates the license field to contain lgpl2.1, gpl2, and gpl2+. I also added a lot to the docs. Upstream docs are pretty sparse, so I mostly just pilfered from the Linux kernel admin-guide explanation of RAS. At the end of the explanation, I include a URL to that guide directly. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-gnu-Add-rasdaemon.patch --] [-- Type: text/x-patch, Size: 10059 bytes --] From dc8bdf692d3802f87aa5b13a244771e1707c1a1a Mon Sep 17 00:00:00 2001 From: "B. Wilson" <elaexuotee@wilsonb.com> Date: Tue, 20 Apr 2021 11:49:26 +0900 Subject: [PATCH] gnu: Add rasdaemon. To: guix-patches@gnu.org * gnu/packages/linux.scm (rasdaemon): New variable. * gnu/services/linux.scm (rasdaemon-configuration) (rasdaemon-configuration?, rasdaemon-configuration-record?) (rasdaemon-service-type): New variables. * doc/guix.texi (Linux Services): Document it. --- doc/guix.texi | 81 ++++++++++++++++++++++++++++++++++++++++++ gnu/packages/linux.scm | 45 +++++++++++++++++++++++ gnu/services/linux.scm | 49 +++++++++++++++++++++++++ 3 files changed, 175 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 58bcfbdbb5..a80ad02223 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -88,6 +88,7 @@ Copyright @copyright{} 2020 John Soo@* Copyright @copyright{} 2020 Jonathan Brielmaier@* Copyright @copyright{} 2020 Edgar Vincent@* Copyright @copyright{} 2021 Maxime Devos@* +Copyright @copyright{} 2021 B. Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -31457,6 +31458,86 @@ parameters, can be done as follow: @end lisp @end deffn +@cindex rasdaemon +@cindex Platform Reliability, Availability and Serviceability daemon +@subsubheading Rasdaemon Service + +The Rasdaemon service provides a daemon which monitors the platform Reliablity, +Availability and Serviceability (RAS) reports from the Linux kernel trace +events, logging them in @file{/var/log/rasdaemon.log}. + +Reliability, Availability and Serviceability is a concept used on servers meant +to measure their robustness. + +@strong{Relability} is the probability that a system will produce correct +outputs: + +@itemize @bullet +@item Generally measured as Mean Time Between Failures (MTBF), and +@item Enhanced by features that help to avoid, detect and repair hardware. +faults +@end itemize + +@strong{Availability} is the probability that a system is operational at a +given time: + +@itemize @bullet +@item Generally measured as a percentage of downtime per a period of time, and +@item Often uses mechanisms to detect and correct hardware faults in runtime. +@end itemize + +@strong{Serviceability} is the simplicity and speed with which a system can be +repaired or maintained: + +@itemize @bullet +@item Generally measured on Mean Time Between Repair (MTBR). +@end itemize + + +Among the monitoring measures, the most usual ones include: + +@itemize @bullet +@item CPU – detect errors at instruction execution and at L1/L2/L3 caches; +@item Memory – add error correction logic (ECC) to detect and correct errors; +@item I/O – add CRC checksums for transferred data; +@item Storage – RAID, journal file systems, checksums, Self-Monitoring, +Analysis and Reporting Technology (SMART). +@end itemize + +By monitoring the number of occurrences of error detections, it is possible to +identify if the probability of hardware errors is increasing, and, on such +case, do a preventive maintenance to replace a degraded component while those +errors are correctable. + +For detailed information about the types of error events gathered and how to +make sense of them, see the kernel administrator's guide at +@url{https://www.kernel.org/doc/html/latest/admin-guide/ras.html}. + +@defvr {Scheme Variable} rasdaemon-service-type +Service type for the @command{rasdaemon} service. It accepts a +@code{rasdaemon-configuration} object. Instantiating like + +@lisp +(service rasdaemon-service-type) +@end lisp + +will load with a default configuration, which monitors all events and logs to +@file{/var/log/rasdaemon.log}. +@end defvr + +@deftp {Data Type} rasdaemon-configuration +The data type representing the configuration of @command{rasdaemon}. + +@table @asis +@item @code{record?} (default: @code{#f}) + +A boolean indicating whether to record the events in an SQLite database. This +provides a more structured access to the information contained in the log file. +The database location is hard-coded to @file{/var/lib/rasdaemon/ras-mc_event.db}. + +@end table +@end deftp + @cindex zram @cindex compressed swap @cindex Compressed RAM-based block devices diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1ea9d80834..0384ae03df 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -53,6 +53,7 @@ ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com> ;;; Copyright © 2020 David Dashyan <mail@davie.li> ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,6 +131,7 @@ #:use-module (gnu packages sdl) #:use-module (gnu packages serialization) #:use-module (gnu packages slang) + #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) @@ -8037,3 +8039,46 @@ kernel side implementation.") read-only file system optimized for resource-scarce devices. This package provides user-space tools for creating EROFS file systems.") (license license:gpl2+))) + +(define-public rasdaemon + (package + (name "rasdaemon") + (version "0.6.6") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mchehab/rasdaemon") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "13g39x19lfjf9izdcb0nlyfjrgpliivhv4nw3ndgyzi59l3yqc0v")))) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (inputs `(("sqlite" ,sqlite))) + (arguments + `(#:configure-flags '("--enable-all" + "--localstatedir=/var") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'munge-autotools + (lambda _ + ;; For some reason upstream forces sysconfdir=/etc. This results + ;; in EPERM during the install phase. Removing the offending + ;; line lets sysconfdir correctly pick up DESTDIR. + (substitute* "configure.ac" + (("^test .* sysconfdir=/etc\n$") "")) + ;; Upstream tries to create /var/lib/rasdaemon at install time. + ;; This results in EPERM on guix. Instead, the service should + ;; create this at activation time. + (substitute* "Makefile.am" + (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") ""))))))) + (build-system gnu-build-system) + (home-page "https://github.com/mchehab/rasdaemon") + (synopsis "Platform Reliability, Availability and Serviceability tools") + (description "The @code{rasdaemon} program is a daemon which monitors the +platform Reliablity, Availability and Serviceability (RAS) reports from the +Linux kernel trace events. These trace events are logged in +/sys/kernel/debug/tracing, reporting them via syslog/journald.") + (license (list license:gpl2 license:gpl2+ license:lgpl2.1)))) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 340b330030..5ecc9bdf25 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,11 @@ kernel-module-loader-service-type + rasdaemon-configuration + rasdaemon-configuration? + rasdaemon-configuration-record? + rasdaemon-service-type + zram-device-configuration zram-device-configuration? zram-device-configuration-size @@ -188,6 +194,49 @@ representation." (extend append) (default-value '()))) +\f +;;; +;;; Reliability, Availability, and Serviceability (RAS) daemon +;;; + +(define-record-type* <rasdaemon-configuration> + rasdaemon-configuration make-rasdaemon-configuration + rasdaemon-configuration? + (record? rasdaemon-configuration-record? (default #f))) + +(define (rasdaemon-configuration->command-line-args config) + "Translate <rasdaemon-configuration> to its command line arguments + representation" + (let ((record? (rasdaemon-configuration-record? config))) + `(,(file-append rasdaemon "/sbin/rasdaemon") + "--foreground" ,@(if record? '("--record") '())))) + +(define (rasdaemon-activation config) + (let ((record? (rasdaemon-configuration-record? config)) + (rasdaemon-dir "/var/lib/rasdaemon")) + (with-imported-modules '((guix build utils)) + #~(if #$record? (mkdir-p #$rasdaemon-dir))))) + +(define (rasdaemon-shepherd-service config) + (shepherd-service + (documentation "Run rasdaemon") + (provision '(rasdaemon)) + (start #~(make-forkexec-constructor + '#$(rasdaemon-configuration->command-line-args config) + #:log-file "/var/log/rasdaemon.log")) + (stop #~(make-kill-destructor)))) + +(define rasdaemon-service-type + (service-type + (name 'rasdaemon) + (default-value (rasdaemon-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + (compose list rasdaemon-shepherd-service)) + (service-extension activation-service-type rasdaemon-activation))) + (compose concatenate) + (description "Run @command{rasdaemon}, the RAS monitor"))) + \f ;;; ;;; Kernel module loader. -- 2.31.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 7:10 ` elaexuotee--- via Guix-patches via @ 2021-04-20 16:23 ` Leo Famulari 2021-04-22 10:01 ` elaexuotee--- via Guix-patches via 0 siblings, 1 reply; 15+ messages in thread From: Leo Famulari @ 2021-04-20 16:23 UTC (permalink / raw) To: elaexuotee; +Cc: 47905 On Tue, Apr 20, 2021 at 04:10:54PM +0900, elaexuotee@wilsonb.com wrote: > This patch updates the license field to contain lgpl2.1, gpl2, and gpl2+. As mentioned in a previous reply, it should contain only gpl2 [0], unless upstream has explicitly given us a license to distribute rasdaemon under the other licenses. [0] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47905#35 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#47905] gnu: Add rasdaemon. 2021-04-20 16:23 ` Leo Famulari @ 2021-04-22 10:01 ` elaexuotee--- via Guix-patches via 2021-04-24 16:33 ` bug#47905: " Leo Famulari 0 siblings, 1 reply; 15+ messages in thread From: elaexuotee--- via Guix-patches via @ 2021-04-22 10:01 UTC (permalink / raw) To: Leo Famulari; +Cc: 47905 [-- Attachment #1: Type: text/plain, Size: 795 bytes --] Leo Famulari <leo@famulari.name> wrote: > On Tue, Apr 20, 2021 at 04:10:54PM +0900, elaexuotee@wilsonb.com wrote: > > This patch updates the license field to contain lgpl2.1, gpl2, and gpl2+. > > As mentioned in a previous reply, it should contain only gpl2 [0], unless > upstream has explicitly given us a license to distribute rasdaemon under > the other licenses. > > [0] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47905#35 Fixed! Thanks for holding my hand on this. That above link cleared up a lot of lingering questions I had. Anyway, in addition to the license fix, I also noticed that the daemon automatically logs to syslogd, so I stripped out /var/log/rasdaemon.log, including the references in the documentation. Let me know what you think. Cheers! [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-gnu-Add-rasdaemon.patch --] [-- Type: text/x-patch, Size: 9957 bytes --] From d31cb88e5c34cc0b650ff181ebb6a0d85d045f9d Mon Sep 17 00:00:00 2001 From: "B. Wilson" <elaexuotee@wilsonb.com> Date: Tue, 20 Apr 2021 11:49:26 +0900 Subject: [PATCH] gnu: Add rasdaemon. To: guix-patches@gnu.org * gnu/packages/linux.scm (rasdaemon): New variable. * gnu/services/linux.scm (rasdaemon-configuration) (rasdaemon-configuration?, rasdaemon-configuration-record?) (rasdaemon-service-type): New variables. * doc/guix.texi (Linux Services): Document it. --- doc/guix.texi | 81 ++++++++++++++++++++++++++++++++++++++++++ gnu/packages/linux.scm | 45 +++++++++++++++++++++++ gnu/services/linux.scm | 49 +++++++++++++++++++++++++ 3 files changed, 175 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 58bcfbdbb5..72be2a1367 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -88,6 +88,7 @@ Copyright @copyright{} 2020 John Soo@* Copyright @copyright{} 2020 Jonathan Brielmaier@* Copyright @copyright{} 2020 Edgar Vincent@* Copyright @copyright{} 2021 Maxime Devos@* +Copyright @copyright{} 2021 B. Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -31457,6 +31458,86 @@ parameters, can be done as follow: @end lisp @end deffn +@cindex rasdaemon +@cindex Platform Reliability, Availability and Serviceability daemon +@subsubheading Rasdaemon Service + +The Rasdaemon service provides a daemon which monitors the platform Reliablity, +Availability and Serviceability (RAS) reports from the Linux kernel trace +events, logging them to syslogd. + +Reliability, Availability and Serviceability is a concept used on servers meant +to measure their robustness. + +@strong{Relability} is the probability that a system will produce correct +outputs: + +@itemize @bullet +@item Generally measured as Mean Time Between Failures (MTBF), and +@item Enhanced by features that help to avoid, detect and repair hardware. +faults +@end itemize + +@strong{Availability} is the probability that a system is operational at a +given time: + +@itemize @bullet +@item Generally measured as a percentage of downtime per a period of time, and +@item Often uses mechanisms to detect and correct hardware faults in runtime. +@end itemize + +@strong{Serviceability} is the simplicity and speed with which a system can be +repaired or maintained: + +@itemize @bullet +@item Generally measured on Mean Time Between Repair (MTBR). +@end itemize + + +Among the monitoring measures, the most usual ones include: + +@itemize @bullet +@item CPU – detect errors at instruction execution and at L1/L2/L3 caches; +@item Memory – add error correction logic (ECC) to detect and correct errors; +@item I/O – add CRC checksums for transferred data; +@item Storage – RAID, journal file systems, checksums, Self-Monitoring, +Analysis and Reporting Technology (SMART). +@end itemize + +By monitoring the number of occurrences of error detections, it is possible to +identify if the probability of hardware errors is increasing, and, on such +case, do a preventive maintenance to replace a degraded component while those +errors are correctable. + +For detailed information about the types of error events gathered and how to +make sense of them, see the kernel administrator's guide at +@url{https://www.kernel.org/doc/html/latest/admin-guide/ras.html}. + +@defvr {Scheme Variable} rasdaemon-service-type +Service type for the @command{rasdaemon} service. It accepts a +@code{rasdaemon-configuration} object. Instantiating like + +@lisp +(service rasdaemon-service-type) +@end lisp + +will load with a default configuration, which monitors all events and logs to +syslogd. +@end defvr + +@deftp {Data Type} rasdaemon-configuration +The data type representing the configuration of @command{rasdaemon}. + +@table @asis +@item @code{record?} (default: @code{#f}) + +A boolean indicating whether to record the events in an SQLite database. This +provides a more structured access to the information contained in the log file. +The database location is hard-coded to @file{/var/lib/rasdaemon/ras-mc_event.db}. + +@end table +@end deftp + @cindex zram @cindex compressed swap @cindex Compressed RAM-based block devices diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1ea9d80834..3685debb38 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -53,6 +53,7 @@ ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com> ;;; Copyright © 2020 David Dashyan <mail@davie.li> ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,6 +131,7 @@ #:use-module (gnu packages sdl) #:use-module (gnu packages serialization) #:use-module (gnu packages slang) + #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) @@ -8037,3 +8039,46 @@ kernel side implementation.") read-only file system optimized for resource-scarce devices. This package provides user-space tools for creating EROFS file systems.") (license license:gpl2+))) + +(define-public rasdaemon + (package + (name "rasdaemon") + (version "0.6.6") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mchehab/rasdaemon") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "13g39x19lfjf9izdcb0nlyfjrgpliivhv4nw3ndgyzi59l3yqc0v")))) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (inputs `(("sqlite" ,sqlite))) + (arguments + `(#:configure-flags '("--enable-all" + "--localstatedir=/var") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'munge-autotools + (lambda _ + ;; For some reason upstream forces sysconfdir=/etc. This results + ;; in EPERM during the install phase. Removing the offending + ;; line lets sysconfdir correctly pick up DESTDIR. + (substitute* "configure.ac" + (("^test .* sysconfdir=/etc\n$") "")) + ;; Upstream tries to create /var/lib/rasdaemon at install time. + ;; This results in EPERM on guix. Instead, the service should + ;; create this at activation time. + (substitute* "Makefile.am" + (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") ""))))))) + (build-system gnu-build-system) + (home-page "https://github.com/mchehab/rasdaemon") + (synopsis "Platform Reliability, Availability and Serviceability tools") + (description "The @code{rasdaemon} program is a daemon which monitors the +platform Reliablity, Availability and Serviceability (RAS) reports from the +Linux kernel trace events. These trace events are logged in +/sys/kernel/debug/tracing, reporting them via syslog/journald.") + (license license:gpl2))) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 340b330030..2eb02ac5a3 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> +;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,11 @@ kernel-module-loader-service-type + rasdaemon-configuration + rasdaemon-configuration? + rasdaemon-configuration-record? + rasdaemon-service-type + zram-device-configuration zram-device-configuration? zram-device-configuration-size @@ -188,6 +194,49 @@ representation." (extend append) (default-value '()))) +\f +;;; +;;; Reliability, Availability, and Serviceability (RAS) daemon +;;; + +(define-record-type* <rasdaemon-configuration> + rasdaemon-configuration make-rasdaemon-configuration + rasdaemon-configuration? + (record? rasdaemon-configuration-record? (default #f))) + +(define (rasdaemon-configuration->command-line-args config) + "Translate <rasdaemon-configuration> to its command line arguments + representation" + (let ((record? (rasdaemon-configuration-record? config))) + `(,(file-append rasdaemon "/sbin/rasdaemon") + "--foreground" ,@(if record? '("--record") '())))) + +(define (rasdaemon-activation config) + (let ((record? (rasdaemon-configuration-record? config)) + (rasdaemon-dir "/var/lib/rasdaemon")) + (with-imported-modules '((guix build utils)) + #~(if #$record? (mkdir-p #$rasdaemon-dir))))) + +(define (rasdaemon-shepherd-service config) + (shepherd-service + (documentation "Run rasdaemon") + (provision '(rasdaemon)) + (requirement '(syslogd)) + (start #~(make-forkexec-constructor + '#$(rasdaemon-configuration->command-line-args config))) + (stop #~(make-kill-destructor)))) + +(define rasdaemon-service-type + (service-type + (name 'rasdaemon) + (default-value (rasdaemon-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + (compose list rasdaemon-shepherd-service)) + (service-extension activation-service-type rasdaemon-activation))) + (compose concatenate) + (description "Run @command{rasdaemon}, the RAS monitor"))) + \f ;;; ;;; Kernel module loader. -- 2.31.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#47905: gnu: Add rasdaemon. 2021-04-22 10:01 ` elaexuotee--- via Guix-patches via @ 2021-04-24 16:33 ` Leo Famulari 0 siblings, 0 replies; 15+ messages in thread From: Leo Famulari @ 2021-04-24 16:33 UTC (permalink / raw) To: elaexuotee; +Cc: 47905-done [-- Attachment #1: Type: text/plain, Size: 1385 bytes --] On Thu, Apr 22, 2021 at 07:01:20PM +0900, elaexuotee@wilsonb.com wrote: > Fixed! Thanks for holding my hand on this. That above link cleared up a lot > of lingering questions I had. You're welcome! My goal is help contributors keep learning until they are sending patches that pass code review on the first try, and they feel confident to start reviewing patches, too. Based on this submission, I think you are more than knowledgeable enough to review some patches :) > Let me know what you think. > From d31cb88e5c34cc0b650ff181ebb6a0d85d045f9d Mon Sep 17 00:00:00 2001 > From: "B. Wilson" <elaexuotee@wilsonb.com> > Date: Tue, 20 Apr 2021 11:49:26 +0900 > Subject: [PATCH] gnu: Add rasdaemon. > To: guix-patches@gnu.org > > * gnu/packages/linux.scm (rasdaemon): New variable. > * gnu/services/linux.scm (rasdaemon-configuration) > (rasdaemon-configuration?, rasdaemon-configuration-record?) > (rasdaemon-service-type): New variables. > * doc/guix.texi (Linux Services): Document it. It's good! I pushed as 2c93df3d11bf8ceeb5c203416a2533cf32275e1a after splitting it into two commits: one for the package, and one for the service and its documentation. By the way, you might ask upstream about fixing the issues in their build scripts — the ones you fixed in the 'munge-autotools' phase. I think most distros will need to do similar fixes. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-04-24 16:35 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-20 4:24 [bug#47905] gnu: Add rasdaemon elaexuotee--- via Guix-patches via 2021-04-20 5:04 ` Leo Famulari 2021-04-20 5:07 ` Leo Famulari 2021-04-20 5:54 ` elaexuotee--- via Guix-patches via 2021-04-20 16:08 ` Leo Famulari 2021-04-20 5:30 ` Leo Famulari 2021-04-20 6:18 ` elaexuotee--- via Guix-patches via 2021-04-20 16:19 ` Leo Famulari 2021-04-20 5:33 ` Leo Famulari 2021-04-20 6:23 ` elaexuotee--- via Guix-patches via 2021-04-20 16:20 ` Leo Famulari 2021-04-20 7:10 ` elaexuotee--- via Guix-patches via 2021-04-20 16:23 ` Leo Famulari 2021-04-22 10:01 ` elaexuotee--- via Guix-patches via 2021-04-24 16:33 ` bug#47905: " Leo Famulari
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.