Service sshd commands fail to execute with error 'Unit sshd.service not found'
search cancel

Service sshd commands fail to execute with error 'Unit sshd.service not found'

book

Article ID: 312547

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

Symptoms:

  • Commands like "service sshd status/restart" fail to execute in NSX manager appliance with error as shown below

    Failed to restart sshd.service. Unit sshd.service not found.

    Unit sshd.service could not be found.

  • Reboot of the appliance does not fix the issue.
  • Service restart commands for SSH will work.

Environment

VMware NSX-T Data Center

Cause

This error is usually seen if sshd.service is missing under /etc/systemd/system folder in the respective appliance for reasons unknown.

Resolution

Workaround:

  • Check if sshd.service file is present under /etc/systemd/system folder

    ls -lth /etc/systemd/system/ | grep sshd

    You should see output similar to the following:

    lrwxrwxrws 1 root root   31 Mar  4 05:20 sshd.service -> /lib/systemd/ssystem/ssh.service
    drwxr-xr-x 2 root root 4.0k Jul 18 2023  [email protected]

  • If not present, fetch the file from a working manager node in the cluster and upload it under the same path.
  • Change the file permissions as below

    chmod 777 /etc/systemd/system/sshd.service

  • Reboot the manager node once the file is uploaded.

Additional Information

Impact/Risks:

This would restrict the ability to restart the sshd service.