From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id iFnONgHBLmYmDQEAqHPOHw:P1 (envelope-from ) for ; Sun, 28 Apr 2024 23:34:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id iFnONgHBLmYmDQEAqHPOHw (envelope-from ) for ; Sun, 28 Apr 2024 23:34:58 +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=pnZZVZ1D; 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=1714340097; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=ZQKQGZic9TRKbJWO1LufJNvt6tRTEEAqozTWUTzAAwg=; b=X9A/KHpiDw4VbRDofgowhLVuGF45qGXLNowUYMr3ONnrMD6NA/2MrKm5S+PUGkdumXCpnf cynvDGOz3dIKmiBcBXtCkUz0GSSu8f3/s3Qw/bKNGE/TWEZje87J99ND3+L5jAVjwK3T8/ d7otbEm3D1xZar8qjFXh2DV8MLT02JfLGROpzU2NKExqXeNyb+UmkmrXeH5reFtLxP3QZh ZtbPyUdGmIkrzhv6J22vswLKxeSRuGHXs6yGKIz3WR6jnlxoAR3O4dZBfSPKPPa3kl0ITS LL5XvQjrYOibZDLldpk3Qm14WGjFbrjex7dBZgTyPF1YzepxSnRx6BSb7pYBrg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=pnZZVZ1D; 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=1714340097; a=rsa-sha256; cv=none; b=Y5zuyKh2GhfIQ6D0Tj4Qz+P9TRb6OBp3DTHrfQSusrF2s2AIKd6q/U1bN+Z141v/sfb4SE WgDVp1PSPzryUPmUTMml50YkgKR6nqOmAUy6CMXiY1Frlg74nxCDfspoFE3+HseJxhfCOR WcqB2Sti1+MrrFY47a1ASBayTv/4VLjqAjVtEwLu4qYbb4MFpz/2jBZVhbeVud+fcXQ5ex XPtYoSCR1wcQPw3KC9nbAy/XV5GZVNIak3SXriK3TIv0PSm4fal7kbZ3WvzXtg9SP94pYs HdwDdkrLXG9SHjEXWQFQPUlBCVn9eKpR84eRByvGK8dP7tMt6wZgcff1hatq0Q== 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 AEFC163F78 for ; Sun, 28 Apr 2024 23:34:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CAX-0001LY-57; Sun, 28 Apr 2024 17:34:45 -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 1s1CAV-0001L5-FR for guix-patches@gnu.org; Sun, 28 Apr 2024 17:34:43 -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 1s1CAV-0007Y7-4L for guix-patches@gnu.org; Sun, 28 Apr 2024 17:34:43 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s1CAo-0002Lm-Ky for guix-patches@gnu.org; Sun, 28 Apr 2024 17:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70636] [PATCH] services: admin: Support restarting system after unattended upgrade Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Apr 2024 21:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70636 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70636@debbugs.gnu.org Cc: Richard Sent X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17143400829019 (code B ref -1); Sun, 28 Apr 2024 21:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Apr 2024 21:34:42 +0000 Received: from localhost ([127.0.0.1]:53003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1CAU-0002LP-C7 for submit@debbugs.gnu.org; Sun, 28 Apr 2024 17:34:42 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1CAS-0002LJ-MZ for submit@debbugs.gnu.org; Sun, 28 Apr 2024 17:34:41 -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 1s1CA3-0001IF-DW for guix-patches@gnu.org; Sun, 28 Apr 2024 17:34:15 -0400 Received: from mail-108-mta127.mxroute.com ([136.175.108.127]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CA1-0007V9-In for guix-patches@gnu.org; Sun, 28 Apr 2024 17:34:15 -0400 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta127.mxroute.com (ZoneMTA) with ESMTPSA id 18f26a125e10008ca2.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 28 Apr 2024 21:34:06 +0000 X-Zone-Loop: 36f9282b432276b75b11623ae604af0acdb61fff39ab 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=ZQKQGZic9TRKbJWO1LufJNvt6tRTEEAqozTWUTzAAwg=; b=pnZZVZ1Du2PAB1FtXeMwCu8/rr QJQi0Qtq3I2e1f9zaNZti8xBR4qZXAUVcnWUsGSpDD8hlcAfzMCJ+2m9lnTHMBNGgEX0uW4FqqWUc G/2/mX0rwgMDHrwuUouNRsLiFrCxgkoqlmcgi/67hR/zcAgnwZzgAAOvA7ml5vwVnDR8XCxcQPVA2 +PMYwx2rjjMWz1vq0VGh+4k4sRWIrpXNIQc9EX3xdOoYVy0CrDyxCMnZP7h4DfAM1qbdYEejXBYH7 nDDJV5gugMpMArwTtsfIv23ODcHLbgbCj/WSiopmkkeA5jHrPojFt1602YR+0rAnNNqvldIpt/gfK U3H13Pcg==; From: Richard Sent Date: Sun, 28 Apr 2024 17:32:47 -0400 Message-ID: <4852ee6c60830311f4f1f06a43af9b471e91ad88.1714339967.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.127; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta127.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.89 X-Spam-Score: -4.89 X-Migadu-Queue-Id: AEFC163F78 X-Migadu-Scanner: mx13.migadu.com X-TUID: b/k8zvLW0lXH * gnu/services/admin.scm (unattended-upgrade-configuration): Add restart? field. When truthy, unattended upgrade will tell shepherd to stop the root service, which triggers a restart. * /doc/guix.texi (Unattended Upgrades): Document it. Change-Id: I0af659b3c318421b1a7baa94dde3dadacc1fa10d --- Hi Guix! This patch adds support for running a complete system restart after an unattended upgrade. Previously, unattended upgrades were not capable of, say, upgrading the kernel. /Technically/ without this patch I'm pretty sure you could restart the system by restarting the 'file-systems service. I haven't found documentation on that and it feels like a hack more than a feature. I don't know if it would perform a safe shutdown. Thankfully, Shepherd explicitly treats "stop root service" as "restart" so the method in this patch should be safe. 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 3ee9f54773..08fdac4cd3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22891,6 +22891,10 @@ Unattended Upgrades #~(@@ (guix system install) installation-os))) @end lisp +@item @code{restart?} (default: @code{#f}) +This field specifies whether the system should restart 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..579cf83132 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)) + (restart? unattended-upgrade-configuration-restart? + (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 restart? + (unattended-upgrade-configuration-restart? 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 restart. + (when #$restart? + (format #t "~a restarting system~%" (timestamp)) + (force-output) ;ensure the entire log is written. + (stop-service 'root)))))) (define upgrade (program-file "unattended-upgrade" code)) base-commit: 9f183c3627a006e8fd3bb9708448bc05a6204e6d -- 2.41.0