Description of problem: dnf install --installroot=… reports error in scriptlets: Running scriptlet: rpm-4.17.0-8.fc36.x86_64 202/334 /var/tmp/rpm-tmp.9pzeVc: line 3: mkdir: command not found /var/tmp/rpm-tmp.9pzeVc: line 4: sort: command not found Installing : rpm-4.17.0-8.fc36.x86_64 202/334 If it can't be rewritten in lua, then please at least redirect all errors to /dev/null. Version-Release number of selected component (if applicable): rpm-4.17.0-8.fc36.x86_64 How reproducible: deterministic Steps to Reproduce: 1. sudo dnf install --releasever=rawhide --repo=fedora --installroot=/var/tmp/f36-test3 rpm --nogpgcheck --setopt install_weak_deps=False (With this reproducer I get just "find: command not found".)
How in the world is this happening? This scriptlet only runs if "/var/lib/rpm" as a directory exists. What is creating that directory before rpm migrates it?
And after I write this, I know why... *sighs* The joys of installroot... It's easy enough to fix by adding some Requires(pre) statements.
PR submitted: https://src.fedoraproject.org/rpms/rpm/pull-request/23 Once merged, the rawhide branch can be fast-forwarded onto the f36 branch to fix this.
PR merged and updated packages built in F36 and Rawhide now.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle. Changing version to 37.
On F38 (Rawhide): $ /usr/bin/dnf5 --installroot /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root/ --releasever 38 install rpm ... Running transaction [1/2] Verify package files 100% | 133.0 B/s | 167.0 B | 00m01s >>> Running pre-transaction scriptlet: filesystem-0:3.18-2.fc37.x86_64 >>> Stop pre-transaction scriptlet: filesystem-0:3.18-2.fc37.x86_64 [2/3] Prepare transaction 100% | 1.1 KiB/s | 167.0 B | 00m00s >>> Running pre-install scriptlet: rpm-0:4.18.0-9.fc38.x86_64 >>> Stop pre-install scriptlet: rpm-0:4.18.0-9.fc38.x86_64 >>> Error in pre-install scriptlet: rpm-0:4.18.0-9.fc38.x86_64 return code 2 ... Transaction failed: Rpm transaction failed.
PR: https://src.fedoraproject.org/rpms/rpm/pull-request/34
Ehm, this is an old bug long since fixed. Please open a new bug because it's not the same at all now. Note that adding a bash dependency to a regular scriptlet will achieve precisely nothing because /bin/sh is already an interpreter-dependency on it. (but then, I see no indication that missing bash is the cause in the latest message either)
As shown, filesystem.rpm'đ %pretrans is executed first, and right after that then rpm.rpm's %pre. This is a fresh --installroot transaction, therefore I'm curious how do you guarantee that bash is installed first in the transaction.
It wasn't entirely clear from that snippet, but yeah I can reproduce. That's not going to be fixed by adding dependencies to rpm because it already has everything it needs. Rpm getting installed first in this scenario is entirely backwards, it's supposed to be installed *last* or almost so based on dependencies. If you compare the behavior with older dnf, that's exactly what happens. What you're seeing smells like a dnf5 bug. Please open a new bug on this and cc me on it.
In the meanwhile, the original issue has been fixed long since but the bug never got closed.
Oh and no, it does not need converting to Lua. Rpm has no %pretrans script (which is the thing *requiring* Lua) and is not a part of the early "bootstrap" set of packages (glibc,setup,filesystem etc) so there's nothing to gain from converting the script.