Yum or rpm stuck with stale NFS mount

I was trying to upgrade one of the server’s PHP from PHP 5.2.x to PHP 5.3.x but no matter what I do, both yum and rpm gets stuck in the middle. I’ve spent two days trying to figure it out until I’ve found an article about stale NFS mount affecting yum.

Note: This is a CentOS 5.6 server.

Force unmount the NFS mounted directory

First, I disabled/stopped the nfs daemon, although I’m not sure if it matters. Next, I opened /etc/fstab and commented out the NFS mount entry. The next thing I do was force unmount the NFS directory.

umount -f /mount/point

However, get this “device busy” error.

umount -f /mount/point
umount: /mount/point: device is busy
umount: /mount/point: device is busy

The next thing I do, which I don’t remember which command successfully umounted the NFS mount.

umount -a; mount -a

I’m not sure if that works 100% but I do this command next (unmount with lazy option).

umount -f -l /mount/point

Cleanup yum locks and cache

Once I am sure that there is no more stale NFS mount hanging around, I proceed to upgrade PHP via yum. To know that there is no more stale NFS mount, execute this command.

mount
df -h

The above command will display all mounted filesystem so you could verify that no NFS mount entry exists. The next command will display the filesystem usage. If you have a stale NFS mount, that command will get stuck as well. If it doesn’t get stuck, then all is good.

Before we proceed with the upgrade procedure, we need to cleanup yum locks and cache. Do the following.

/bin/rm /var/lib/rpm/__db.*
cd /var/cache/yum
/bin/rm -rf *
yum clean all
yum update

To make sure that everything is working before proceeding with upgrading PHP, I tried to install some small program just to make sure. Luckily, it installs without problem.

yum install htop

That’s it. Upgrading to PHP 5.3.x could be tricky but I’ve found many resources. Below is what I use and it is pretty good.

Upgrade PHP 5.1/5.2 to 5.3 on CentOS by chrisjean.com/.

For rackspace users, you may try this:

Rackspace knowledge center – How to install/upgrade PHP 5.3 for CentOS 5.x.

Enjoy and share!

This entry was posted in Linux, php and tagged , , , , , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *