Search This Blog

Thursday, May 2, 2013

HowTo fix yum error: unpacking of archive failed on nfs4 directory.

Bug 210945 – yum update gives error: unpacking of archive failed on file /home: cpio: chown

My Jenkins yum updates on Fedora 18 have been failing for a while. Finally have a fix that works.

My /var/lib/jenkins directory is an NFS4 mount to a local server.
The first error on yum update was chown permissions. This was fixed by no_root_squash on the server.
To duplicate, from root try to do a chown in /var/lib/jenkins.

(fix no-permission problem)
On the local server:

/srv  *(rw,fsid=0,sync,nohide,crossmnt,insecure,no_subtree_check,no_root_squash)
/srv/jenkins *(rw,sync,nohide,insecure,no_subtree_check,no_root_squash)

The next error on chown/cpio was "invalid argument". There are some older threads about a kernel problem and null characters in uid/gid, another about nfs4 problems etc. The best fix becomes avoiding the problem :)

(fix chown invalid argument problem in yum)

%_netsharedpath /var/lib/jenkins

At this point rpm will ignore doing chown's and yum is happy.

You might do the second step first to fix the yum problem, but the no_root_squash fix may avoid other problems if that is how you are using your mounted directory.

Some say no_root_squash is a security problem, so either lock down what servers can mount your directory (change * in /etc/exports above), or avoid the problem with netsharedpath.