This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 250985 - mock doesn't umount /dev/ in case of critical error
mock doesn't umount /dev/ in case of critical error
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
7
All Linux
low Severity high
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-06 06:56 EDT by Jindrich Novy
Modified: 2013-07-02 19:22 EDT (History)
9 users (show)

See Also:
Fixed In Version: 0.8.4-2.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-29 15:05:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to umount '/dev' during clean() (491 bytes, patch)
2007-10-04 16:10 EDT, BJ Dierkes
no flags Details | Diff
umount early in mock-0.7.7 (1.21 KB, patch)
2007-11-15 17:37 EST, Michael Schwendt
no flags Details | Diff

  None (edit)
Description Jindrich Novy 2007-08-06 06:56:50 EDT
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 09:44:01 EDT
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 16:10:26 EDT
Created attachment 216311 [details]
Patch to umount '/dev' during clean()
Comment 3 BJ Dierkes 2007-10-04 16:12:26 EDT
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 13:36:06 EDT
fixed in mock 0.8.0+
Comment 5 Fedora Update System 2007-10-24 03:06:13 EDT
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 15:05:27 EDT
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 11:11:59 EST
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 01:01:37 EST
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 09:26:22 EST
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 11:05:35 EST
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 12:48:59 EST
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 14:06:31 EST
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 14:24:30 EST
"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 14:45:07 EST
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 16:00:45 EST
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 16:39:46 EST
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 17:37:01 EST
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.

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