Bug 1299482

Summary: mock --init fails with message "Failed calculating RPMDB checksum"
Product: [Fedora] Fedora Reporter: erik.alan.jenkins
Component: dnf-plugins-coreAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 26CC: bcl, besser82, danielkza2, deekej, dmach, dtardon, dwrobel, edgar.hoch, jdisnard, jistone, jkonecny, jmracek, john.ellson, keesdejong+dev, loganjerry, manisandro, mebrown, morgoth6, msimacek, msuchy, oliver.henshaw, packaging-team-maint, praiskup, rpm-software-management, susi.lehtola, tpopela, ttomasz, vmukhame, williams
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-plugins-core-2.1.4-1.fc27 dnf-plugins-core-2.1.4-1.fc26 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-04 14:23:56 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
build.log
none
root.log
none
state.log none

Description erik.alan.jenkins 2016-01-18 13:36:20 UTC
Created attachment 1115851 [details]
build.log

Description of problem:
mock --init fails

Version-Release number of selected component (if applicable):
1.2.14 1.fc23

How reproducible:
Every time.

Steps to Reproduce:
1. execute mock --init
2.
3.

Actual results:
$ /usr/bin/mock --init
INFO: mock.py version 1.2.14 starting (python version = 3.4.3)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
Start: clean chroot
Finish: clean chroot
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled dnf cache
Start: cleaning dnf metadata
Finish: cleaning dnf metadata
INFO: enabled ccache
Mock Version: 1.2.14
INFO: Mock Version: 1.2.14
Start: dnf install
Last metadata expiration check performed 0:00:00 ago on Mon Jan 18 08:24:31 2016.
Dependencies resolved.
Failed calculating RPMDB checksum.
ERROR: Command failed. See logs for output.
 # /usr/bin/dnf --installroot /usr/local/share/mock/fedora-23-x86_64/root/ --releasever 23 --setopt=deltarpm=false install @buildsys-build --setopt=tsflags=nocontexts


Expected results:
Success?

Additional info:

Comment 1 erik.alan.jenkins 2016-01-18 13:37:18 UTC
Created attachment 1115852 [details]
root.log

Comment 2 erik.alan.jenkins 2016-01-18 13:38:02 UTC
Created attachment 1115853 [details]
state.log

Comment 3 erik.alan.jenkins 2016-01-18 19:59:37 UTC
I cleaned out /var/cache/mock and it works again.

Comment 4 Daniel Miranda 2016-05-17 00:47:43 UTC
I hit the same issue, and cleaning up both /var/lib/mock and /var/cache/mock doesn't fix it.

Comment 5 Daniel Miranda 2016-05-18 03:45:18 UTC
It seems DNF cannot cope with a non-existing RPM DB anymore. I don't know if it used to create one automatically, but it doesn't anymore. The error message seems to be coming from hawkey, so I guess some unintended behavior change was introduced that broke it.

Comment 6 Miroslav Suchý 2016-06-02 14:36:45 UTC
I cannot reproduce it with mock-1.2.17-1.fc24.noarch

Comment 7 Daniel Miranda 2016-06-02 18:39:13 UTC
These are the versions of all the software that I think can be relevant in my system:

dnf-0:1.1.9-2.fc23.noarch
python3-dnf-plugins-core-0.1.21-2.fc23.noarch
rpm-0:4.13.0-0.rc1.13.fc23.x86_64
hawkey-0.6.2-3.fc23.x86_64
python3-hawkey-0.6.2-3.fc23.x86_64
librepo-1.7.16-2.fc23.x86_64
python3-librepo-1.7.16-2.fc23.x86_64
libsolv-0.6.20-2.fc23.x86_64

It probably doesn't matter, but my root filesystem is set up with BTRFS on top of LVM.

I'll try to reproduce the issue from a clean install (in a VM) and report back.

