Bug 1289471 - systemd creates 'var/lib/machines' btrfs subvolumes in mock root
systemd creates 'var/lib/machines' btrfs subvolumes in mock root
Status: NEW
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
:
Depends On: 1205564
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-08 04:01 EST by Miroslav Suchý
Modified: 2017-03-24 10:33 EDT (History)
24 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1205564
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miroslav Suchý 2015-12-08 04:01:46 EST
+++ This bug was initially created as a clone of Bug #1205564 +++


--- Additional comment from  on 2015-12-07 18:24:05 EST ---

Doesn't work on my system.

First, some proof:

    $ dnf list installed mock
    Installed Packages
    mock.noarch     1.2.13-2.fc22   @updates


    $ mock --clean --trace # excerpt
    INFO: ENTER umount(<mockbuild.mounts.FileSystemMountPoint object at 0x7fc93078c320>)
    INFO: LEAVE umount --> None

    INFO: LEAVE umountall --> None

    INFO: ENTER call_hooks(<mockbuild.plugin.Plugins object at 0x7fc93c994b70>, 'umount_root')
    INFO: LEAVE call_hooks --> None

    INFO: ENTER _unlock_buildroot(<mockbuild.buildroot.Buildroot object at 0x7fc93077f9e8>)
    INFO: LEAVE _unlock_buildroot --> None

    INFO: EXCEPTION: [Errno 1] Operation not permitted: '/var/lib/mock/fedora-22-x86_64/root/var/lib/machines'
    Traceback (most recent call last):
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/buildroot.py", line 563, in delete
        util.rmtree(self.basedir, selinux=self.selinux)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 145, in rmtree
        os.rmdir(path)
    PermissionError: [Errno 1] Operation not permitted: '/var/lib/mock/fedora-22-x86_64/root/var/lib/machines'
    INFO: LEAVE delete --> EXCEPTION RAISED

    INFO: EXCEPTION: [Errno 1] Operation not permitted: '/var/lib/mock/fedora-22-x86_64/root/var/lib/machines'
    Traceback (most recent call last):
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/backend.py", line 72, in clean
        self.buildroot.delete()
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/buildroot.py", line 563, in delete
        util.rmtree(self.basedir, selinux=self.selinux)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 136, in rmtree
        rmtree(fullname, selinux=selinux, exclude=exclude)
      File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 84, in trace
        result = func(*args, **kw)
      File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 145, in rmtree
        os.rmdir(path)
    PermissionError: [Errno 1] Operation not permitted: '/var/lib/mock/fedora-22-x86_64/root/var/lib/machines'
    INFO: LEAVE clean --> EXCEPTION RAISED

    INFO: ENTER finalize(<mockbuild.buildroot.Buildroot object at 0x7fc93077f9e8>)
    INFO: ENTER make_chroot_path(<mockbuild.buildroot.Buildroot object at 0x7fc93077f9e8>)
    INFO: LEAVE make_chroot_path --> /var/lib/mock/fedora-22-x86_64/root

It doesn't work because of my btrfs layout:


    $ btrfs subvolume list / | egrep -i "mock|var|root"
    ID 257 gen 935842 top level 5 path root
    ID 258 gen 935847 top level 5 path var
    ID 724 gen 935172 top level 258 path var/lib/machines
    ID 3157 gen 935516 top level 258 path var/lib/mock/fedora-22-x86_64/root/var/lib/machines

    $ btrfs subvolume list /var/lib/mock/fedora-22-x86_64/ | egrep -i "mock|var|root"
    ID 257 gen 935851 top level 5 path root
    ID 258 gen 935857 top level 5 path var
    ID 3157 gen 935516 top level 258 path lib/mock/fedora-22-x86_64/root/var/lib/machines
                                          |
notice -----------------------------------|

This is because subvolumes are trees, which makes parsing more difficult ... but "btrfs subvolume list" does all the heavy lifting given the appropriate arguments.

    $ btrfs subvolume list -a /var/lib/mock/fedora-22-x86_64 | egrep -i "mock|var|root"
    ID 257 gen 935878 top level 5 path <FS_TREE>/root
    ID 258 gen 935880 top level 5 path <FS_TREE>/var
    ID 724 gen 935172 top level 258 path var/lib/machines
    ID 3157 gen 935516 top level 258 path var/lib/mock/fedora-22-x86_64/root/var/lib/machines

    $ btrfs subvolume list -o /var/lib/mock/fedora-22-x86_64
    ID 724 gen 935172 top level 258 path var/lib/machines
    ID 3157 gen 935516 top level 258 path var/lib/mock/fedora-22-x86_64/root/var/lib/machines

Proposed workaround: modify find_btrfs_in_chroot() to add the above "-o" flag:

def find_btrfs_in_chroot(mockdir, chroot_path):
    ...
    try:
       for l in do(["btrfs", "subv", "list", "-o", mockdir], returnOutput=1)[:-1].splitlines():
    ...
Comment 1 Miroslav Suchý 2015-12-21 19:05:27 EST
Hmm RHEL6 does not support -o option :(
Comment 2 Nick Betteridge 2016-01-06 10:15:05 EST
Just tried to build some rpms on centos 7.2, hit this bug, added -o option, still doesn't work :(
Comment 3 Jan Kurik 2016-02-24 09:06:55 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Note You need to log in before you can comment on or make changes to this bug.