Originally posted by mfd I had a K100d.
The K100D should have two solenoids of the "good" quality: one is in the aperture mechanism, the other opens the pop-up flash.
If you still have it, you can cannibalize the one from the pop-up flash release system and swap it with the bad one in your K-30.
Who cares if you have to push a button a couple of times in order to open the flash - on a very old camera, no less?
Edit: as detailed here by a forum member:
https://www.pentaxforums.com/forums/151-pentax-k-30-k-50/340762-k-50-k-500-a...-diy-pics.html