Bug 1491786

Summary: rpm incorrectly estimates required disk space for RPM package with hard links
Product: Red Hat Enterprise Linux 7 Reporter: jcastran
Component: rpmAssignee: Pavlina Moravcova Varekova <pmoravco>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: aburch, dmach, emrakova, Eric.Michaelis, ffesti, james.antill, kwalker, mdomonko, pmatilai, pmoravco, rbobek
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: rpm-4.11.3-36.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 13:11:23 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: 1630909, 1630918, 1654474    

Description jcastran 2017-09-14 16:29:34 UTC
Description of problem:
Yum is not properly verifying that there is sufficient capacity in the root filesystem when the root filesystem is low on disk space.

If the root filesystem is low on space, it starts the update but runs out of space during the installation of the RPMs. Yum then fails, leaving the system in a corrupted state.


Version-Release number of selected component (if applicable):
 yum-3.4.3-150.el7.noarch
 kernel-3.10.0-514.6.2.el7.x86_64 (RHEL 7.3)

How reproducible:
-

Steps to Reproduce:
1.1. Build a server with our standard layout including a  3G root filesystem
2. Create a 1.5G file in /usr
	dd if=/dev/urandom of=/usr/bigfile bs=1024k count=1500
3. Update the server:
    yum clean all && yum update -y


Actual results:
RPM installation then fails, leaving packages broken and in an consistent state. The server is then broken; processes no longer can run because dependent libraries are not installed or are installed in inconsistent versions.

Expected results:
Yum transaction check accurately determines if there is enough space before installing packages.





~~~~~~~~~~~~~~~~~~Additional info~~~~~~~~~~~~~~~~~~
On a freshly installed RHEL7.3 machine:

~~~
# df -B1 /
Filesystem                      1B-blocks      Used  Available Use% Mounted on
/dev/mapper/rhel-root          3210215424 971796480 2238418944  31% /
#
~~~

Calculating the space needed for the /usr/bigfile:

~~~
# echo $((2238418944-237072384))
2001346560
# echo $((2001346560/1024/1024))
1908
# dd if=/dev/urandom of=/usr/bigfile bs=1024k count=1908
1908+0 records in
1908+0 records out
2000683008 bytes (2.0 GB) copied, 104.975 s, 19.1 MB/s
# df -B1 /
Filesystem             1B-blocks       Used Available Use% Mounted on
/dev/mapper/rhel-root 3210215424 2972479488 237735936  93% /
#
~~~

Making a little less space:

~~~
# dd if=/dev/urandom of=/usr/bigfile bs=1024k count=1909
1909+0 records in
1909+0 records out
2001731584 bytes (2.0 GB) copied, 104.584 s, 19.1 MB/s
# df -B1 /
Filesystem             1B-blocks       Used Available Use% Mounted on
/dev/mapper/rhel-root 3210215424 2973528064 236687360  93% /
#
~~~

Trying to reproduce:

~~~
# yum update -y
... snip ...
Install   10 Packages (+31 Dependent packages)
Upgrade  199 Packages

Total download size: 214 M
... snip ..

 Updating   : bash-4.2.46-28.el7.x86_64                                                                                                                                                                                               13/444 
  Updating   : nss-softokn-freebl-3.28.3-6.el7.x86_64                                                                                                                                                                                  14/444 
  Updating   : glibc-common-2.17-196.el7.x86_64                                                                                                                                                                                        15/444 
/usr/sbin/build-locale-archive: cannot add to locale archive: No such file or directory
/usr/sbin/build-locale-archive: cannot add to locale archive: No such file or directory
  Updating   : glibc-2.17-196.el7.x86_64                                                                                                                                                                                               16/444 
Error unpacking rpm package glibc-2.17-196.el7.x86_64
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
error: unpacking of archive failed on file /lib64/libc-2.17.so;5989c491: cpio: write
  Updating   : libstdc++-4.8.5-16.el7.x86_64                                                                                                                                                                                           17/444 
Error unpacking rpm package libstdc++-4.8.5-16.el7.x86_64
error: glibc-2.17-196.el7.x86_64: install failed
error: unpacking of archive failed on file /usr/lib64/libstdc++.so.6.0.19;5989c491: cpio: lsetfilecon
  Updating   : pcre-8.32-17.el7.x86_64                                                                                                                                                                                                 18/444 
Error unpacking rpm package pcre-8.32-17.el7.x86_64
error: libstdc++-4.8.5-16.el7.x86_64: install failed
error: unpacking of archive failed on file /usr/lib64/libpcre.so.1;5989c491: cpio: symlink
  Updating   : libselinux-2.5-11.el7.x86_64                                                                                                                                                                                            19/444 
error: pcre-8.32-17.el7.x86_64: install failed
warning: %triggerin(cronie-1.4.11-14.el7_2.1.x86_64) scriptlet failed, signal 11
... snip ...
#

Comment 23 Karel Srot 2019-05-29 06:18:48 UTC
I have updated the bug summary to better reflect what is being addressed.

Comment 27 errata-xmlrpc 2019-08-06 13:11:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:2259