I came across an interesting problem recently with the CentOS Linux server I use to host this blog. I encountered a problem when upgrading from CentOS 5.4 to 5.5. I had performed this upgrade on a fair number of physical servers without issue but this was the first time I was upgrading a XEN based VPS running CentOS.

Every package upgraded without an issue expect for rpm itself which error-ed out as detailed below;

[root@michaelfmcnamara sysconfig]# yum update rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: yum.singlehop.com
* base: yum.singlehop.com
* extras: mirror.raystedman.net
* updates: mirror.skiplink.com
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package rpm.i386 0:4.4.2.3-18.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
Package                 Arch                     Version                              Repository                Size
======================================================================================================================
Updating:
rpm                     i386                     4.4.2.3-18.el5                       base                     1.2 M

Transaction Summary
======================================================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
rpm-4.4.2.3-18.el5.i386.rpm                                                                    | 1.2 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating       :rpm                                                                    1/2
Error unpacking rpm package rpm-4.4.2.3-18.el5.i386
error: unpacking of archive failed on file /etc/cron.daily/rpm: cpio: rename

Failed:
rpm.i386 0:4.4.2.3-18.el5

Complete!

So what was wrong with /etc/cron.daily/rpm that the package was failing to install.

Wouldn’t you know that the immutable attribute had been set on the file?

[root@michaelfmcnamara ~]# lsattr /etc/cron.daily/rpm
----i-------- /etc/cron.daily/rpm

Let’s remove that attribute;

root@michaelfmcnamara ~]# chattr -i /etc/cron.daily/rpm

With that fixed let’s try running that update again;

[root@michaelfmcnamara cron.daily]# yum update rpm
Loaded plugins: fastestmirror
Determining fastest mirrors
* addons: yum.singlehop.com
* base: yum.singlehop.com
* extras: mirror.raystedman.net
* updates: mirrors.netdna.com
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package rpm.i386 0:4.4.2.3-18.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
Package                 Arch                     Version                              Repository                Size
======================================================================================================================
Updating:
rpm                     i386                     4.4.2.3-18.el5                       base                     1.2 M

Transaction Summary
======================================================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
rpm-4.4.2.3-18.el5.i386.rpm                                                                    | 1.2 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating       : rpm                                                                                            1/2
Cleanup        : rpm                                                                                            2/2

Updated:
rpm.i386 0:4.4.2.3-18.el5

Complete!

Success!