Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 895101

Summary: busybox's rpm-install overwrites files non-atomically
Product: Red Hat Enterprise Linux 6 Reporter: Jan Ščotka <jscotka>
Component: busyboxAssignee: Denys Vlasenko <dvlasenk>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: medium    
Version: 6.4CC: kvolny, ohudlick, psklenar, tlavigne, todoleza
Target Milestone: rc   
Target Release: 6.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-21 17:01:55 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:
Bug Depends On:    
Bug Blocks: 990219, 1270638, 1359574, 1366045    
Attachments:
Description Flags
Proposed patch none

Description Jan Ščotka 2013-01-14 15:02:48 UTC
Description of problem:
Please improve test,
crash is caused by installing glibc, where, beaker, beakerlib is unstable (some window, where glibc is not complete) cause error of any binary started at time of installing

test should install glibc to changeroot, or something similar.
   Regards
   Honza

Comment 1 Karel Volný 2013-01-15 10:56:35 UTC
(In reply to comment #0)
> Description of problem:
> Please improve test,
> crash is caused by installing glibc, where, beaker, beakerlib is unstable
> (some window, where glibc is not complete) cause error of any binary started
> at time of installing
> 
> test should install glibc to changeroot, or something similar.

ahem, the test does exactly what it is supposed to do - reinstalling broken glibc using the busybox rpm applet, which does not depend on glibc (and so is not affected by the potential glibc breakage), is a supported recovery scenario; please see the original report ... I really do not understand how installing into chroot would help in system recovery

so if that breaks the system, it is not the test to blame

let's start by reassigning to busybox ... @Denys, please pass this to appropriate component (prelink maybe?) if you're sure the problem is not in busybox

@Hozna, please provide some example failure and logs to investigate, or how to reliably reproduce the problem

Comment 7 Denys Vlasenko 2013-02-20 15:25:59 UTC
Created attachment 700097 [details]
Proposed patch

busybox's rpm used to overwrite existing files by opening them with truncation.

Indeed, for shared libraries it isn't a good idea. The messages you are getting:
"ls: error while loading shared libraries: libc.so.6: ELF load command past end of file"
say that programs are trying to load libc.so.6 while it is only partially restored.

The attached patch makes busybox's rpm use the same method the standard rpm uses - create a temp file, write into it the full contents, then rename it, atomically replacing the old file.

open("util-linux-remote.pamd;3553", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0100644) = 4
read(3, "#%PAM-1.0\nauth       required     pam_securett"..., 681) = 681
write(4, "#%PAM-1.0\nauth       required     pam_securet"..., 681) = 681
close(4)                                = 0
rename("util-linux-remote.pamd;3553", "util-linux-remote.pamd") = 0

Comment 9 Denys Vlasenko 2016-09-07 17:17:19 UTC
devek_ack+. I don't know why devel_ack was cleared.