From patchwork Tue Apr 20 04:24:37 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: 28687 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 962A527BC77; Tue, 20 Apr 2021 05:24:13 +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 14E4D27BC6C for ; Tue, 20 Apr 2021 05:24:10 +0100 (BST) Received: from localhost ([::1]:52162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYhvl-0000pw-7L for patchwork@mira.cbaines.net; Tue, 20 Apr 2021 00:24:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYhve-0000pQ-5P for guix-patches@gnu.org; Tue, 20 Apr 2021 00:24:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYhvd-0007j4-Tl for guix-patches@gnu.org; Tue, 20 Apr 2021 00:24:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYhvd-0003iQ-Pd for guix-patches@gnu.org; Tue, 20 Apr 2021 00:24: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: Tue, 20 Apr 2021 04:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 47905@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161889263214265 (code B ref -1); Tue, 20 Apr 2021 04:24:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Apr 2021 04:23:52 +0000 Received: from localhost ([127.0.0.1]:52543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYhvL-0003hs-KP for submit@debbugs.gnu.org; Tue, 20 Apr 2021 00:23:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:53764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYhvG-0003hh-7l for submit@debbugs.gnu.org; Tue, 20 Apr 2021 00:23:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYhvG-0000pE-2I for guix-patches@gnu.org; Tue, 20 Apr 2021 00:23:38 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]:46441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYhvC-0007PP-6s for guix-patches@gnu.org; Tue, 20 Apr 2021 00:23:37 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1618892613; h=Content-Type: MIME-Version: Message-Id: Subject: From: To: Date: Sender; bh=RmOwPdUBoD5sgtplAKQj75li8AAfYbC0WD3JUSbhHdk=; b=BZtH9Fwy/DOrL5FQANrelJaSOCmFHyEhrcs4/78qbXJEJqnniGHlW72Z36nPj/I/1PIrwBCt 9oDW6u5hhoQP700KwihFtU4NuVOgRPer6TWh49Z6dtH7xYSY/GDGQxntQ3BoAGbsdWFDoCQZ 6b25a/2rk7zYgbBL5tbUdzAlkTL/StXUx1uNKocJr+2iBgkcPHOOxOgMPUhBwC0WEIdgcgxO hhYNH3A72wXRbutZi4Vdzk3e5n++MfHytjESAiQh8tA1Q6AGy7RJ+P4BCQOzedZaUekUfpHa Tctf3h3nbOaa+3PiO7ylSGNjN0XtN+OXjuHrwva1HU/TuS/No10WuQ== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyI5MmEzMyIsICJndWl4LXBhdGNoZXNAZ251Lm9yZyIsICIwODU0N2EiXQ== Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 607e574387ce1fbb56ccb9ec (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Tue, 20 Apr 2021 04:23:31 GMT Received: from localhost (x108155.dynamic.ppp.asahi-net.or.jp [122.249.108.155]) by wilsonb.com (Postfix) with ESMTPSA id 970E4A3269 for ; Tue, 20 Apr 2021 04:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1618892609; bh=RmOwPdUBoD5sgtplAKQj75li8AAfYbC0WD3JUSbhHdk=; h=Date:To:From:Subject:From; b=4QTIfG0rhnjXmRTeP7LKbWQWRssIwzpDLcKtKc8MGk7wEtBU68y6rFHuuShhnwwij fqfQ7b4epvSGMuUanyBCYS4iN3g/w/M5XxYj808OGNOO6nv707r16l+BcBkaPf5uaX XwO3jmQWN7nkDye1fiqcJXMCkkfitzZik2+0v4EKU/zMjuVaviIRNExmECOV5g8VBA tYuGMRHyF1LAsxulC6e8HV6kmJ/Do1XWwVjdeoICwSR3M2oSvmCuU3XY8PXkOa7qM6 3uk6pL2Ck7XUt06cVNl3x+sCtGEXSttajjVJoM3et7V5Xun1Ik6aRmkoOB1Fkli63P PSiIY0LsefSsHd3+5KrcIFH0Au+2ZjqPAND7hHWepfZZKwbCVb5IvExn/hN2VLrc8q LV+3CBJiGwaFQ8+cdq16jsIEUb6gDEPaGiuVnoDgi+3aZVS/fIgkFYP8dwSsR+E+jC o77JnxSpxuDXU+gSAJM5ba4ntJUHuWY7pmibdONHZnb6iEjjOVWNZBs/mnggIHaLwJ +DIw9pM/CMfn9zqB47qwn0RSE2FrGRPo5M3uLYEx7p/btUhG6M0o6imCF0a5oNHllp G6x3c8NLo/X+Pf/FrP4QBaRLzawlgh/4aQ+z2xL+ss9jzkSSIjMceEX1+B8aATbwQ3 yQ9SuvufQmiZBbTGXeyCawPE= Date: Tue, 20 Apr 2021 13:24:37 +0900 Message-Id: <31MWDEN7Q9XOV.2001N5J6G4U9K@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Received-SPF: pass client-ip=69.72.42.5; envelope-from=bounce+686de0.08547a-guix-patches=gnu.org@mg.wilsonb.com; helo=m42-5.mailgun.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 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! From 1d4e60a9578d3572bf1caff11d0b17e4bc8f1ea9 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 | 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 ;;; 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..01723efc07 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 Servicability (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)) + (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"))) + ;;; ;;; Kernel module loader. -- 2.31.1