The Horror!

Last updated: Sat, 25 Apr 2009 01:43:00 GMT

More eye-gouging awfulness courtesy of Sun kernel patch 137138-09.

I'm applying the patchset from EIS DVD 31MAR09. Of course, I'm using PCA to install them from a repository created by my own mkpcadir script. As per my usual, I've installed all of the live patches first, using PCA's --noreboot option. Then I've taken the machine down to single user and applied the first run of patches, using PCA's --stop option to quit after the first kernel patch, which just happens to be 137138-09.

I'm not being particularly careful because for some reason I trust Sun and their EIS patch sets not to F me in the A.

Big mistake.

As per these guys' experience, I end up three hours later with a machine that's obviously hung in single user.

No choice but to reboot. Gnarliness, panics, reboot to failsafe, obliterate other half of mirror, rebuild boot archive, reboot to single user.

Okay, I'm at that point. I've recovered. Time to back out 137138-09 and try again.

No dice.

No combination of booting to failsafe and using -R, using -f to force, convinces patchrm that it should remove this patch. Why? Because it's not fully applied, it says. I should use patchadd to re-apply it, it says.

Except that that doesn't work either: according to patchadd this patch has already been fully applied.

Awesome.

I need to fool the patch system one way or the other: that the patch hasn't been applied, and so can be applied again; or that the patch has been removed, and so can be applied "again".

Here's how:

# tar cvf /var/tmp/pkginfo_137138.tar /var/sadm/pkg/*/pkginfo
# for f in /var/sadm/pkg/*/pkginfo
> do
> 	perl -p -i -e 's/^PATCH_INFO_137138-09=Installed.*$/PATCH_INFO_137138-09=backed out/' ${f}
> done
# patchadd -u 137138-09

In essence, back up the pkg repository files we're about to mangle, mangle them to fake a back-out, then re-apply the patch unconditionally with the -u switch.

From here on in, I can continue to apply the rest of the patch set. No problems so far, touch wood...

I've no idea why patchadd can't be forced to re-apply a patch that it "knows" has been applied already. I've no idea why patchrm can't be forced to remove partially-applied patches. I've no idea why a patch that was known to be broken four months ago is still being distributed by Sun, to their Platinum customers.