GNU bug report logs - #43366
"error: rmdir: Device or resource busy" when using btrfs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Fredrik Salomonsson <plattfot@HIDDEN>; Keywords: patch; dated Sun, 13 Sep 2020 04:00:02 UTC; Maintainer for guix is bug-guix@HIDDEN.
Added tag(s) patch. Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 43366 <at> debbugs.gnu.org:


Received: (at 43366) by debbugs.gnu.org; 15 Sep 2020 18:23:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 14:23:49 2020
Received: from localhost ([127.0.0.1]:60553 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIFcK-0007zU-QN
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 14:23:49 -0400
Received: from mout01.posteo.de ([185.67.36.65]:60866)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <plattfot@HIDDEN>) id 1kIFUc-0007mn-BS
 for 43366 <at> debbugs.gnu.org; Tue, 15 Sep 2020 14:15:51 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id E060C160062
 for <43366 <at> debbugs.gnu.org>; Tue, 15 Sep 2020 20:15:43 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1600193743; bh=CHOH9N6RAA+WgXPXz+BeuDSXxd6qcVN2xejqqnDfzIg=;
 h=From:To:Cc:Subject:Date:From;
 b=kiPxlvmEFCX+mblnYH2Fk+BX0+W9YPX6KgyoTMiAWY+R4GyzgShayX+udth/5p3MT
 4sM/+ZhqmrlzbZ3weYOiUBoLiOkb4kFB7kDmQN/gAtnVpcT26UwS4WigBURJAojOL/
 zWABAs7ulxQUn8pHz/ethSytL+tt1orI7HHCo6sZpVbsR0R6bvj5lPFaPdDHiTx/+1
 0MXU/puHw7rPaoUUtn37jUTJljuxIfbXQoNVlTdRSk77ag6hMfp+BshwTi0YP3BI8C
 rdBfZ1bIWyza2kJBRyjzcGkCe4fjY47cmpBR2ejBHV8oc888DMGCdMhQZBuX/2/mdw
 PrJqSo2QVZ9iQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4BrWcZ4vh4z6tm8;
 Tue, 15 Sep 2020 20:15:42 +0200 (CEST)
From: Fredrik Salomonsson <plattfot@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#43366: "error: rmdir: Device or resource busy" when using
 btrfs
In-Reply-To: <87wo0v3cb1.fsf@HIDDEN>
References: <87v9gi5ou8.fsf@HIDDEN> <87wo0v3cb1.fsf@HIDDEN>
Date: Tue, 15 Sep 2020 11:15:40 -0700
Message-ID: <87sgbi9a9f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43366
X-Mailman-Approved-At: Tue, 15 Sep 2020 14:23:47 -0400
Cc: 43366 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Maxim,

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

> I just sent a patch now, but here's a bit more background on what led to
> it.

Nice find! I'm unable to test out the patch right now on my original use
case as I soft bricked my laptop fiddling around with coreboot. And I'm
having some issues with my external flasher.

> The issue seems to be with:
>
> --8<---------------cut here---------------start------------->8---
>   ;; If a previous installation was attempted, make sure we start anew; in
>   ;; particular, we don't want to keep a store database that might not
>   ;; correspond to what we're actually putting in the store.
>   (let ((state (string-append target "/var/guix")))
>     (when (file-exists? state)
>       (delete-file-recursively state)))
> --8<---------------cut here---------------end--------------->8---
>
> Which is part of the install procedure (which gets called when using
> 'guix system init /some/target').  So your guess was correct :-).

Yay!

> To confirm this was the case, I did:
>
> sudo btrfs subvolume create /tmp/toto
> mkdir /tmp/tata
> sudo mount -o subvol=/tmp/toto /dev/mapper/cryptroot /tmp/tata
>
> sudo -E guix repl
>> ,import (guix build utils)
>> (delete-file-recursively "/tmp/tata/")
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> In procedure rmdir: Device or resource busy
>
> Bingo!
>
> Reading the docstring of delete-file-recursively, it says it should
> "report but ignore errors", so that's a bug.

Yeah, that's is the same error I get when running guix init. So this
sounds like it will fix my issue!

Thanks for the speedy fix.

