Bug 1122708 - mock fails to initialize new chroot
Summary: mock fails to initialize new chroot
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: mock
Version: el6
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-07-23 20:21 UTC by jason
Modified: 2014-11-18 17:08 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-11-18 17:08:51 UTC

Attachments (Terms of Use)
Debug output log (2.35 MB, text/plain)
2014-07-24 13:41 UTC, jason
no flags Details

Description jason 2014-07-23 20:21:24 UTC
Description of problem: mock fails to initialize the RPM db when creating a chroot environment.

Version-Release number of selected component (if applicable): 1.1.41

How reproducible:  Every time on multiple systems for me

Steps to Reproduce:
1. Install EPEL6 (I'm using Scientific Linux 6.5)
2. mock --init
3. Watch it fail

Actual results:

Fails with error:
OSError: [Errno 2] No such file or directory: '/var/lib/mock/epel-6-x86_64/root//var/lib/rpm/Packages'

Debug output: http://pastebin.com/kfb2caZq

Expected results:

A functional chroot build environment

Additional info:

Comment 1 Miroslav Suchý 2014-07-24 09:18:04 UTC
I could not reproduce it (RHEL 6.5 + Epel).
What is your version of yum?

You can even try to manual patch mock if it fix your problem:
diff --git a/py/mockbuild/backend.py b/py/mockbuild/backend.py
index 3e49fe0..bd06d77 100644
--- a/py/mockbuild/backend.py
+++ b/py/mockbuild/backend.py
@@ -537,6 +537,7 @@ class Root(object):
         self.root_log.debug('create skeleton dirs')
         for item in [
+                     'var/lib/rpm/Packages',
Althought I have no idea why you are hitting this BT.

Comment 2 Pavel Raiskup 2014-07-24 10:13:26 UTC
It seems like yum is unable to instal 'rpm' package as
  $ rpm -qf /var/lib/rpm/Packages

Really don't know why;  just an blind idea, do you have enough space in
/var/lib?  Creating the file explicitly in backend.py would create the dir
too late.


Comment 3 Pavel Raiskup 2014-07-24 10:45:44 UTC
Also, according to 'man yum', adding -d X, -v, -e X, --rpmverbosity to
config_opts['chroot_setup_cmd'] = 'install @buildsys-build''
could say something useful.

(In reply to Pavel Raiskup from comment #2)
> Creating the file explicitly in backend.py would create the dir
> too late.

This is most probably untrue statement ^.  Sorry.

Comment 4 jason 2014-07-24 13:40:08 UTC
  Installed: rpm-4.8.0-37.el6.x86_64 at 2014-05-11 13:26
  Built    : Scientific Linux at 2013-11-21 18:08
  Committed: Panu Matilainen <pmatilai@redhat.com> at 2013-09-12

  Installed: yum-3.2.29-40.el6.noarch at 2014-05-11 13:27
  Built    : Scientific Linux at 2013-02-21 17:12
  Committed: James Antill <james.antill@redhat.com> at 2013-01-08

There's definitely plenty of space, but on the off chance that it wanted a whole lot more, I tried setting it to be on a different partition that had 350GB free.  Same error.

Cranking the verbosity up gives a lot of extra info, but I didn't see anything obviously wrong. Seems like it installs everything just fine, but fails when it tries to record everything it just did.

I'm attaching the DEBUG output in case someone else can make more sense of it.

Comment 5 jason 2014-07-24 13:41:04 UTC
Created attachment 920540 [details]
Debug output log

Comment 6 jason 2014-07-24 13:44:01 UTC
Also, Packages is a file, not a dir, so creating it manually like that wouldn't work.

Comment 7 Miroslav Suchý 2014-07-24 14:13:32 UTC
Notice the differences in paths:
DEBUG util.py:283:  D: opening  db index       /var/lib/mock/epel-6-x86_64/root/usr/lib/rpm/rpmdb/Packages create mode=0x42
DEBUG util.py:283:  OSError: [Errno 2] No such file or directory: '/var/lib/mock/epel-6-x86_64/root//var/lib/rpm/Packages'

The question is why yum/rpm create the file in /usr, while later expect it in /var

Also note that I have slighter newer yum
not sure if it make some difference.

Comment 8 jason 2014-07-24 14:30:24 UTC
On my build system, I have a Packages file in both /var/lib/rpm and /usr/lib/rpm/rpmdb and they are identical.

Yet in the chroot env, only one of them exists. Unfortunately, I can't find any reason as to why.

Comment 9 Miroslav Suchý 2014-11-18 17:08:51 UTC
I'm afraid there is nothing I can do, unless there is better reproducer. Feel free to reopen, when you (or somebody) have more data.

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