{"id":5480,"date":"2015-12-25T16:11:32","date_gmt":"2015-12-25T08:11:32","guid":{"rendered":"http:\/\/rmohan.com\/?p=5480"},"modified":"2015-12-25T16:35:28","modified_gmt":"2015-12-25T08:35:28","slug":"restart-all-services-on-esxi-through-ssh","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5480","title":{"rendered":"Restart all services on ESXi through SSH"},"content":{"rendered":"<p>When you are not able to connect ESXi server to vCenter, or when you cannot connect to ESXi server from VI client it may be necessary to <strong>restart the management agents<\/strong> on <strong>ESX or ESXi host<\/strong>. In today\u2019s post called\u00a0How to restart management agents on ESX or ESXi host we will learn this.<\/p>\n<p>You might want to follow this little how to article showing you the way doing it. <strong>For the restart of the management agents<\/strong> (<strong>mgmt-vmware<\/strong> and <strong>vmware-vpxa<\/strong>) directly on <strong>ESX\/ESXi <\/strong><strong>ESXi 4 and 5.x or ESXi 6.x <\/strong>you will have to do the following:<strong><br \/>\n<\/strong><\/p>\n<h3>To restart the management agents on ESXi 6.x<\/h3>\n<p>Log in to SSH or Local console as root.<br \/>\nRun these commands:<\/p>\n<blockquote><p>\/etc\/init.d\/hostd restart<br \/>\n\/etc\/init.d\/vpxa restart<\/p><\/blockquote>\n<p>Or also (alternative way)<br \/>\nTo reset the management network on a specific VMkernel interface, by default vmk0, run the command:<\/p>\n<blockquote><p>esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0<\/p><\/blockquote>\n<p>Note: Using a semicolon (;) between the two commands ensures the VMkernel interface is disabled and then re-enabled in succession. If the management interface is not running on vmk0, change the above command according to the VMkernel interface used.<\/p>\n<p>To restart <strong>all<\/strong> management agents on the host, run the command:<\/p>\n<blockquote><p><span class=\"skimlinks-unlinked\">services.sh<\/span> restart<\/p><\/blockquote>\n<h3>How to restart the Management agents on ESXi Server \u2013 via the console:<\/h3>\n<p><strong>1.) Connect to the console<\/strong> of your <strong>ESX Server<\/strong> and <strong>press F2<\/strong><br \/>\n<strong>2.) Login as root<\/strong> and when using the Up\/Down arrows <strong>navigate to Restart Management Agents<\/strong>.<br \/>\n<strong>3.)<\/strong> <strong>Press Enter<\/strong> and <strong>press F11<\/strong> to restart the services.<br \/>\n<strong>4.) When<\/strong> the service has been <strong>restarted<\/strong>,<strong> press Enter<\/strong>. Then you can <strong>press Esc<\/strong> to logout of the system.<\/p>\n<p>Then you should see a screen like this one :<a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server.jpg\" rel=\"attachment wp-att-5481\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5481\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server.jpg\" alt=\"restart-management-agents-esx-server\" width=\"499\" height=\"174\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server.jpg 499w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server-300x105.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server-150x52.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/12\/restart-management-agents-esx-server-400x139.jpg 400w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>To restart the management agents on ESXi 4.x and 5.x:<\/h3>\n<div>From Local Console or SSH:<\/div>\n<ol>\n<li>Log in to SSH or Local console as root.<\/li>\n<li>Run this command:<\/li>\n<\/ol>\n<p>\/sbin\/<span class=\"skimlinks-unlinked\">services.sh<\/span> restart<\/p>\n<p>You can check also:\u00a0\u00a0<a id=\"referLink_1005566\" href=\"http:\/\/kb.vmware.com\/selfservice\/microsites\/search.do?cmd=displayKC&amp;docType=kc&amp;docTypeID=DT_KB_1_1&amp;externalId=1005566\" target=\"_blank\">Service mgmt-vmware restart may not restart hostd (1005566)<\/a>.<\/p>\n<h4>To restart the management agents on ESX Server 3.x, ESX 4.x:<\/h4>\n<p><strong>1.)<\/strong> Login to your ESX Server as root from SSH session (<strong><a title=\"via putty for example\" href=\"http:\/\/www.vladan.fr\/how-to-activate-ssh-for-esx-server\/\">via putty for example<\/a><\/strong>) or directly from the console.<br \/>\n<strong>2.)<\/strong> Type <strong>service mgmt-vmware restart<\/strong> and <strong>press Enter<\/strong><\/p>\n<p>Make sure that automatic Startup\/Shutdown of virtual machines <strong>is disabled<\/strong> <strong>before running this command<\/strong> otherwise you might reboot the virtual machines. See more at <strong><a href=\"http:\/\/kb.vmware.com\/kb\/1003312\" target=\"_blank\">103312<\/a><\/strong><\/p>\n<p><strong>4.)<\/strong> Type<strong> service vmware-vpxa restart<\/strong> and <strong>press Enter.<\/strong><br \/>\n<strong>6.) <\/strong>Type<strong> logout<\/strong> and press<strong> Enter<\/strong> to disconnect from the ESX Server.<\/p>\n<p>Then you should see see this :<\/p>\n<p><em>Stopping vmware-vpxa: <\/em><strong>[ OK ]<\/strong><em><br \/>\nStarting vmware-vpxa: <\/em> <strong>[ OK ]<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Troubleshoot ESXi Host Management And Connectivity issues<\/p>\n<p>If you care having problems connecting to an ESXi host, your first port of call should be to check the host\u2019s configuration. Things to check include:<\/p>\n<ul>\n<li>Physical connectivity<\/li>\n<li>IP\/subnet mask<\/li>\n<li>VLAN on the vSwitch<\/li>\n<li>VLAN configuration on the physical switch<\/li>\n<\/ul>\n<p>You can use the \u2018Test Management Network\u2019 option in the DCUI to test basic connectivity:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span id=\"more-3360\"><\/span>If the network connectivity tests succeed, but the host is still unable to be managed by vCenter or connected to with the vSphere client, then it may be that the hosts management agents need to be restarted. Bear in mind that restarting the management agents on a host may impact tasks that are running on host. You can get a list of running tasks by running the following command at the CLI:<\/p>\n<pre># vim-cmd vimsvc\/task_list<\/pre>\n<p>Investigating the tasks that are running is covered in this <a href=\"http:\/\/kb.vmware.com\/selfservice\/microsites\/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1013003\">VMware KB article<\/a>. After reviewing the running tasks, you can decide whether to proceed with restarting the host\u2019s management agents.<\/p>\n<h3>Restarting the Management Agents on an ESXi Host<\/h3>\n<p>There are a couple of ways in which you can restart a ESXi host\u2019s management agents. You can either use the DCUI or restart the agents via the CLI. Using the DCUI it is just a case of using the \u2018Restart Management Agents\u2019 menu option, which can be found under \u2018Troubleshooting Options\u2019<\/p>\n<p>&nbsp;<\/p>\n<p>To restart the management agents using the CLI, establish a connection via SSH or use the local console. Run the following commands to restart the vpxa agent and hostd:<\/p>\n<pre>\/etc\/init.d\/hostd restart<\/pre>\n<pre>\/etc\/init.d\/vpxa restart<\/pre>\n<p>To restart all management agents on the host, run the command:<\/p>\n<pre>services.sh restart<\/pre>\n<p>This will restart all ESXi services including vpxa and hostd:<\/p>\n<pre>\/sbin # services.sh restart\r\nRunning vmtoolsd stop\r\nwatchdog-vmtoolsd: Terminating watchdog process with PID 72671\r\nvmtoolsd stopped\r\nRunning wsman stop\r\nStopping openwsmand\r\nRunning sfcbd stop\r\n................<\/pre>\n<p>The services that will be restarted can be seen if you run \u2018chkconfig -io\u2019:<\/p>\n<pre>\/sbin # chkconfig -io\r\n\/etc\/init.d\/lwiod\r\n\/etc\/init.d\/SSH\r\n\/etc\/init.d\/DCUI\r\n\/etc\/init.d\/ESXShell\r\n\/etc\/init.d\/usbarbitrator\r\n\/etc\/init.d\/lbtd\r\n\/etc\/init.d\/vprobed\r\n\/etc\/init.d\/storageRM\r\n\/etc\/init.d\/hostd\r\n\/etc\/init.d\/sensord\r\n\/etc\/init.d\/slpd\r\n\/etc\/init.d\/memscrubd\r\n\/etc\/init.d\/dcbd\r\n\/etc\/init.d\/cdp\r\n\/etc\/init.d\/vobd\r\n\/etc\/init.d\/vpxa\r\n\/etc\/init.d\/sfcbd-watchdog\r\n\/etc\/init.d\/sfcbd\r\n\/etc\/init.d\/wsman\r\n\/etc\/init.d\/vmtoolsd<\/pre>\n<p>You can see which services are set to start by running \u2018chkconfig \u2013list\u2019:<\/p>\n<pre>\/sbin # chkconfig --list\r\nlsassd         off\r\nnetlogond      off\r\nlwiod          on\r\nntpd           off\r\nSSH            on\r\niked           off\r\nDCUI           on\r\nESXShell       on\r\nusbarbitrator  on\r\nlbtd           on\r\nvprobed        on\r\nstorageRM      on\r\nhostd          on\r\nsensord        on\r\nslpd           on\r\nmemscrubd      on\r\ndcbd           on\r\ncdp            on\r\nvobd           on\r\nvpxa           on\r\nsfcbd-watchdog on\r\nsfcbd          on\r\nwsman          on\r\nvmtoolsd       on\r\nvmware-fdm     off<\/pre>\n<h3>Resetting the Management Network\/Interface<\/h3>\n<p>Rather than restarting the managements, it may be worth trying a reset on the management interface. To do so, run the following command:<\/p>\n<pre>esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0<\/pre>\n<p>This command is actually in two parts, the bit before the \u2018;\u2019 will disable the interface, while the bit after the \u2018;\u2019 will immediately enable it again, thereby performing a \u2018reset\u2019.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you are not able to connect ESXi server to vCenter, or when you cannot connect to ESXi server from VI client it may be necessary to restart the management agents on ESX or ESXi host. In today\u2019s post called How to restart management agents on ESX or ESXi host we will learn this.<\/p>\n<p>You [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5480"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5480"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5480\/revisions"}],"predecessor-version":[{"id":5484,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5480\/revisions\/5484"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}