From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ABmxCK16u2KdkgAAbAwnHQ (envelope-from ) for ; Wed, 29 Jun 2022 00:03:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yOGeB616u2IYCwEAG6o9tA (envelope-from ) for ; Wed, 29 Jun 2022 00:03:25 +0200 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 A974227CFF for ; Wed, 29 Jun 2022 00:03:24 +0200 (CEST) Received: from localhost ([::1]:60448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6JIp-0002xA-EL for larch@yhetil.org; Tue, 28 Jun 2022 18:03:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6JIU-0002tH-BS for bug-guix@gnu.org; Tue, 28 Jun 2022 18:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6JIT-00071I-S5 for bug-guix@gnu.org; Tue, 28 Jun 2022 18:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6JIT-0003Gx-M5 for bug-guix@gnu.org; Tue, 28 Jun 2022 18:03:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#56209: Shepherd 0.9 not cleanly unmounting root Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 28 Jun 2022 22:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56209 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: angry rectangle Cc: 56209@debbugs.gnu.org Received: via spool by 56209-submit@debbugs.gnu.org id=B56209.165645377812569 (code B ref 56209); Tue, 28 Jun 2022 22:03:01 +0000 Received: (at 56209) by debbugs.gnu.org; 28 Jun 2022 22:02:58 +0000 Received: from localhost ([127.0.0.1]:56581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6JIQ-0003Gf-25 for submit@debbugs.gnu.org; Tue, 28 Jun 2022 18:02:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6JIL-0003GR-QV for 56209@debbugs.gnu.org; Tue, 28 Jun 2022 18:02:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39842) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6JIG-00070h-Gk; Tue, 28 Jun 2022 18:02:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=UGZKKeRtYd7OcpPWkQF1XlVBKB8V6pLprJk45v8ExXc=; b=JftMMCu6hZeaK1FS1UtF tkvIGhBunVuk74OA3czjGMGHZ8GnZkzLmwMomzgTJej4fttgNxLQBt3X9dh3R+mFO9s91z0ACfxxg ijH+wtEk88FsCnm0SVdQLH3TwtdhUFXjx5j5OCVMzuHjwNvvoELC+FS725vhg4q9vW9Igyg/s6IJT aKGEmV0y5ddc3YSHp6sQh7PkYGXve0QddrYL04LOWRcBsBjEmWdJrveWBErDsc5z1qivezhlcYFBD zOLNI+z0qHLX2FVVU0wvoXqu8gRWoRytI5hodTmVePW06j9OrJ5qQpDCqMxruNSREhJbRt2mJp10e wsm4ARs7FRZV2A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54125 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6JIG-0006HQ-48; Tue, 28 Jun 2022 18:02:48 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87a6a1fgpn.fsf@cock.li> <87mtdxg4hp.fsf@gnu.org> Date: Wed, 29 Jun 2022 00:02:45 +0200 In-Reply-To: <87mtdxg4hp.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 27 Jun 2022 23:50:58 +0200") Message-ID: <87ilokbg56.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656453804; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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=UGZKKeRtYd7OcpPWkQF1XlVBKB8V6pLprJk45v8ExXc=; b=rLUt0qTtoDUFeM9YokczZ7Ic5DZSygiau+0+pSJgSudfhtQl+eiQBcSF92RgErtAInYhf4 xoszdBkTyYAQkRlGTYB91g6eiwVftYb29BcjqVJaJ8wj7rrHS1+0roSFNue74+zG9JpoqV IwFBv/FQPOg1w2eg8+cSJd7edwH+mjjX7hygR5AdQYFHhngs7W1FnBJka/NUR/gYlzkcS3 U55RsXf1DLhn/Xl7F7HLDqbC7WO05B5xXZAoprYzK0qmn5Qza2RVuQUw6I6dRKvXZcCEFe Qhb3xKfm1/0uwAENXYvSFTuY8OsbxMr7fq4Gk46rx9V10vtdRKzE/4SFgw4PNA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656453804; a=rsa-sha256; cv=none; b=MKb/FUvjjKwkjVSTCgQOI/Cgl5XXcYRhgockLcuzBk5K+q7kD1Xvw4oJRTd7P0z2MqgsJ+ Bzb5gkJOwoT6LuLA2mqefgrQ3qBwFeN2nSW5aVdKFN4R/rJ5opbM/OfwC0D15iVMiNoTMu 6IJ1b/TrtLZUu+65FfGVUdO2nyz66L2Czh8IfgPnIFSuAfPHY2/DbzZOxlfxW22ONwYWOH yACtYytsQloK7eQvokRfNJXve8QOTds/IltjwRS/9vT7yOsUWO/tZCEysZGm3u1pEHaG7S NwfmSOkxSr/0CBFAKzReHbd2toi8rDyDJ6jV1bQoRPz0T0lgqDFzFFLgPdjLoQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=JftMMCu6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.96 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=JftMMCu6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: A974227CFF X-Spam-Score: -3.96 X-Migadu-Scanner: scn0.migadu.com X-TUID: lD5nrmKT08gy --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I believe the attached patch fixes the problem. I=E2=80=99ll do more testi= ng on my side but I=E2=80=99d be grateful if someone would give it a try too. Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 17b7b38a15..dea58354d9 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -328,7 +328,18 @@ (define-public shepherd-0.9 version ".tar.gz")) (sha256 (base32 - "0l2arn6gsyw88xk9phxnyplvv1mn8sqp3ipgyyb0nszdzvxlgd36")))) + "0l2arn6gsyw88xk9phxnyplvv1mn8sqp3ipgyyb0nszdzvxlgd36")) + (modules '((guix build utils))) + (snippet + ;; Avoid continuation barriers so (@ (fibers) sleep) can be + ;; called from a service's 'stop' method + '(substitute* "modules/shepherd/service.scm" + (("call-with-blocked-asyncs") ;in 'stop' method + "(lambda (thunk) (thunk))") + (("\\(for-each-service\n") ;in 'shutdown-services' + "((lambda (proc) + (for-each proc + (fold-services cons '())))\n"))))) (arguments (list #:configure-flags #~'("--localstatedir=/var") #:make-flags #~'("GUILE_AUTO_COMPILE=0") diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d58afb27e3..1fd4cd84f3 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -300,27 +300,36 @@ (define %root-file-system-shepherd-service ;; Return #f if successfully stopped. (sync) - (call-with-blocked-asyncs - (lambda () - (let ((null (%make-void-port "w"))) - ;; Close 'shepherd.log'. - (display "closing log\n") - ((@ (shepherd comm) stop-logging)) + (let ((null (%make-void-port "w"))) + ;; Close 'shepherd.log'. + (display "closing log\n") + ((@ (shepherd comm) stop-logging)) - ;; Redirect the default output ports.. - (set-current-output-port null) - (set-current-error-port null) + ;; Redirect the default output ports.. + (set-current-output-port null) + (set-current-error-port null) - ;; Close /dev/console. - (for-each close-fdes '(0 1 2)) + ;; Close /dev/console. + (for-each close-fdes '(0 1 2)) - ;; At this point, there are no open files left, so the - ;; root file system can be re-mounted read-only. - (mount #f "/" #f - (logior MS_REMOUNT MS_RDONLY) - #:update-mtab? #f) + (let loop ((n 10)) + (unless (catch 'system-error + (lambda () + ;; At this point, there are no open files left, so the + ;; root file system can be re-mounted read-only. + (mount #f "/" #f + (logior MS_REMOUNT MS_RDONLY) + #:update-mtab? #f) + #t) + (const #f)) + (unless (zero? n) + ;; Yield to the other fibers. That gives logging fibers + ;; an opportunity to close log files so the 'mount' call + ;; doesn't fail with EBUSY. + ((@ (fibers) sleep) 1) + (loop (- n 1))))) - #f))))) + #f))) (respawn? #f))) (define root-file-system-service-type --=-=-=--