RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1822953 - Failure installing a base system in an installroot after executing "unshare -Ur"
Summary: Failure installing a base system in an installroot after executing "unshare -Ur"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rpm
Version: 8.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 8.0
Assignee: Packaging Maintenance Team
QA Contact: swm-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-10 16:00 UTC by Renaud Métrich
Modified: 2020-04-24 11:06 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-24 11:06:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2020-04-10 16:00:11 UTC
Description of problem:

In order to set up an installroot while not switching to root user, I use the "unshare -Ur" command to get a fakeroot environment.

From there, installing an installroot with "python3-libs" fails, because for some unknown reason, the build-id file is installed in the target directory but the target directory is not created.

Also, no detail is shown at all:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  Installing       : python3-libs-3.6.8-15.1.el8.x86_64                                          158/158 
Error unpacking rpm package python3-libs-3.6.8-15.1.el8.x86_64
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Other failures are seen but due to BZ #1822951.


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

libdnf-0.35.1-9.el8_1.x86_64 but also on latest Fedora 31


How reproducible:

Always


Steps to Reproduce:
1. Execute unshare as my user

  $ unshare -Ur
  # echo $$
  1442

  (now the fake root user)

2. Download the packages

  # dnf --installroot=$PWD/FOO --releasever=/ install python3-libs --downloadonly

3. As real root user, from another terminal, strace the terminal that will execute dnf command (1442 in step 1)

  # strace -fttTvyy -o dnf_unshare.strace -s 1024 -p 1442

4. As fake root user, install the packages

  # dnf --installroot=$PWD/FOO --releasever=/ install python3-libs --noplugins --setopt=tsflags=noscripts


Actual results:

Installing       : python3-libs-3.6.8-15.1.el8.x86_64                                          158/158 
Error unpacking rpm package python3-libs-3.6.8-15.1.el8.x86_64


Expected results:

No error.


Additional info:

The strace shows that build-id file is created but directory doesn't exist:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# grep "/usr/lib/.build-id/1e" dnf_unshare.strace 
2790  17:31:40.080800 stat("/usr/lib/.build-id/1e/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000005>
2790  17:31:40.153844 stat("/usr/lib/.build-id/1e/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000004>
2790  17:31:44.659004 stat("/usr/lib/.build-id/1e/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000004>
2790  17:31:44.724471 stat("/usr/lib/.build-id/1e/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000004>


2790  17:32:30.208850 symlink("../../../../usr/lib64/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.so", "/usr/lib/.build-id/1e/3841e2bc8237319f030b8c6aaa9dacfbf611d4;5e90915f") = -1 ENOENT (No such file or directory) <0.000011>

---> HERE ABOVE

2790  17:32:30.208889 lstat("/usr/lib/.build-id/1e/3841e2bc8237319f030b8c6aaa9dacfbf611d4;5e90915f", 0x7ffd19fd12c0) = -1 ENOENT (No such file or directory) <0.000006>
2790  17:32:30.208916 unlink("/usr/lib/.build-id/1e/3841e2bc8237319f030b8c6aaa9dacfbf611d4;5e90915f") = -1 ENOENT (No such file or directory) <0.000006>
2790  17:32:30.210722 write(26</tmp/tmp98ggn8ap>, "error: unpacking of archive failed on file /usr/lib/.build-id/1e/3841e2bc8237319f030b8c6aaa9dacfbf611d4;5e90915f: cpio: symlink\n", 128) = 128 <0.000016>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

For other .build-id files from other packages or same package, when the directory /usr/lib/.build-id/XX doesn't exist, it is created, as shown in the example below:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# grep "/usr/lib/.build-id/10" dnf_unshare.strace 
2790  17:31:40.153462 stat("/usr/lib/.build-id/10/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000004>
2790  17:31:44.724076 stat("/usr/lib/.build-id/10/", 0x7ffd19fd1400) = -1 ENOENT (No such file or directory) <0.000004>
2790  17:32:30.205547 lstat("/usr/lib/.build-id/10", 0x7ffd19fc12b0) = -1 ENOENT (No such file or directory) <0.000010>
2790  17:32:30.205578 mkdir("/usr/lib/.build-id/10", 0700) = 0 <0.000040>
2790  17:32:30.205660 chown("/usr/lib/.build-id/10", 0, 0) = 0 <0.000009>
2790  17:32:30.205687 chmod("/usr/lib/.build-id/10", 0755) = 0 <0.000008>
2790  17:32:30.205713 utimensat(AT_FDCWD, "/usr/lib/.build-id/10", [{tv_sec=1570808701, tv_nsec=0} /* 2019-10-11T17:45:01+0200 */, {tv_sec=1570808701, tv_nsec=0} /* 2019-10-11T17:45:01+0200 */], AT_SYMLINK_NOFOLLOW) = 0 <0.000008>
2790  17:32:30.205843 lsetxattr("/usr/lib/.build-id/10", "security.selinux", "system_u:object_r:lib_t:s0", 27, 0) = 0 <0.000018>
2790  17:32:30.206170 symlink("../../../../usr/lib64/python3.6/lib-dynload/_sha3.cpython-36m-x86_64-linux-gnu.so", "/usr/lib/.build-id/10/8ca21d53862c09d7c6f67c2030aaf6e21cb2f0;5e90915f") = 0 <0.000044>
...
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


This doesn't happen when the real root user is used.

Comment 1 Marek Blaha 2020-04-24 10:34:47 UTC
Errors mentioned originated in rpm and I think there are some problems with running rpm in fakeroot environment.
Please could someone from rpm team look into this? Thanks.

Comment 2 Panu Matilainen 2020-04-24 11:06:35 UTC
> --setopt=tsflags=noscripts

That's not a supported way to install and going to work, NOTABUG.

There are multiple preceding errors in the transaction leading up to this. I wasn't able to reproduce this exact failure mode but then the details would depend on exact versions of packages being installed etc, the main culprit is that without filesystem %pretrans script, the filesystem will not be what other parts expect and things go downhill from there.


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