Bug 1289471 - systemd creates 'var/lib/machines' btrfs subvolumes in mock root
Summary: systemd creates 'var/lib/machines' btrfs subvolumes in mock root
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1205564
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-08 09:01 UTC by Miroslav Suchý
Modified: 2017-12-12 11:09 UTC (History)
24 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1205564
Environment:
Last Closed: 2017-12-12 11:09:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miroslav Suchý 2015-12-08 09:01:46 UTC
+++ 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-22 00:05:27 UTC
Hmm RHEL6 does not support -o option :(

Comment 2 Nick Betteridge 2016-01-06 15:15:05 UTC
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 14:06:55 UTC
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 19:03:12 UTC
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.

Comment 5 Fedora End Of Life 2017-12-12 11:09:35 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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