From patchwork Thu Apr 22 10:01:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "vasilii.smirnov--- via Guix-patches\" via" X-Patchwork-Id: 28758 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6839F27BC7C; Thu, 22 Apr 2021 11:03:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3D99B27BC7B for ; Thu, 22 Apr 2021 11:03:14 +0100 (BST) Received: from localhost ([::1]:56634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZWAm-0003Qr-NA for patchwork@mira.cbaines.net; Thu, 22 Apr 2021 06:03:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZW8t-0002mB-79 for guix-patches@gnu.org; Thu, 22 Apr 2021 06:01:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZW8r-0002pz-UG for guix-patches@gnu.org; Thu, 22 Apr 2021 06:01:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lZW8r-0005Cx-T0 for guix-patches@gnu.org; Thu, 22 Apr 2021 06:01:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47905] gnu: Add rasdaemon. Resent-From: elaexuotee@wilsonb.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 22 Apr 2021 10:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Leo Famulari Cc: 47905@debbugs.gnu.org Received: via spool by 47905-submit@debbugs.gnu.org id=B47905.161908565720001 (code B ref 47905); Thu, 22 Apr 2021 10:01:01 +0000 Received: (at 47905) by debbugs.gnu.org; 22 Apr 2021 10:00:57 +0000 Received: from localhost ([127.0.0.1]:32803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZW8e-0005CN-Bu for submit@debbugs.gnu.org; Thu, 22 Apr 2021 06:00:56 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]:19877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZW8W-0005C1-Rt for 47905@debbugs.gnu.org; Thu, 22 Apr 2021 06:00:47 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1619085644; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: From: Subject: Cc: To: Date: Sender; bh=bq+KolXwfbu5btDynqn9x5DVwlc+obGFd5vq3efkii0=; b=48dD+lQi+Kz9L4pTESz13OxDs2vYh0VQwuWo+IMrISYJhxOEL2QqA1aM0L1ZCpvi7epJNyV/ MZZZfrTB20EQLZZIYHQ5hjXotw9Mj49SR5PichSY9539OApTs16DZr7nc3NORBAU4AQJzTg1 hiy+VYGNNsmSvSew03lBa39+jstDulNmJsMK0kG4Ft2nCqcB2JADyEaBT6zMH1lt3us0a+ww CBgWjz5VN91LJ0pXuNeMSWnX2d+a/n4OehLqJGDqWwvuzxPJ4ESbbMXtkVa6jG9YPav8EPp8 wAI6NKCbUbrghvX5ZbsuP06jEg+XBn6z7BlAQi48cRkcuvgzSY90gw== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyI1NGFiNSIsICI0NzkwNUBkZWJidWdzLmdudS5vcmciLCAiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 60814926febcffa80f48f794 (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Thu, 22 Apr 2021 10:00:05 GMT Received: from localhost (x096178.dynamic.ppp.asahi-net.or.jp [122.249.96.178]) by wilsonb.com (Postfix) with ESMTPSA id 1E3D0A328B; Thu, 22 Apr 2021 10:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1619085603; bh=bq+KolXwfbu5btDynqn9x5DVwlc+obGFd5vq3efkii0=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=TbUasbWdvvmXyappGOwQlB0qbeXyrPDYojr0mz3z5ej13pSuea0If8C5RfDi62L13 zbgSA1DfWvpiWrDSZomfQUQlvUQLHG0vDOrKx/Rq+on0JRzgQiwGAAq/wuef7F2qdZ 9CJlBA8Sg3tzyHNcAJ9YcQPp0LCxC0CEVpYeixlvjAWz89Dn6PbGVHUp39TaUr13Vp SWwldO37J+TmfSQo2VeNlsFNIQx8DYdRhiwhG6YZ/d60s7jC5LhJQdDq1/43vNzJAm O7RDvzAJ1w56NvSSeP/8HfDSyLJYnwxLPB5WHPOL3TEh1rRduYjC0ZdIqD+9j7JRv0 aSknZvUE6ECAVz15T/Pxe0SlFVM8/H+m77pl94RBT8r/oLtzDlUWB6qK7TrkbAoBJP zT/C6B6g6itMhKcfQlXTfPvxbYb4NttWvS3x8DZUfx9gCQp85P8S6kr5vCa8A0Z7NP KLh1v6hOkn9MzW37jf9HjgWUvlJGzvlIFx8zRmUo0B/MPQYCh9YNWMiHGFPG4W5wj8 v5tYooVn8AxcjaAZjUpiQTXT3rh2CCKvch9UlseWf30BHNn3o9Cxntt5OQN4SfqUBP +as5PI8gUVdPlPVVq4n5KQQF95BF+iqpXNZ+chNMF2Z4uSaX/hW0DJ+Eiq4dZrHHn2 7/iyWF/YIICW4HQSXy9VZR8U= Date: Thu, 22 Apr 2021 19:01:20 +0900 References: <31MWDEN7Q9XOV.2001N5J6G4U9K@wilsonb.com> <34GOUL165TOWY.3FR9YU3I80NFA@wilsonb.com> In-Reply-To: Message-Id: <377TR65TD6KJY.2JY05ANZ7375P@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: elaexuotee@wilsonb.com X-ACL-Warn: , elaexuotee--- via Guix-patches X-Patchwork-Original-From: elaexuotee--- via Guix-patches via From: "vasilii.smirnov--- via Guix-patches\" via" X-getmail-retrieved-from-mailbox: Patches Leo Famulari 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! From d31cb88e5c34cc0b650ff181ebb6a0d85d045f9d Mon Sep 17 00:00:00 2001 From: "B. Wilson" 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 ;;; Copyright © 2020 David Dashyan ;;; Copyright © 2020 pukkamustard +;;; Copyright © 2021 B. Wilson ;;; ;;; 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 ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2021 raid5atemyhomework +;;; Copyright © 2021 B. Wilson ;;; ;;; 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 '()))) + +;;; +;;; Reliability, Availability, and Serviceability (RAS) daemon +;;; + +(define-record-type* + rasdaemon-configuration make-rasdaemon-configuration + rasdaemon-configuration? + (record? rasdaemon-configuration-record? (default #f))) + +(define (rasdaemon-configuration->command-line-args config) + "Translate 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"))) + ;;; ;;; Kernel module loader. -- 2.31.1