Bug 1441636 - --installroot against non-existent rpm database no longer works
Summary: --installroot against non-existent rpm database no longer works
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-12 11:40 UTC by Alex Kanavin
Modified: 2017-05-05 13:34 UTC (History)
6 users (show)

Fixed In Version: dnf-2.4.0-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-05 13:34:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alex Kanavin 2017-04-12 11:40:29 UTC
When using to dnf to build a root filesystem from scratch, the following error occurs:

ERROR: core-image-sato-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/dnf -y -c /home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/yum.repos.d --repofrompath=oe-repo,/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo --installroot=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs --setopt=logdir=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp makecache' returned 1:
error: cannot open Packages database in /var/lib/rpm
Error: Error: rpmdb open failed

This used to work, and the offending commit has been identified by bisection to be https://github.com/rpm-software-management/dnf/commit/3ddf684b7c67a2b384aa99dde53d8a43218f2e68

If I added a --releasever=oe-core explicitly to the command line, a different issue happens:

ERROR: core-image-sato-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/dnf -y -c /home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/yum.repos.d --repofrompath=oe-repo,/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo --installroot=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs --setopt=logdir=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp --releasever=oe-core makecache' returned 1:
Added oe-repo repo from /home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo
failed calculating RPMDB checksum

Comment 1 Alex Kanavin 2017-04-12 12:45:31 UTC
I can confirm that if the above commit is reverted, the issue disappears. I'll adopt that as a temporary fix.

Comment 2 Jaroslav Mracek 2017-04-19 12:55:38 UTC
Please can you little bit narrow the problem. Please can you try to remove as much as possible options from command and find minimal reproducer?
Thanks a lot

Comment 3 Alex Kanavin 2017-04-19 13:10:04 UTC
In Yocto context we need all of these switches to avoid contamination of dnf configuration from the host (if the host distro happens to use dnf/rpm).

I guess you can have a minimal reproducer by:
a) having a system that is not using dnf/rpm, i.e. debian, so /var/lib/rpm is absent (maybe temporarily renaming that dir will work too).
b) running 'dnf --installroot=<dir> makecache' where <dir> exists, but is empty.

I'll try to verify if that works on my machine a bit later.

Comment 4 Alex Kanavin 2017-04-20 12:48:58 UTC
(In reply to Alex Kanavin from comment #3)
> I guess you can have a minimal reproducer by:
> a) having a system that is not using dnf/rpm, i.e. debian, so /var/lib/rpm
> is absent (maybe temporarily renaming that dir will work too).
> b) running 'dnf --installroot=<dir> makecache' where <dir> exists, but is
> empty.
> 
> I'll try to verify if that works on my machine a bit later.

I can now confirm this. You can even drop 'makecache':

# dnf --installroot=/home/ak/development/poky/build-64/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
error: cannot open Packages database in /var/lib/rpm
Error: Error: rpmdb open failed

Comment 5 Jaroslav Mracek 2017-04-20 16:44:33 UTC
Please what is in directory  /var/lib/rpm and is the directory existing?

Comment 6 Alex Kanavin 2017-04-20 16:55:43 UTC
The directory doesn't exist.

Comment 7 Alex Kanavin 2017-04-20 17:06:04 UTC
Even if it did exist, it should not be accessed when --installroot is in use, as Yocto is cross-compiling for an entirely different system (that includes building own versions of rpm and dnf), and so we don't want any information from the host to contaminate the build.

Comment 8 Jaroslav Mracek 2017-04-21 14:08:11 UTC
Ok, first problem appears when you don't have a permissions for directory where you search for rpmdb. The second issue in Comment 1 I still cannot reproduce

Comment 9 Jaroslav Mracek 2017-04-24 10:56:21 UTC
Both problems should be solved by my pull-request https://github.com/rpm-software-management/dnf/pull/793. Thanks for your report.

Comment 10 Alex Kanavin 2017-04-24 13:30:24 UTC
I can confirm that the above commits fix the issue. Thanks!

Comment 11 Fedora Update System 2017-05-02 15:40:24 UTC
dnf-plugins-core-2.0.0-1.fc26 libdnf-0.8.2-1.fc26 dnf-2.4.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4e95959f0d

Comment 12 Fedora Update System 2017-05-04 09:48:31 UTC
dnf-2.4.0-1.fc26 dnf-plugins-core-2.0.0-1.fc26 dnf-plugins-extras-2.0.0-1.fc26 libdnf-0.8.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4e95959f0d

Comment 13 Fedora Update System 2017-05-04 22:04:52 UTC
dnf-2.4.0-1.fc26, dnf-plugins-core-2.0.0-1.fc26, dnf-plugins-extras-2.0.0-1.fc26, libdnf-0.8.2-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-4e95959f0d

Comment 14 Fedora Update System 2017-05-05 13:34:27 UTC
dnf-2.4.0-1.fc26, dnf-plugins-core-2.0.0-1.fc26, dnf-plugins-extras-2.0.0-1.fc26, libdnf-0.8.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


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