It’s worth noting that even modern U.S. nuclear submarines have an emergency diesel generator (DG) and a snorkel mast that will allow the DG to be operated while submerged at periscope depth.
The DG is required to be operated periodically for maintenance. During long operational exercises, it may be weeks or months before the DG can be started up. There’s nothing quite like being at PD or driving on the surface in heavy seas with the DG running and the wind causing the exhaust fumes to be drawn inboard. Add in the flapper valve periodically shutting and popping everyone’s ears, and you have a surefire way to get most of the crew puking their guts out.