Thursday 28 February 2013

patchadd -p lists the uninstalled patch

Hi,

Today i had this weird problem while installing a patch in Solaris 10.

I tried to install a patch called  100000-91 , but  it throwed me an error stating the higher version of the patch is installed. Below is the trace.
[root@madhu] $ cd /tmp/100000-91/
[root@madhu] $ /usr/sbin/patchadd .
Validating patches...
Loading patches installed on the system...
Done!
Loading patches requested to install.
Done!
Checking patches that you specified for installation.
Done!
Approved patches will be installed in this order:
100000-91
Checking installed patches...
A later version of 100000 has already been installed
Patchadd is terminating.

I executed the below command to list the patches installed in the system
[root@madhu] $ showrev -p
Patch: 100000-78
Patch: 100000-88
Patch: 100000-90

This looks fine as 100000-90 is not higher that 100000-91, then i know there is another command to list the patches installed in the system.
[root@madhu] $ /usr/sbin/patchadd -p
Patch: 100000-78
Patch: 100000-88
Patch: 100000-90
Patch: 100000-225

There is a difference between both these commands , now i can see 100000-225 patch is listed as installed. I will go-ahead and remove it.
[root@madhu] $ /usr/sbin/patchrm 100000-225
Validating patches...
Loading patches installed on the system...
Done!
Patch 100000-225 does not exist.

This is weird , the "patchadd -p" lists the 100000-225 as installed, but the patchrm says it does not exists. The patchadd and showrev fetches this information from the pkginfo file located in the subdirectories/var/sadm/pkg . I found the appropriate subdirectory for this patch and found it had the below entry in it.
PATCH_INFO_100000-225=backed out

Ok, this means the pkginfo says it's uninstalled, but why does patchadd lists it and showrev doesn't . Then i noted there was a hidden directory ".save.madhupatch" inside /var/sadm/pkg  and noted it's pkginfo file had the below entry.
PATCH_INFO_100000-225=Installed: Thu Aug 23 10:17:53 GMT 2012

Now i can understand that , patchadd refers this file instead of the other pkginfo which has the right information. I removed ".save.madhupatch" from /var/sadm/pkg . Then i was able to install  100000-91 patch in the system.

Note : I didn't figure out how and why this hidden directory exists and why the output of showrev and patchadd is different. Those areas are yet to explore.

Reference : http://bit.ly/XEXZZo