Refine hold/unhold behavior in pkg.installed state

This adds exception handling to more gracefully report on problems
encountered while attempting to hold packages.

I'd like to have @garethgreenaway test this a bit to see if I overlooked anything. It should be mostly straightforward, though.