-- 
s/Fred[re]+i[ck]+/Fredrik/g




Information forwarded to bug-guix@HIDDEN:
bug#43366; Package guix. Full text available.

Message received at 43366 <at> debbugs.gnu.org:


Received: (at 43366) by debbugs.gnu.org; 15 Sep 2020 04:15:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 00:15:04 2020
Received: from localhost ([127.0.0.1]:56854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kI2Mx-0003pa-Jq
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:15:04 -0400
Received: from mail-qk1-f182.google.com ([209.85.222.182]:40790)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1kI2Mw-0003oo-23
 for 43366 <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:15:02 -0400
Received: by mail-qk1-f182.google.com with SMTP id w16so2954579qkj.7
 for <43366 <at> debbugs.gnu.org>; Mon, 14 Sep 2020 21:15:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=njQPEzUWDPjkRcr6p+XgadxJMw53fpGhfZQoHhbZymU=;
 b=gnzqXIjcQiNvuP8tRs0ysAs8865wqbJKpXgAAxGXmaCyKnRvwY7DDbgK2ZUXmsQNDJ
 BtjY09z4v2TSBIo+2Jzk5E9MSQfQ1CCg3bPazvYOmG3BbFCCt7MjL8qkD+9oap5b06jX
 jDxYzEuZCoT36/dFd+qdQu6dX2iA/2XwY5cGClb/w98Lo2113AKQmi7jBnuKCaNbFcWs
 G3h2xjWBxT4xYkDUJ5XTNDb93sYz7c5pK0KNhNG8sGRad0S0abEI294Vtff4KO9Jn+/7
 ekkz7JRuhh/Y4YxPdO8KQZDIdD0LjixCCbyKhy5PuyxfGSkZw3B1DP1vGs9s/MzyDFKi
 JbSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=njQPEzUWDPjkRcr6p+XgadxJMw53fpGhfZQoHhbZymU=;
 b=Bw7hNyhy9UihnRnMdYPtt7KrLxwGb3izf3/+SjI7e10SkvwY46cPxwlQLEIOYVV/qW
 GE0xjATzXksEVZH4udQQECiMc3oOcfiNIsfylAhJKnFx8JwELxfH3IWinczyc+sgxta+
 pqdREVP6pV/E8DXPaxJe77grYENFquW6ASZvxo8g9imNL99tzkVe4//pjd/p+igHjjUK
 aOrd/ddIJRtWnNR1xl6L2CUFCuqWtmBel2eqB992YTOX7mRi55PmnBlGoLT1k8GSGexq
 KIKrCElRENyrDJb3K5QnPv7dYS7Jj05Xsz3W9/uaBG3L1Y7Jfo1scK1AZEKzzhoXVKkM
 UIIQ==
X-Gm-Message-State: AOAM531RIIxZnDzjNxq30cfCSq0ACI8i+3ee/gRbJDlQLqUy85kuuztO
 ajTk+2uvcIyyXNnnNpPlLNY8zLHvmkoqDA==
X-Google-Smtp-Source: ABdhPJzz/vZuI9hlYiU2x5JklfUvay/bkgD/utgYp5XOuWVwMi3qK2ivV1OKxXnGiNkny41icDG+FA==
X-Received: by 2002:a37:8d7:: with SMTP id 206mr15264551qki.156.1600143296419; 
 Mon, 14 Sep 2020 21:14:56 -0700 (PDT)
Received: from hurd (dsl-205-233-124-4.b2b2c.ca. [205.233.124.4])
 by smtp.gmail.com with ESMTPSA id i7sm16067705qkb.131.2020.09.14.21.14.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2020 21:14:55 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Fredrik Salomonsson <plattfot@HIDDEN>
Subject: Re: bug#43366: "error: rmdir: Device or resource busy" when using
 btrfs
References: <87v9gi5ou8.fsf@HIDDEN>
Date: Tue, 15 Sep 2020 00:15:46 -0400
In-Reply-To: <87v9gi5ou8.fsf@HIDDEN> (Fredrik Salomonsson's message of
 "Sat, 12 Sep 2020 20:37:35 -0700")
Message-ID: <87wo0v3cb1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43366
Cc: 43366 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Fredrik,

I just sent a patch now, but here's a bit more background on what led to
it.

Fredrik Salomonsson <plattfot@HIDDEN> writes:

> When you have separate btrfs subvolumes for /gnu and /var/guix, you'll
> encounter this error running `guix system init /mnt/etc/config.scm /mnt`
> when it tries to copy things to /mnt. My guess is that guix is trying to
> remove one of them but fails as they're mounted.

The issue seems to be with:

--8<---------------cut here---------------start------------->8---
  ;; If a previous installation was attempted, make sure we start anew; in
  ;; particular, we don't want to keep a store database that might not
  ;; correspond to what we're actually putting in the store.
  (let ((state (string-append target "/var/guix")))
    (when (file-exists? state)
      (delete-file-recursively state)))
--8<---------------cut here---------------end--------------->8---

Which is part of the install procedure (which gets called when using
'guix system init /some/target').  So your guess was correct :-).

