Ubuntu Azure and SSH

less than 1 minute read

After performing a dist-upgrade on an Azure hosted Ubuntu 13.10 VM and rebooting, the system stopped responding to ssh. The web application and database were both responding, so the server was definitely back up, but there was no way to access it via ssh. Forcing the system to reboot had no effect.

With some digging found this article which explains that during the update of ssh on Azure, the sshd package updates the /etc/ssh/sshd_config and combines 2 parameters on 1 line:

UsePAM yesClientAliveInterval 180

This makes the configuration invalid, and sshd refuses to start.

The only way to recover was either to rebuild (not an option in this case) or by mounting the VM OS Disk to another VM. After much struggling I was able to edit the sshd_config file and bring the original VM back online.

The primary hold up was having to delete the original VM while retaining the VHD so that the new VM could mount it. Having Cloud Services named the same as the VM also causes problems when recreating the VM as the name is already taken. The Cloud Service must be delete before recreating the VM.