(nucleus): Unable to set up Nucleus as a system service on Windows
Closed this issue · 2 comments
Describe the bug
During greengrass install, when I set any custom path in Droot
that includes spaces, e.g. C:\Program Files (x86)\greengrass\v2
, the Install process goes fine but afterward I get the log message Unable to set up Nucleus as a system service
.
In greengrass.log I see
2022-09-11T08:48:19.545Z [ERROR] (Copier) com.aws.greengrass.util.orchestration.WinswUtils: winsw-setup. {stderr='C:\Program' is not recognized as an internal or external command,, command=C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.exe install C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.xml}
2022-09-11T08:48:19.545Z [ERROR] (Copier) com.aws.greengrass.util.orchestration.WinswUtils: winsw-setup. {stderr=operable program or batch file., command=C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.exe install C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.xml}
2022-09-11T08:48:19.545Z [ERROR] (main) com.aws.greengrass.util.orchestration.WinswUtils: winsw-setup. Failed to set up Windows service. {}
java.io.IOException: Command C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.exe install C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.xml failed
at com.aws.greengrass.util.orchestration.SystemServiceUtils.runCommand(SystemServiceUtils.java:51)
at com.aws.greengrass.util.orchestration.WinswUtils.setupSystemService(WinswUtils.java:57)
at com.aws.greengrass.easysetup.GreengrassSetup.performSetup(GreengrassSetup.java:328)
at com.aws.greengrass.easysetup.GreengrassSetup.main(GreengrassSetup.java:269)
To Reproduce
java "-Droot=C:\Program Files (x86)\greengrass\v2" "-Dlog.store=FILE" -jar "Downloads\GreengrassInstaller\lib\Greengrass.jar" --aws-region eu-west-1 --thing-name MyGreengrassCore --thing-group-name MyGreengrassCoreGroup --component-default-user ggc_user --provision true --setup-system-service true
Expected behavior
Path to executable and path to the XML config require quotation marks when installing system service (https://docs.microsoft.com/en-us/troubleshoot/windows-server/deployment/filenames-with-spaces-require-quotation-mark)
"C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.exe" install "C:\Program Files (x86)\greengrass\v2\alts\current\distro\bin\greengrass.xml"
Actual behavior
After greengrass is installed, no system service is present
$ sc query "greengrass"
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
The specified service does not exist as an installed service.
Environment
- OS: Windows 10 x64
- JDK version: 18.0.2
- Nucleus version: 2.7.0
Additional context
I need to install greengrass to some custom path different from c:\greengrass\v2
because when we install it on a customer's PC, there is a risk for it to be removed by administrator or some other personnel according to some security policies and procedures
Hello @vladas-tamosaitis-tfs,
Thank you for the detailed report. Can you install Greengrass into some other path which has no spaces? C:\greengrass\v2
would be preferred, but you do not need to use that path, as long as the path doesn't have spaces.
Hello @vladas-tamosaitis-tfs,
Thank you for the detailed report. Can you install Greengrass into some other path which has no spaces?
C:\greengrass\v2
would be preferred, but you do not need to use that path, as long as the path doesn't have spaces.
Yeah, the path w/o spaces works fine, as well as c:\greengrass\v2
.
I see the PR for this issue was merged, will wait for the next nucleus release then. Thank you for the fast issue resolve!