To confirm this was the case, I did:

sudo btrfs subvolume create /tmp/toto
mkdir /tmp/tata
sudo mount -o subvol=/tmp/toto /dev/mapper/cryptroot /tmp/tata

sudo -E guix repl
> ,import (guix build utils)
> (delete-file-recursively "/tmp/tata/")
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure rmdir: Device or resource busy

Bingo!

Reading the docstring of delete-file-recursively, it says it should
"report but ignore errors", so that's a bug.

Maxim




Information forwarded to bug-guix@HIDDEN:
bug#43366; Package guix. Full text available.

Message received at 43366 <at> debbugs.gnu.org:


Received: (at 43366) by debbugs.gnu.org; 15 Sep 2020 04:08:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 00:08:43 2020
Received: from localhost ([127.0.0.1]:56848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kI2Go-0003fT-RV
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:08:43 -0400
Received: from mail-qt1-f173.google.com ([209.85.160.173]:45607)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1kI2Gl-0003f8-CC
 for 43366 <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:08:41 -0400
Received: by mail-qt1-f173.google.com with SMTP id z2so2170112qtv.12
 for <43366 <at> debbugs.gnu.org>; Mon, 14 Sep 2020 21:08:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=8JdylyF98Lg7KQ3ylzub6SzwqwHqEbHWfnkultfTlnY=;
 b=ACLefPaEzeF9P/3Dxdt9+06edLV+kMTLiSM89K+Ibf3kyOHONMFNswtUdp4ZMExReK
 IhHV1ZCUC6/WGqpuo5UMzVkv9eL2JYZWVQHGHnp63tv/0OxC0lm+ORF/OTJiHyE4wH8z
 TE6extpSOCMltNPK9V3mbENIOZ+xkKwFSsANXAxC/ivgJQStcGC0sV5oycn/ZrjppwJT
 NyEAlsie6oXOKyB7QBSHg5Z7NVfxZoVbrtnbLi4S05LsuReRrX3dsLzfFU1tRTd8qcgA
 nAN6Sc2B36dnfdeDhuWvB4Ju4Ib/SOi0BntlbORMh4sTQvK5FVi3xeYs3OohGqtOIqsR
 +axQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=8JdylyF98Lg7KQ3ylzub6SzwqwHqEbHWfnkultfTlnY=;
 b=rQa36mYHlKGGDMWIWRwwOzx46rh4GwLO7+ysCLvyRNgcVHaoCfMx+EWS5AQzB3Jak8
 1tinF4Fv86DVKbbuI9j+lQJkY+zyDJgTg0jxMan0pV+ejJzXi7Kx3Ume0MtRtTA0VDXF
 1bM7lmzYknljXLERP4E6gctAkOE1RT+6OdTbhVfNGr3zdgFm47LvRBRRFpbGVPKyyphf
 IjMpPdGiMhobvVDZ2wtXqVubsqutA0yliOpG0pe0j8IksPW6wJBhjkZHSbUKssaXuJXH
 hJrbkNvAqwuW04XlGJNzTtiAk4SEDSyfbmycdK/Py0dOGryDx0zBKRh/jchiTnCHWJJV
 HoPg==
X-Gm-Message-State: AOAM533fM3zEIuIYe5TkxyFnsYukkqupAVplMFUM1eJwyV7zI2fLG0KS
 vJxM0o8PAOo7oyqQKXgJtuWfxoKS9xCiLw==
X-Google-Smtp-Source: ABdhPJxNRxHLAYdmounLy/hy1Ztee1Ify67RJ8Ib6z6qfz4cZZ5BLgFlFMhTP1ebzySD0ZhYPA7RRw==
X-Received: by 2002:ac8:2942:: with SMTP id z2mr16822759qtz.376.1600142913430; 
 Mon, 14 Sep 2020 21:08:33 -0700 (PDT)
Received: from localhost.localdomain (dsl-205-233-124-4.b2b2c.ca.
 [205.233.124.4])
 by smtp.gmail.com with ESMTPSA id 29sm15964073qkr.114.2020.09.14.21.08.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2020 21:08:33 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 43366 <at> debbugs.gnu.org
Subject: [PATCH core-updates] utils: Do not raise exceptions in
 delete-file-recursively.
Date: Tue, 15 Sep 2020 00:08:37 -0400
Message-Id: <20200915040837.26098-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <87v9gi5ou8.fsf@HIDDEN>
References: <87v9gi5ou8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=yes
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 43366
Cc: Fredrik Salomonsson <plattfot@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This makes it so that delete-file-recursively honors its docstring, which says
it should "report but ignore errors".

Fixes <https://issues.guix.gnu.org/43366>.

* guix/build/utils.scm (warn-on-error): New syntax.
(delete-file-recursively): Use it to catch exceptions and print warning
messages.

Reported-by: Fredrik Salomonsson <plattfot@HIDDEN>
---
 guix/build/utils.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 0a04032834..fbf4f2d61a 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Arun Isaac <arunisaac@HIDDEN>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@HIDDEN>
 ;;; Copyright © 2020 Efraim Flashner <efraim@HIDDEN>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -366,6 +367,16 @@ verbose output to the LOG port."
                         stat
                         lstat)))
 
