Bug 1122708

Summary: mock fails to initialize new chroot
Product: [Fedora] Fedora EPEL Reporter: jason
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: el6CC: jason, jdisnard, mebrown, msimacek, msuchy, praiskup, williams
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-18 17:08:51 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:
Attachments:
Description Flags
Debug output log none

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',
+                     'var/lib/rpm/Packages',
                      'var/lib/yum',
                      'var/lib/dbus',
                      'var/log',
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
  /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.

Pavel

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> 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> 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
  yum-3.2.29-43.el6_5.noarch
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.