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-11-16 14:03 EST (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
Comment 4 Fedora End Of Life 2017-11-16 14:03:12 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

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