Updating the filesystem package fails with error "unpacking of archive failed on file /mnt: cpio: chown failed"

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7, 8
  • filesystem rpm
  • installing updates, upgrade

Issue

  • While updating or upgrade of filesystem package, the error message "unpacking of archive failed on file /mnt: cpio: chown failed -
    Read-only filesystem" appears.

    yum update filesystem
    Upgrade  1 Package
    Total download size: 1.0 M
    Is this ok [y/d/N]: y
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Updating   : filesystem-3.2-20.el7.x86_64                                                                                                 1/2 
    Error unpacking rpm package filesystem-3.2-20.el7.x86_64
    error: unpacking of archive failed on file /mnt: cpio: chmod
    Verifying  : filesystem-3.2-20.el7.x86_64                                                                                               1/2 
    filesystem-3.2-18.el7.x86_64 was supposed to be removed but is not!
    Verifying  : filesystem-3.2-18.el7.x86_64                                                                                               2/2 
    
    Failed:
    filesystem.x86_64 0:3.2-18.el7                                       filesystem.x86_64 0:3.2-20.el7                                      
    
    Complete!
    

Resolution

  • Avoid mounting filesystems directly to /mnt directory.

    • Unmount active mount from /mnt before updating the filesystem RPM or performing a system upgrade to avoid this situation.
    # umount /mnt
    
    • Confirm that /mnt is unmounted by the following
    # mount | grep mnt
    
    • Update the package
    # yum update filesystem
    

Root Cause

The filesystem package contains the basic directory structure for RHEL, including the default ownerships and permissions of the directories. The directory /mnt is one of those basic directories. Changing permissions of a mounted directory will not affect the mount point itself, but the root directory of the filesystem that has been mounted. In case it is mounted read-only, the change of ownership and permissions will fail. Subsequently, this leads to RPM reporting an error while installing the filesystem package.

According to Convention the mountpoints are supposed to be subdirectories of /mnt, not /mnt itself.

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