Subject: bug#43366: "error: rmdir: Device or resource busy" when using btrfs

From: Fredrik Salomonsson <[email-masked]>
Date: Tue, 15 Sep 2020 11:15:40 -0700

Hi Maxim,

Maxim Cournoyer <[email-masked]> 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