Excellent question! I look forward to the answers. I'm sure they carried a good selection of tools and spare parts for just about any contingency that could be expected at sea. As well, there were U-tankers and supply ships at sea that carried larger stores and tools and specialist mechanics. However, the Allies hunted them down one by one. In "Das Boot" there is a scene where they are doing some welding. Engine parts such as bearings would be stocked, you also see one being repaired or replaced in Das Boot.
__________________
|