Comment 8 Marcin Kurek 2016-08-24 09:06:05 UTC
Similar problem here (F24 x86_64) Mock starts to fail with this RPMDB checksum error and quick looking at /var/lib/mock/fedora-24-i386/root/var/lib/rpm reveals directory was empty. 

Workaround was: rpmdb --initdb --dbpath=/var/lib/mock/fedora-24-i386/root/var/lib/rpm and using -n switch in next mock invocation.

Comment 9 Björn 'besser82' Esser 2016-10-14 22:25:46 UTC
Can confirm the same finding on fresh Fedora 25 Beta install…

Comment 10 Fedora End Of Life 2016-11-24 15:01:59 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Josh Stone 2016-11-28 18:50:41 UTC
Same with mock-1.3.2-1.fc25.noarch.  I frequently have to run rpmdb --initdb manually to get going.  Once there's a root cache, that can be reused just fine, but try --scrub=all and then --init, and it's a problem again.

Comment 12 David Kaspar // Dee'Kej 2016-11-29 12:35:28 UTC
I'm still facing this issue, and it really breaks my workflow. Do we know what's causing this?

Comment 13 Miroslav Suchý 2016-11-30 13:31:50 UTC
(In reply to David Kaspar [Dee'Kej] from comment #12)
> Do we know
> what's causing this?

No. And personally I cannot reproduce it. VM image or Dockerfile with the reproducer will be helpful.

Comment 14 Josh Stone 2016-12-01 21:30:19 UTC
Well, I'm trying to reproduce it in a VM, but it stubbornly works fine.  :/

I even copied my entire /etc/mock/, so I know that's not the problem.
If I can find the meaningful difference, I'll let you know...

Comment 15 Josh Stone 2016-12-01 22:17:56 UTC
Via strace, I figured out this is the dnf debuginfo plugin.

Edit /etc/dnf/plugins/debuginfo-install.conf, and set autoupdate=1.  Now when mock tries to init, the plugin sees the bogus rpmdb and bombs out.

I can upload a VM image if you need, but I think this is easy to reproduce now.

Comment 16 Josh Stone 2016-12-01 22:24:21 UTC
So I have two workarounds:

1. Set autoupdate=0 for the host.  But that's not desirable, since I do want debuginfo updating.

2. Disable the debuginfo-install plugin via mock's dnf_common_opts in site-defaults.cfg.  This is probably the best option for now.

Comment 17 David Kaspar // Dee'Kej 2016-12-02 10:05:18 UTC
Hello guys,

I can confirm that currently I have 'autoupdate=1' enabled for debuginfo. I will try next week to reproduce this on my machine, both with 'autoupdate=1' and 'autoupdate=0'.

Best regards,

Dee'Kej

Comment 18 Sandro Mani 2016-12-20 16:16:24 UTC
Hitting the same, but in addition to the debuginfo-install plugin I also needed to disable the leaves plugin.

Comment 19 Daniel Miranda 2016-12-22 03:14:45 UTC
I can confirm that disabling the debuginfo-install plugin fixes the issue. It seems to be sufficient to do it in /etc/mock/site-defaults.cfg by adding `--disableplugin=debuginfo-install` to the DNF command line.

Comment 20 Susi Lehtola 2017-01-28 07:09:41 UTC
(In reply to Daniel Miranda from comment #19)
> I can confirm that disabling the debuginfo-install plugin fixes the issue.
> It seems to be sufficient to do it in /etc/mock/site-defaults.cfg by adding
> `--disableplugin=debuginfo-install` to the DNF command line.

I feel like this should be added to the default configuration. I spent a good 15-30 minutes figuring out why my mock has stopped working and trying to get it to work again.

Comment 21 David Kaspar // Dee'Kej 2017-02-27 16:15:47 UTC
(In reply to Susi Lehtola from comment #20)
> I feel like this should be added to the default configuration. I spent a
> good 15-30 minutes figuring out why my mock has stopped working and trying
> to get it to work again.

I agree with you on this. Maybe we should propose this @fedora-devel mailing list?

Comment 22 Tomas Toth 2017-07-16 14:18:24 UTC
I have just hit the same issue with F26.
The  workaround for me was to change /etc/mock/site-defaults.cfg
From
# config_opts['dnf_common_opts'] = ['--disableplugin=local', '--setopt=deltarpm=False']
To
config_opts['dnf_common_opts'] = ['--noplugins', '--setopt=deltarpm=False']

I.e. to use --noplugins instead of --disableplugin=local.

Comment 23 John Ellson 2017-07-21 15:43:19 UTC
new mock user ... Tomas' solution in Comment 22 worked for me.  Thanks.

Comment 24 Kees de Jong 2017-08-02 07:57:29 UTC
The problem still persists with:
$ rpm -qa mock rpm dnf*
dnf-conf-2.6.2-1.fc26.noarch
dnf-2.6.2-1.fc26.noarch
dnf-plugins-core-2.1.3-1.fc26.noarch
rpm-4.13.0.1-5.fc26.x86_64
dnf-yum-2.6.2-1.fc26.noarch
mock-1.4.2-1.fc26.noarch

Also /etc/mock/default.cfg is not created on a clean install of Fedora 26, but that's a different issue which is already addressed in multiple duplicate bug reports already.

When I run:
$ mock psad-2.4.4-5.fc26.src.rpm                                                   
INFO: mock.py version 1.4.2 starting (python version = 3.6.2)...    
Start: init plugins               
INFO: selinux disabled            
Finish: init plugins              
Start: run                        
INFO: Start(/home/user/git/rpmbuild/SRPMS/psad-2.4.4-5.fc26.src.rpm)  Config(fedora-26-x86_64)                                         
Start: clean chroot               
Finish: clean chroot              
Start: chroot init                
INFO: calling preinit hooks       
INFO: enabled root cache          
INFO: enabled dnf cache           
Start: cleaning dnf metadata      
Finish: cleaning dnf metadata     
INFO: enabled HW Info plugin      
Mock Version: 1.4.2               
INFO: Mock Version: 1.4.2         
Start: dnf install                
Last metadata expiration check: 0:00:00 ago on Wed 02 Aug 2017 09:42:02 AM CEST.                                                        
failed calculating RPMDB checksum 
ERROR: Exception(/home/user/git/rpmbuild/SRPMS/psad-2.4.4-5.fc26.src.rpm) Config(fedora-26-x86_64) 0 minutes 3 seconds                 
INFO: Results and/or logs in: /var/lib/mock/fedora-26-x86_64/result 
ERROR: Command failed:            
 # /usr/bin/dnf --installroot /var/lib/mock/fedora-26-x86_64/root/ --releasever 26 --disableplugin=local --setopt=deltarpm=False install @buildsys-build
Last metadata expiration check: 0:00:00 ago on Wed 02 Aug 2017 09:42:02 AM CEST.                                                        
failed calculating RPMDB checksum 

root.log says:
INFO buildroot.py:345:  Mock Version: 1.4.2
DEBUG util.py:122:  touching file: /var/lib/mock/fedora-26-x86_64/root/etc/fstab
DEBUG util.py:122:  touching file: /var/lib/mock/fedora-26-x86_64/root/etc/yum/yum.conf
DEBUG util.py:122:  touching file: /var/lib/mock/fedora-26-x86_64/root/etc/dnf.conf
DEBUG util.py:122:  touching file: /var/lib/mock/fedora-26-x86_64/root/var/log/yum.log
DEBUG util.py:109:  ensuring that dir exists: /var/lib/mock/fedora-26-x86_64/root/var/cache/dnf/
DEBUG util.py:606:  child environment: None
DEBUG util.py:533:  Executing command: ['/bin/mount', '-n', '--bind', '/var/cache/mock/fedora-26-x86_64/dnf_cache/', '/var/lib/mock/fedora-26-x86_64/root/var/cache/dnf/'] with env {'TERM': 'vt100', 'SHELL': '/bin/sh', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'LANG': 'en_US.UTF-8'} and shell False
DEBUG util.py:588:  Child return code was: 0
DEBUG buildroot.py:140:  rootdir = /var/lib/mock/fedora-26-x86_64/root
DEBUG buildroot.py:141:  resultdir = /var/lib/mock/fedora-26-x86_64/result
DEBUG util.py:109:  ensuring that dir exists: /var/lib/mock/fedora-26-x86_64/root/etc/pki/mock
DEBUG util.py:112:  creating dir: /var/lib/mock/fedora-26-x86_64/root/etc/pki/mock
DEBUG util.py:109:  ensuring that dir exists: /var/lib/mock/fedora-26-x86_64/root/etc/dnf
DEBUG util.py:112:  creating dir: /var/lib/mock/fedora-26-x86_64/root/etc/dnf
DEBUG package_manager.py:107:  ['/usr/bin/dnf', '--installroot', '/var/lib/mock/fedora-26-x86_64/root/', '--releasever', '26', '--disableplugin=local', '--setopt=deltarpm=False', 'install', '@buildsys-build']
DEBUG util.py:606:  child environment: None
DEBUG util.py:533:  Executing command: ['/usr/bin/dnf', '--installroot', '/var/lib/mock/fedora-26-x86_64/root/', '--releasever', '26', '--disableplugin=local', '--setopt=deltarpm=False', 'install', '@buildsys-build'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8', 'LC_MESSAGES': 'C.UTF-8'} and shell False
DEBUG util.py:450:  Last metadata expiration check: 0:00:00 ago on Wed 02 Aug 2017 09:42:02 AM CEST.
DEBUG util.py:450:  failed calculating RPMDB checksum
DEBUG util.py:588:  Child return code was: 1
DEBUG util.py:197:  kill orphans
DEBUG util.py:606:  child environment: None
DEBUG util.py:533:  Executing command: ['/bin/umount', '-n', '/var/lib/mock/fedora-26-x86_64/root/var/cache/dnf/'] with env {'TERM': 'vt100', 'SHELL': '/bin/sh', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'LANG': 'en_US.UTF-8'} and shell False
DEBUG util.py:588:  Child return code was: 0

Setting the config mentioned by @22 worked for me too.

Comment 25 Miroslav Suchý 2017-08-06 21:37:51 UTC
*** Bug 1474125 has been marked as a duplicate of this bug. ***

Comment 26 Miroslav Suchý 2017-08-06 21:37:55 UTC
*** Bug 1476000 has been marked as a duplicate of this bug. ***

Comment 27 Miroslav Suchý 2017-08-06 21:43:55 UTC
While I can change all plugins in Mock, I do not feel it is correct. I would like to ask DNF to try to fix their debuginfo-install plugin first.

Comment 28 Jaroslav Mracek 2017-08-11 21:29:05 UTC
I create a patch that should solve the problem (https://github.com/rpm-software-management/dnf/pull/896). But the solution is in dnf.

Comment 29 Fedora Update System 2017-10-02 10:35:24 UTC
dnf-plugins-extras-2.0.3-1.fc27 dnf-plugins-core-2.1.4-1.fc27 dnf-2.7.2-1.fc27 libdnf-0.10.1-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 30 Fedora Update System 2017-10-02 10:38:23 UTC
dnf-plugins-extras-2.0.3-1.fc26 dnf-plugins-core-2.1.4-1.fc26 dnf-2.7.2-1.fc26 libdnf-0.10.1-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 31 Fedora Update System 2017-10-02 20:29:01 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 32 Fedora Update System 2017-10-02 21:28:15 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 33 Fedora Update System 2017-10-04 14:23:56 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 34 Fedora Update System 2017-10-04 22:25:56 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.