Hello All,
On today Scenario I will demonstrate how to recover from a non-responding SSHD.
where you are not able to ssh and log to your VM.
Sometimes it just not responding or got hang while our other bindings\listeners are working properly.
All we want is to restart the daemon and avoid restarting the entire VM.
In this Demo I will show 3 options to recover from that scenario.
Environment for this Test.
- Ubuntu 18.04 TLS (but it can fit any Distro)
- Running Standard D4s v3 (4 vcpus, 16 GB memory)
- Premium SSD
- Accelerated networking: Enabled
- Provider: Azure Resource Manager (ARM)
For this Demo I will kill the sshd Daemon (but we can use it when sshd is not responding or became unresponsive).
Confirm SSHD is not Responding.
Step by step instructions:
Option 1.[Run command]
1.go to the Azure Portal and navigate to the VM Blade and go to “Run command”
Enter the command [sudo service ssh restart]as you would on a console terminal and press Run.
And we are back In (the Output on the Portal will take some time).
Option 2 [Serial Console]
Navigate to the Azure Portal and navigate to the VM Blade and go to Serial Console
(First let me Kill the new Process)
Confirm SSHD is not Responding.
Enter the command [sudo service ssh restart]as you would on a console terminal .
Confirm ssh is enable and client can connect.
Option 3 [Custom Script extension]
Navigate to the Azure Portal and navigate to the VM Blade go the extensions and add Custom Script.
Let’s kill the process first.
Confirm SSHD is not Responding.
first let’s create an SH file
On my demo I used this name “restart_ssh.sh”
use you favorite editor vi/nano etc.
create a file and add the below.
Content of the script [restart_ssh.sh].
#!/bin/bash
#restart ssh Service
sudo service ssh restart
Notice that on the Command we should run “sh” against our script file name.
Confirm ssh is enable and client can connect.
If you get stuck during the Process or this debug is not for You.
Please raise a ticket to MS Support and of their engineer will be happy to assist mitigate the issue.
Thank You,
Tzachi Elkabatz
I dugg some of you post as I cogitated they were invaluable extremely helpful
I just want to say I am all new to blogs and certainly liked your page. Likely I’m planning to bookmark your site . You certainly come with great articles and reviews. Many thanks for sharing your webpage.
I just want to tell you that I’m beginner to weblog and truly liked this web page. Most likely I’m planning to bookmark your site . You actually have outstanding posts. Appreciate it for sharing with us your website.