From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id wMnCMMYjL2axmAAA62LTzQ:P1 (envelope-from ) for ; Mon, 29 Apr 2024 06:36:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id wMnCMMYjL2axmAAA62LTzQ (envelope-from ) for ; Mon, 29 Apr 2024 06:36:22 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=T6Kv2nA0; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714365382; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=j5FzwphsdUTcPH+xFgY3VTDHsFIK4MnIelP+Ah36JG0=; b=st9qAp0lzV0eJPIz6lrSCE/5DZqgluW94Lf/JDcrnLfFctlqslMCfbmcP4qLOCt39mzxDo MHRv7yQlW9Hhhob6tWnobTznjXdsmshOuBkSjGv8d6ivWCjZltjB861dIa9+lHf7MzFgDB T/RWg6yeHQr3zXInX3lfxn+R1hO9nT0FqRrPRFQmCpFX8cZzHwITek0wZFI3Sd3ZE6xPmT MQSlHIz14y4RhmcgIHpnUqHKoE3srX4SEXd7p6rl0RZ5MuLM3QA/WuxmpNGHa0SO7mYLGm 1RW695sv3hRqDin23VbtiVJ1fQkUhesmevu8QPLtUPo+KXm+/HVwf7DF2HpSWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=T6Kv2nA0; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714365382; a=rsa-sha256; cv=none; b=IE391mAYl1xLqdsYD1QjNGfjLxZB+Ygw8x0CLRGKtRZHu+pPrhgii7t/mGXHrLSb3/7f4W m8Y16dJTfIx2AvMdQeeO2xVE2oVuZAvs2WyvL5d6hqeBJkQiUzfuUh/36sn3EAkrS3HOZV 1QBEiU6P2bTap2aqDZ/8ft+4mhvix54c/BPoUK9sFB/WNulkvbOf+nbulkqWe0bAy2NtsB sVXjI92OaOQ2OJnS6/htEynO0r+++hHKOWnTuzcgnWnhoG42ncrYHP2g1AAeQ3yWn2MKNd 5vQV9RGBTegCT77whX/AcW58kdgbu9Y+oGq+f/hDreE1/f5/ywTQtAW/ecfC9A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 805E2C12C for ; Mon, 29 Apr 2024 06:36:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1IkO-0002ms-Sm; Mon, 29 Apr 2024 00:36:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1Ijw-0002hE-8w for guix-patches@gnu.org; Mon, 29 Apr 2024 00:35:47 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Iju-0006R0-FK for guix-patches@gnu.org; Mon, 29 Apr 2024 00:35:44 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s1IkD-0001Vz-OD for guix-patches@gnu.org; Mon, 29 Apr 2024 00:36:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70636] [PATCH v2] services: admin: Support rebooting after an unattended upgrade References: <4852ee6c60830311f4f1f06a43af9b471e91ad88.1714339967.git.richard@freakingpenguin.com> In-Reply-To: <4852ee6c60830311f4f1f06a43af9b471e91ad88.1714339967.git.richard@freakingpenguin.com> Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 29 Apr 2024 04:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70636 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70636@debbugs.gnu.org Cc: Richard Sent Received: via spool by 70636-submit@debbugs.gnu.org id=B70636.17143653425817 (code B ref 70636); Mon, 29 Apr 2024 04:36:01 +0000 Received: (at 70636) by debbugs.gnu.org; 29 Apr 2024 04:35:42 +0000 Received: from localhost ([127.0.0.1]:54777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1Iju-0001Vl-1L for submit@debbugs.gnu.org; Mon, 29 Apr 2024 00:35:42 -0400 Received: from mail-108-mta26.mxroute.com ([136.175.108.26]:35283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1Ijr-0001Vc-8k for 70636@debbugs.gnu.org; Mon, 29 Apr 2024 00:35:40 -0400 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta26.mxroute.com (ZoneMTA) with ESMTPSA id 18f2822c0710008ca2.001 for <70636@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 29 Apr 2024 04:35:17 +0000 X-Zone-Loop: 4bf38bc1e917ece841b377cbea9ec4835d22e6fea439 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j5FzwphsdUTcPH+xFgY3VTDHsFIK4MnIelP+Ah36JG0=; b=T6Kv2nA0lKb7vxR5CWb51R0H4s ZN4mX+rIRMS9ZzhBPTbjmYSNrcjNWfIh1gLVJ0hEkdHRjyc2Vtt+esgAaC2wX8GXOvXCs4b4i54hx n4IEAF0gZoUdCJLI+lZfBpwhqE3WzBDnaAZa0WLHyyiPUgDVrUFggEtfGuzzbxcSHRTSCuWIWEWcb vYPCAu0a6LVhqdjiT2oZXoxyJVCdfzwBELu6Om4LcWEk4GdflHC9fr6tB6JVTJrKZR757p55SLTnf IiOLYvJric3ur1Xk8BGTFzt062ojeRgfGo0EyrGWxyfOQFzAh0iUHAEI9M62dMDASKH1J//GzSTCs nERf46aA==; From: Richard Sent Date: Mon, 29 Apr 2024 00:34:20 -0400 Message-ID: <8e12822dfa63081eaca99f204a78965fc6db3a01.1714365260.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -3.39 X-Migadu-Queue-Id: 805E2C12C X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -3.39 X-TUID: 6Eh5THql4SGr * gnu/services/admin.scm (unattended-upgrade-configuration): Add reboot? field. When truthy, unattended upgrade will stop the shepherd root service, triggering a reboot. * doc/guix.texi (Unattended Upgrades): Document it. Change-Id: I0af659b3c318421b1a7baa94dde3dadacc1fa10d --- Decided to change restart? to reboot?. The manual seems to generally prefer reboot and it makes restarting services vs. rebooting the system a bit more distinct. doc/guix.texi | 4 ++++ gnu/services/admin.scm | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5d3c9225b4..709db674c9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22891,6 +22891,10 @@ Unattended Upgrades #~(@@ (guix system install) installation-os))) @end lisp +@item @code{reboot?} (default: @code{#f}) +This field specifies whether the system should reboot after completing +an unattended upgrade. + @item @code{services-to-restart} (default: @code{'(mcron)}) This field specifies the Shepherd services to restart when the upgrade completes. diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 0b325fddb1..4882883878 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -420,6 +420,8 @@ (define-record-type* (default "30 01 * * 0")) (channels unattended-upgrade-configuration-channels (default #~%default-channels)) + (reboot? unattended-upgrade-configuration-reboot? + (default #f)) (services-to-restart unattended-upgrade-configuration-services-to-restart (default '(mcron))) (system-expiration unattended-upgrade-system-expiration @@ -443,6 +445,9 @@ (define (unattended-upgrade-mcron-jobs config) (define services (unattended-upgrade-configuration-services-to-restart config)) + (define reboot? + (unattended-upgrade-configuration-reboot? config)) + (define expiration (unattended-upgrade-system-expiration config)) @@ -512,7 +517,13 @@ (define (unattended-upgrade-mcron-jobs config) ;; XXX: If 'mcron' has been restarted, perhaps this isn't ;; reached. - (format #t "~a upgrade complete~%" (timestamp)))))) + (format #t "~a upgrade complete~%" (timestamp)) + + ;; Stopping the root shepherd service triggers a reboot. + (when #$reboot? + (format #t "~a rebooting system~%" (timestamp)) + (force-output) ;ensure the entire log is written. + (stop-service 'root)))))) (define upgrade (program-file "unattended-upgrade" code)) base-commit: 3bd8d238aba718bf949691d0e37fa310e2cfc12a -- 2.41.0