Bug 250985

Summary: mock doesn't umount /dev/ in case of critical error
Product: [Fedora] Fedora Reporter: Jindrich Novy <jnovy>
Component: mockAssignee: David Cantrell <dcantrell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 7CC: bugs.michael, derks, jos, mebrown, mlichvar, pknirsch, pmachata, tjanouse, williams
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.8.4-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-29 19:05:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to umount '/dev' during clean()
none
umount early in mock-0.7.7 none

Description Jindrich Novy 2007-08-06 10:56:50 UTC
Description of problem:
mock doesn't umount /dev and /proc filesystems from buildroots in case of
crititcal errors such as "No space left on device". As a consequence it will
delete the /dev filesystem in the next mock run since it tries to delete all
contents of previous buildroot.

Version-Release number of selected component (if applicable):
mock-0.7.4-1.fc7

How reproducible:
Build a srpm with mock on a filesystem which doesn't have enough free space.

Steps to Reproduce:
1. mock <srpm>
2. wait for "No space left on device."
3. mock <srpm>
4. /dev filesystem is deleted
  
Actual results:
/dev is gone.

Expected results:
/dev isn't gone.

Additional info:
Likely affects rawide mock as well.

Comment 1 Tomas Janousek 2007-08-14 13:44:01 UTC
I think this happens when you run mock build while being in mock shell as well.
I just experienced it on EL5 with fc6 mock rpm -- so if you fix it, please
update this as well.

Comment 2 BJ Dierkes 2007-10-04 20:10:26 UTC
Created attachment 216311 [details]
Patch to umount '/dev' during clean()

Comment 3 BJ Dierkes 2007-10-04 20:12:26 UTC
As the patch above explains, '/dev' is never umounted in the 'def clean()'
method.  Therefore, if '/dev' was never umounted in a previous build, the next
one would rm -rf it.

Testing with the patch above applied avoid '/dev' from being wiped out.

Comment 4 Michael E Brown 2007-10-22 17:36:06 UTC
fixed in mock 0.8.0+

Comment 5 Fedora Update System 2007-10-24 07:06:13 UTC
mock-0.8.4-2.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'

Comment 6 Fedora Update System 2007-10-29 19:05:27 UTC
mock-0.8.4-2.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2007-11-06 16:11:59 UTC
mock-0.8.4-2.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'

Comment 8 Fedora Update System 2007-11-08 06:01:37 UTC
mock-0.8.4-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Michael Schwendt 2007-11-15 14:26:22 UTC
Fedora 6 is affected by this, too.

$ rpm -q mock
mock-0.7.2-1.fc6.1


Comment 10 Michael E Brown 2007-11-15 16:05:35 UTC
I have tagged mock-0.7.7 in the git repo with fixes for this. Since FC6 is
almost frozen, I had not planned on pushing this update.

If Jesse and Clark agree, we could possibly push it before FC6 freezes completely.

Please test 0.7.7 from git to see that it fixes your issue.


Comment 11 Michael E Brown 2007-11-15 17:48:59 UTC
I have checked 0.7.7 into FC6 tree and run 'make tag', but I have not run a
build yet. Can you please test 0.7.7 before I push it?

Comment 12 Michael Schwendt 2007-11-15 19:06:31 UTC
Doesn't work.

(I've got mock-0.7.7 from http://linux.dell.com/git/mock.git  too).

As I see it, this clean() function is called pretty much at the
beginning, even before prep(). It simply cannot work when --uniqueext
is set, which is the case with a buildsys like Plague.


Comment 13 Michael Schwendt 2007-11-15 19:24:30 UTC
"plague-client kill ..." makes it worse, it seems, as I see multiple
mock/mock-yum related processes here still after the "mock clean".


Comment 14 Michael Schwendt 2007-11-15 19:45:07 UTC
For manual mock builds it works.

In Plague I've modified the kill handler to wait for the mock
process group and not just for the mock child before running mock
clean. I find it strange that it kills the mock process group, but
waits for just the child. So far, waiting for the entire group
works for me fine.


Comment 15 Michael Schwendt 2007-11-15 21:00:45 UTC
Ah! Found the remaining problem:

$ /usr/bin/setarch i686 /usr/bin/mock clean
--uniqueext=e6132b04344468297335b1f64f8530c0065a584f -r fedora-8-i386-build
Could not create dir
/var/lib/mock/fedora-8-i386-e6132b04344468297335b1f64f8530c0065a584f/state.
Error: [Errno 28] No space left on device:
'/var/lib/mock/fedora-8-i386-e6132b04344468297335b1f64f8530c0065a584f/state'

So, in Jindrich's original bug report, in the out-of-disk-space
condition, also a "mock clean" doesn't umount the bind mounts because
it terminates too early.


Comment 16 Michael E Brown 2007-11-15 21:39:46 UTC
FC6 is locked for updates in early Dec. If you would like to submit patches, I
would happily accept them into a 0.7.x update as long as they make the freeze
deadline and Jesse and Clark give an ok.

Comment 17 Michael Schwendt 2007-11-15 22:37:01 UTC
Created attachment 260531 [details]
umount early in mock-0.7.7

Here's one way to fix it. In "clean" run-mode, unmount as soon as
the config rootdir has been determined.