why does yum/rpm update fails with unpacking of archive failed on file /abc/xyz cpio: rename failed - Device or resource busy ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7.

Issue

  • Installation using yum/rpm fails for updaing packages.
# rpm -Uvh redhat-release-server-7.4-18.el7.x86_64.rpm

Preparing...                          ################################# [100%]
Updating / installing...
   1:redhat-release-server-7.4-18.el7 ################################# [ 50%]
error: unpacking of archive failed on file /etc/os-release;5ad66a48: cpio: rename failed - Device or resource busy
error: redhat-release-server-7.4-18.el7.x86_64: install failed
error: redhat-release-server-7.3-7.el7.x86_64: erase skipped

Resolution

1. check if any process is holding the os-release file.

# ps -aux | grep -release

2. Stop the process which is holding the os-release file. If any application is holding the file then check if the application can be stopped. Ask the application team to stop it. Check if the process can be killed with the application team if needed.

# kill -9 <pid>

Note:- check with the relevant application to kill the process.

3. Update the redhat-release-server package.

# rpm -Uvh /path/to/<redhat-release-server-7.5-8.el7.x86_64.rpm>

Root Cause

  • The Docker application was holding the os-release file.
# ps -aux | grep release
replica+  2011  0.0  0.0 576640 15744 ?        Ssl  Aug04   0:37 /usr/bin/docker run --name=replicated-operator -u 59842:992 -v /var/lib/replicated-operator:/var/lib/replicated-operator -v /var/run/replicated-operator:/var/run/replicated-operator -v /var/run/docker.sock:/host/var/run/docker.sock -v /proc:/host/proc:ro -v /etc:/host/etc:ro -v /etc/os-release:/host/etc/os-release:ro -e DAEMON_ENDPOINT= <IP Address>:9879 -e DAEMON_TOKEN=xxESv20JKRXZjh75WEHfqG89ORa5ir -e NO_PROXY=<Ip_address> -e PRIVATE_ADDRESS=<IP_address> -e TAGS=Common,Core -e LOG_LEVEL=info -e NODENAME=ip-<ipadde\ress>.test.domain.com quay.io/replicated/replicated-operator:current
root     15310  0.0  0.0 112708   980 pts/1    S+   23:37   0:00 grep --color=auto release

Diagnostic Steps

  • The yum/rpm command unable to install/update the redhat-release-server package giving the below error.
# rpm -Uvh redhat-release-server-7.5-8.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1: redhat-release-server-7.5-8.el7 ################################# [ 50%]
error: unpacking of archive failed on file /etc/os-release;5ad66a48: cpio: rename failed - Device or resource busy
error: redhat-release-server-7.5-8.el7.x86_64: install failed
error: redhat-release-server-7.3-7.el7.x86_64: erase skipped

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments