Unmask vCenter Server Appliance services using shell script.
search cancel

Unmask vCenter Server Appliance services using shell script.

book

Article ID: 316516

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This script will unmask the necessary vCenter Server services that are being skipped at start up.

Symptoms:
  • vCenter Server services fail to start
  • The services from a restored vCenter Server are stopped
  • Attempting to start all services fail:
Example 1:
YYYY-MM-DDTHH:MM:SS   Done running command
YYYY-MM-DDTHH:MM:SS   RC = 1
Stdout = 
Stderr = Failed to execute operation: Unit file is masked

YYYY-MM-DDTHH:MM:SS   {
    "resolution": null, 
    "detail": [
        {
            "args": [
                "Stderr: Failed to execute operation: Unit file is masked\n"
            ], 
            "id": "install.ciscommon.command.errinvoke", 
            "localized": "An error occurred while invoking external command : 'Stderr: Failed to execute operation: Unit file is masked\n'", 
            "translatable": "An error occurred while invoking external command : '%(0)s'"
        }
    ], 
    "componentKey": null, 
    "problemId": null
}
YYYY-MM-DDTHH:MM:SS   Running command: ['/usr/bin/systemctl', 'unset-environment', 'VMON_PROFILE']
YYYY-MM-DDTHH:MM:SS   Done running command
Service-control failed. Error {
    "resolution": null, 
    "detail": [
        {
            "args": [
                "vmware-vmon"
            ], 
            "id": "install.ciscommon.service.failstart", 
            "localized": "An error occurred while starting service 'vmware-vmon'", 
            "translatable": "An error occurred while starting service '%(0)s'"
        }
    ], 
    "componentKey": null, 
    "problemId": null
}


Example 2:
Operation not cancellable. Please wait for it to finish...
Performing start operation on service lwsmd...
Service lwsmd startup type is not automatic. Skip
Performing start operation on service vmafdd...
Service vmafdd startup type is not automatic. Skip
Performing start operation on profile: ALL...
Service vmware-vmon startup type is not automatic. Skip
Service-control failed. Error: Failed to start services in profile ALL. RC=11, stderr=Connect error. ErrCode: 111


Environment

VMware vCenter Server 6.7
VMware vCenter Server 7.0
VMware vCenter Server 8.0

Cause

Multiple possible causes, including failed VCHA.

Resolution

  1. Take a snapshot of the affected vCenter Server Appliance.
  2. Download the attached script (UnmaskServices.sh) and upload the file to the affected vCenter Server.
  3. Run chmod +rx UnmaskServices.sh to enable read and execute permissions.
  4. Run the script with ./UnmaskServices.sh

Note: If script fails with error, run the below command to make script functional.

  • sed -i -e 's/\r$//' UnmaskServices.sh



Additional Information

You may also need to perform the steps within the below linked article to get VCSA services started.

  • KB 320765 - vCenter services fail to start using profile NONE

Attachments

UnmaskServices get_app