Bug 1208092

Summary: Mock should not umount my mounts
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, awilliam, dennis, dgregor, dmach, jdisnard, kevin, mebrown, msimacek, msuchy, pbrobinson, praiskup, robatino, satellitgo, williams
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 1.2.13-2.fc22 mock-1.2.13-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-24 08:23:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vít Ondruch 2015-04-01 11:36:57 UTC
Description of problem:
This used to work:

$ sudo mount --bind . /var/lib/mock/fedora-rawhide-x86_64/root/mnt

$ mock -r fedora-rawhide-x86_64 shell
INFO: mock.py version 1.2.7 starting (python version = 2.7.8)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
WARNING: Forcibly unmounting '/var/lib/mock/fedora-rawhide-x86_64/root/mnt' from chroot.
Start: chroot init
INFO: LVM plugin enabled. Allocated pool data: 63.2%. Allocated metadata: 34.63%.
INFO: calling preinit hooks
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Finish: chroot init
Start: shell

Now mock unmounts the mount. I know I can specify mount in config file, but I am not going to change config files every time I want to test something.

Version-Release number of selected component (if applicable):
$ rpm -q mock
mock-1.2.7-1.fc21.noarch


How reproducible:
Always

Steps to Reproduce:
1. $ sudo mount --bind . /var/lib/mock/fedora-rawhide-x86_64/root/mnt
2. $ mock -r fedora-rawhide-x86_64 shell
3.

Actual results:
WARNING: Forcibly unmounting '/var/lib/mock/fedora-rawhide-x86_64/root/mnt' from chroot.

Expected results:
The mount is kept untouched.


Additional info:
Also, mock always used to unmount such mount on shell exit, which is wrong as well, not mentioning that bug 1096185 was never resolved and it is still PITA.

Comment 1 Miroslav Suchý 2015-04-20 15:40:42 UTC
How I should find which mount I should unmount and which not?
The code which forcibly unmount  is there from past to unmount mount from previous run of mock - when mock crashed or was killed.

What I can do for you is to implement:
  --skip-forced-unmount
option, which would just unmount mounts, which we believe that mock mounted, and it will skip calling _umount_residual()

Do you concur?

Comment 2 Vít Ondruch 2015-04-21 05:59:23 UTC
Don't touch any mounts you know nothing about at all. You probably know that you are mounting something like /proc, /sys, etc, so unmount this known mount and don't touch others.

Comment 3 Dennis Gilmore 2015-07-10 01:26:27 UTC
This "Feature" has broken composes as the runroot plugin in koji mounts directories outside of mock.  mock should not touch any mounts it knows nothing about.

Comment 4 Vít Ondruch 2015-07-10 07:57:14 UTC
(In reply to Dennis Gilmore from comment #3)
Is the Koji configuration static? In that case, you might consider to use some mock plugin:

https://fedoraproject.org/wiki/Mock/Plugin/BindMount
https://fedoraproject.org/wiki/Mock/Plugin/Mount

But anyway, I'd love to see this "feature" removed.

Comment 5 Dennis Gilmore 2015-07-10 15:55:49 UTC
the koji configuration is not static. koji writes out the configs on the fly. in this case we would have to teach the plugin to modify the config and potentially to mount directories outside of the choort and then bind mount into the chroot.

Comment 6 Adam Williamson 2015-07-13 16:31:09 UTC
Discussed at 2015-07-13 F23 blocker review meeting: http://meetbot-raw.fedoraproject.org/fedora-blocker-review/2015-07-13/f23-blocker-review.2015-07-13-16.03.log.txt . Accepted as an Alpha blocker per criterion "All release-blocking images must boot in their supported configurations.", on the basis that dgilmore says this bug prevents the compose of one or more release-blocking images (images that don't exist clearly don't boot).

Comment 7 Clark Williams 2015-07-14 14:43:11 UTC
Looking at removing the mount cleanup logic that was added last year. 

The intent will be that mock will only clean up the mounts it initiates. This means that mounts done in the chroot path will be left alone, *but* if they conflict with mock mounts (e.g.  the /proc or /sys mount) the mock run will fail. If you want to change the way mock mounts something you need to do it in the config file.

Comment 8 Dennis Gilmore 2015-07-16 19:16:03 UTC
(In reply to Clark Williams from comment #7)
> Looking at removing the mount cleanup logic that was added last year. 
> 
> The intent will be that mock will only clean up the mounts it initiates.
> This means that mounts done in the chroot path will be left alone, *but* if
> they conflict with mock mounts (e.g.  the /proc or /sys mount) the mock run
> will fail. If you want to change the way mock mounts something you need to
> do it in the config file.

Sounds like exactly what we need. Thank you

Comment 9 Fedora Update System 2015-07-21 18:57:30 UTC
mock-1.2.11-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.11-1.fc21

Comment 10 Fedora Update System 2015-07-21 18:57:38 UTC
mock-1.2.11-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/mock-1.2.11-1.fc22

Comment 11 Fedora Update System 2015-07-21 18:57:45 UTC
mock-1.2.11-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.11-1.el7

Comment 12 Fedora Update System 2015-07-21 18:57:57 UTC
mock-1.2.11-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.11-1.el6

Comment 13 Fedora Update System 2015-07-23 19:12:37 UTC
Package mock-1.2.11-1.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.2.11-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2015-7301/mock-1.2.11-1.el6
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2015-07-23 19:51:04 UTC
mock-1.2.12-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.12-1.fc21

Comment 15 Fedora Update System 2015-07-23 19:51:20 UTC
mock-1.2.12-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/mock-1.2.12-1.fc22

Comment 16 Fedora Update System 2015-07-23 19:51:32 UTC
mock-1.2.12-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.12-1.el6

Comment 17 Fedora Update System 2015-07-23 19:51:46 UTC
mock-1.2.12-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.12-1.el7

Comment 18 Adam Williamson 2015-07-31 20:24:17 UTC
1.2.12-1 was tagged for f23 before freeze, and composes are happening, so I believe we can drop the blocker status for this.

Comment 19 Fedora Update System 2015-08-03 04:28:56 UTC
mock-1.2.12-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-08-17 19:03:54 UTC
mock-1.2.12-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2015-08-17 19:08:24 UTC
mock-1.2.12-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2015-08-18 05:24:28 UTC
mock-1.2.12-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2015-09-16 20:02:25 UTC
mock-1.2.13-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16053

Comment 24 Fedora Update System 2015-09-16 20:07:24 UTC
mock-1.2.13-2.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16056

Comment 25 Fedora Update System 2015-09-18 05:21:23 UTC
mock-1.2.13-2.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update mock'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16056

Comment 26 Fedora Update System 2015-09-18 16:24:37 UTC
mock-1.2.13-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update mock'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16053

Comment 27 Fedora Update System 2015-09-24 08:22:26 UTC
mock-1.2.13-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2015-10-05 22:51:13 UTC
mock-1.2.13-2.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.