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

Previous Next

Package: guix;

Reported by: Fredrik Salomonsson <plattfot <at> posteo.net>

Date: Sun, 13 Sep 2020 04:00:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Fredrik Salomonsson <plattfot <at> posteo.net>
Cc: 43366 <at> debbugs.gnu.org
Subject: bug#43366: "error: rmdir: Device or resource busy" when using btrfs
Date: Tue, 15 Sep 2020 00:15:46 -0400
Hi Fredrik,

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

Fredrik Salomonsson <plattfot <at> posteo.net> 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




This bug report was last modified 4 years and 224 days ago.

Previous Next


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