Same way as deck guns on any other ship, lots of regular maintenance. Remember that submarines with deck guns were basically surface ships most of the time.
When post-war submarines got significantly greater submerged capabilities (and for the US, working torpedoes), they ditched the deck guns and the crew just stayed inside.
Latest Answers