The song was recorded for an outgoing corps commander, but has taken on a new significance after the vessel sank, with all on board killed.
The crew, including submarine commander Heri Oktavian, were filmed singing ‘Sampai Jumpa’, an Indonesian pop song meaning “See you later”.
“Even though I’m not ready to be missing you, I’m not ready to live without you,” the crew sings.
“I wish all the best for you.”
The video was posted on Instagram by the song’s composer, Erik Soekamti.
“Goodbye hero,” he wrote.
The submarine had been conducting a torpedo drill north of Bali when it disappeared.
The navy has now found the remains of the submarine on the bottom of the ocean, broken into three pieces.
The ocean floor at that point is more than 800m, more than four times the depth the submarine is able to dive.
Indonesia’s Defence Minister Prabowo Subianto offered his condolences to the families of those killed.
“The deepest condolences for the tragedy that befell KRI Nanggala 402. All the soldiers who died were the best sons of the nation,” he wrote on Twitter.
“KRI Nanggala 402, safe sailing towards immortality.”
Emergency survival suits were found drifting underwater, indicating crew members took them out of their boxes during the emergency.
The cause of the disaster is not yet known, though the navy suggested an electrical blackout may be responsible.
The two Australian warships, HMAS Ballarat and HMAS Sirius were both dispatched to help, after Indonesia accepted the Federal Government’s offer of assistance.
The submarine disappeared on Wednesday, and officials said on Saturday that the vessel’s oxygen would have run out after three days.
But given the submarine was found in several pieces, it is quite likely the crew would have died very quickly.