+(define-syntax-rule (warn-on-error expr file)
+  (catch 'system-error
+    (lambda ()
+      expr)
+    (lambda args
+      (format (current-error-port)
+              "warning: failed to delete ~a: ~a~%"
+              file (strerror
+                    (system-error-errno args))))))
+
 (define* (delete-file-recursively dir
                                   #:key follow-mounts?)
   "Delete DIR recursively, like `rm -rf', without following symlinks.  Don't
@@ -376,10 +387,10 @@ errors."
                         (or follow-mounts?
                             (= dev (stat:dev stat))))
                       (lambda (file stat result)   ; leaf
-                        (delete-file file))
+                        (warn-on-error (delete-file file) file))
                       (const #t)                   ; down
                       (lambda (dir stat result)    ; up
-                        (rmdir dir))
+                        (warn-on-error (rmdir dir) dir))
                       (const #t)                   ; skip
                       (lambda (file stat errno result)
                         (format (current-error-port)
-- 
2.28.0





Information forwarded to bug-guix@HIDDEN:
bug#43366; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Sep 2020 03:59:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 12 23:59:10 2020
Received: from localhost ([127.0.0.1]:49296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kHJAT-0006ex-Ec
	for submit <at> debbugs.gnu.org; Sat, 12 Sep 2020 23:59:10 -0400
Received: from lists.gnu.org ([209.51.188.17]:33470)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <plattfot@HIDDEN>) id 1kHIpm-0006C4-PW
 for submit <at> debbugs.gnu.org; Sat, 12 Sep 2020 23:37:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46096)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <plattfot@HIDDEN>)
 id 1kHIpm-0005LQ-Ii
 for bug-guix@HIDDEN; Sat, 12 Sep 2020 23:37:46 -0400
Received: from mout02.posteo.de ([185.67.36.66]:57889)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <plattfot@HIDDEN>)
 id 1kHIpj-000625-RN
 for bug-guix@HIDDEN; Sat, 12 Sep 2020 23:37:46 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id A97CA2400FB
 for <bug-guix@HIDDEN>; Sun, 13 Sep 2020 05:37:38 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1599968258; bh=sBwdnbFyWZ99wteSshlj0EDGO6h9WFIF5XnrTRWga2s=;
 h=From:To:Subject:Date:From;
 b=FNepZW0kGzIp//P9e42oqKL6fXeIwS0mKBGxCJeSAlQYqWM6/FMqq3L+1gsFR5obx
 uWOalswy9dckflw5fROoZoiLdvkYosLWu9LDxJXJx97xIZgDf5oKjGQAzLNeRJWMQ4
 sjb/dJ5hvM49bH5eUEXTtgF/LeG94ysVVigut5tjuh1OYLQ7ZBsEHgn1OxL64pWmYl
 YUNxsr/W8RmCdsAM3LJevCuJkQyE4hFUOSuhuHAFaedT/2xryUjE3AYSTIjOWdVXUk
 T4/H8bPH7JIcHwfvIEl2cd1bRJ8DGA2VRfPTqVUyHSrPJ313N9vusTJuhfCVG8FSAw
 kuMpZGW/MEPoA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4BpwDK36JQz6tmV
 for <bug-guix@HIDDEN>; Sun, 13 Sep 2020 05:37:37 +0200 (CEST)
