Jorge Gallegos' blog.

Cannot remove $SOME_MOCK_CHROOT/var/lib/machines?


So it turns out these files were part of an existing BTRFS subvolume, that's why I couldn't delete them. I rarely (if ever) mess with subvolumes so I am not entirely sure how these came to be, but there you go.

I was doing some packager work and tried to build an F22 SRPM with mock, nothing special the usual mock -r fedora-22-x86_64 foo.src.rpm and I was greeted with the following surprise:

INFO: mock.py version 1.2.7 starting (python version = 2.7.8)...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
INFO: Start(uwsgi-2.0.9-0.src.rpm)  Config(fedora-22-x86_64)
Start: clean chroot
ERROR: Exception(uwsgi-2.0.9-0.src.rpm) Config(fedora-22-x86_64) 0 minutes 0 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-22-x86_64/result

ERROR: [Errno 1] Operation not permitted: '/var/lib/mock/fedora-22-x86_64/root/var/lib/machines'

ERROR: The most common cause for this error is trying to run /usr/sbin/mock as an unprivileged user.
ERROR: Check your path to make sure that /usr/bin/ is listed before /usr/sbin, or manually run /usr/bin/mock to see if that fixes this problem.

I obviously am part of the mock group and can mock-build just fine with another chroot.

Turns out I cannot remove said directory, not even as root... I can't understand first how this directory came to be, and second how to remove it. I am sort of stumped. My first thought was that maybe at some point I went to suspend while a mock build was running but... I just can't remember.

Ideas, anyone?