From: Fredrik Salomonsson <plattfot@HIDDEN>
To: bug-guix@HIDDEN
Subject: "error: rmdir: Device or resource busy" when using btrfs
Date: Sat, 12 Sep 2020 20:37:35 -0700
Message-ID: <87v9gi5ou8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=plattfot@HIDDEN;
 helo=mout02.posteo.de
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/12 23:37:39
X-ACL-Warn: Detected OS   = Linux 3.11 and newer [fuzzy]
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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 12 Sep 2020 23:59:08 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain


When you have separate btrfs subvolumes for /gnu and /var/guix, you'll
encounter this error running `guix system init /mnt/etc/config.scm /mnt`
when it tries to copy things to /mnt. My guess is that guix is trying to
remove one of them but fails as they're mounted.

I encountered this issue while I tried installing guix system on my main
laptop. But I have encountered this before [1]. When I installed guix
system on my secondary laptop. I worked around it back then by using
guix-0.15.0.

For my secondary laptop I have this layout
| subvol                | Mountpoint | Comment         |
|-----------------------+------------+-----------------|
| __current/guixsd-root | /          | root for GuixSD |
| __current/grub        | /boot/grub | grub config     |
| __current/guix        | /var/guix  | guix stuff      |
| __current/gnu         | /gnu       | Store etc       |
| __current/home        | /home      | home partition  |

For my main laptop I tried:
| subvol | Mountpoint | Comment        |
|--------+------------+----------------|
| @      | /          | root for Guix  |
| @grub  | /boot/grub | grub config    |
| @guix  | /var/guix  | guix stuff     |
| @gnu   | /gnu       | Store etc      |
| @home  | /home      | home partition |

Found another thread that also had this issue [2], and the same
workaround worked for me. I.e. simplified the layout:
| subvol    | Mountpoint | Comment        |
|-----------+------------+----------------|
| @         | /          | root for Guix  |
| @home     | /home      | home partition |

This seems to just be an issue when running guix system init, as I've
been using my secondary laptop with separate subvolumes for /gnu and
/var/guix without any issues since 0.15.

The guix version I used to install my main laptop with was
1.1.0-25.44c6e6f. I generated it with

  guix system disk-image --file-system-type=iso9660 \
       gnu/system/install.scm

As described in the manual.

Thanks

[1] https://lists.gnu.org/archive/html/help-guix/2018-12/msg00055.html
[2] https://lists.gnu.org/archive/html/help-guix/2019-06/msg00259.html


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=heimdal-sway.scm
Content-Description: Guix system config file

;; This is an operating system configuration template
;; for a "desktop" setup without full-blown desktop
;; environments.

(use-modules (gnu)
             (gnu packages)
             (gnu system nss)
             (gnu system locale)
             (gnu services nfs)
             (gnu services sddm)
             (ice-9 rdelim)
             (ice-9 format)
             (srfi srfi-1))
(use-service-modules desktop networking ssh base xorg)
(use-package-modules wm certs shells xdisorg display-managers)

(define plattfot
  (user-account
   (name "plattfot")
   (group "users")
   ;; Define a G-Expr to find the path of the zsh binary:
   ;; https://gitlab.com/rain1/guix-wiki/wikis/FAQ#how-do-i-make-my-login-shell-zsh
   ;;(shell #~(string-append #$zsh "/bin/zsh"))
   (supplementary-groups '("wheel" "netdev" "audio" "video"))
   (home-directory "/home/plattfot")))

;; Specify a mapped device for the encrypted root partition.
;; The UUID is that returned by 'cryptsetup luksUUID'.
(define mapped-swap
  (mapped-device
   (source (uuid "3f1a433f-e3d5-46f1-8471-b0cfee72a659"))
   (target "swap")
   (type luks-device-mapping)))

(define mapped-root
  (mapped-device
   (source (uuid "0633603e-019c-4be0-b35e-abb055660909"))
   (target "root")
   (type luks-device-mapping)))

;; Partion layout for `root`
;; | subvol    | Mountpoint | Comment            | Shared |
;; |-----------+------------+--------------------+--------|
;; | @         | /          | root for Guix      | no     |
;; | @home     | /home      | home partition     | yes    |

(define btrfs-common-options
  '("discard" "compress=lzo" "space_cache" "autodefrag"))

(define (btrfs-mount-options subvol)
  "Return the btrfs mount options I use.
       Where SUBVOL is the subvolume to mount"
  (string-join `(,@btrfs-common-options ,(format #f "subvol=~a" subvol)) ","))

(define fs-root
  (file-system
   (mount-point "/")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "@"))
   (needed-for-boot? #t)
   (dependencies `(,mapped-root))))

(define fs-home
  (file-system
   (mount-point "/home")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "@home"))
   (needed-for-boot? #t)
   (dependencies `(,fs-root))))

(define nfs-valhalla
  (file-system
   (device "fafner:/srv/nfs4/Valhalla")
   (mount-point "/media/Valhalla")
   (type "nfs4")
   (mount? #f)
   (check? #f)))

(operating-system
 (host-name "heimdal")
 (timezone "Canada/Pacific")
 (locale "en_US.utf8")
 (locale-definitions
  (list
   (locale-definition (name "en_US.utf8") (source "en_US") (charset "UTF-8"))
   (locale-definition (name "sv_SE.utf8") (source "sv_SE") (charset "UTF-8"))))
 ;; Assuming /dev/sda is the target hard disk, and "root"
 ;; is the label of the target root file system.
 (bootloader
  (grub-configuration (target "/dev/sda")))
 ;; Kernel arguments
 (kernel-arguments '("rootflags=compress=lzo,subvol=@"))
 (mapped-devices (list mapped-root mapped-swap))
 (file-systems
  (cons*
   fs-root
   fs-home
   nfs-valhalla
   %base-file-systems))
 (swap-devices '("/dev/mapper/swap"))
 (users (cons plattfot %base-user-accounts))
 (keyboard-layout (keyboard-layout "us" #:options '("ctrl:swapcaps")))
 (packages (cons* sway waybar
                  rofi
                  guix-simplyblack-sddm-theme
                  ;;zsh
                  nss-certs            ;for HTTPS access
                  %base-packages))

 ;; Use the "desktop" services, which include the X11
 ;; log-in service, networking with Wicd, and more.
 (services
  ;;%desktop-services
  (cons* (service openssh-service-type
                  (openssh-configuration
                   (port-number 6060)
                   (password-authentication? #f)))
         (extra-special-file "/bin/env" (file-append coreutils "/bin/env"))
         (service sddm-service-type
                  (sddm-configuration
                   (display-server "wayland")
                   (theme "guix-simplyblack-sddm")))
         (remove (lambda (service)
                   (member (service-kind service)
                           (list
                            gdm-service-type
                            )))
                 %desktop-services)))

 ;; Allow resolution of '.local' host names with mDNS.
 (name-service-switch %mdns-host-lookup-nss))

--=-=-=
Content-Type: text/plain



-- 
s/Fred[re]+i[ck]+/Fredrik/g

--=-=-=--




Acknowledgement sent to Fredrik Salomonsson <plattfot@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#43366; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 18 Sep 2020 03:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.