Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/windows/svc: Error 1053 could not start service when user assigned is not Local System Account or has no admin rights #45966

Closed
szegheo opened this issue May 5, 2021 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@szegheo
Copy link

szegheo commented May 5, 2021

What version of Go are you using (go version)?

go version go1.16.3 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ARS\AppData\Local\go-build
set GOENV=C:\Users\ARS\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\ARS\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\ARS\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\ARS\scoop\apps\go\current
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\ARS\scoop\apps\go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ARS\AppData\Local\Temp\go-build2586798521=/tmp/go-build -gno-record-gcc-switches

What did you do?

  • Build the SVC example from golang.org/x/sys
  • Install the service on Windows 10: .\example.exe install
  • Open services.msc, find my service
  • Start it as it is (using Local System Account by default) (starts normally, no error)
  • Stop it
  • Open its properties and switch to the Log On tab
  • Assign a local user who is NOT a member of the Administrators group (has no admin rights). Check that he owns the Log on as service permission in Local Security Policy, but Windows will grant it automatically at this step if needed.
  • Start the service (and observe the error 1053 popup message)

What did you expect to see?

The example service my service to start normally.

What did you see instead?

Windows popup error message:

Error 1053: could not start service: The service did not respond to the start or control request in a timely fashion.

also when starting from command line .\example.exe start:

failed to start myservice: could not start service: The service did not respond to the start or control request in a timely fashion.

My investigation (possible reason)

I'm not a go developer, but tried to build the svc example from some previous versions of golang.org/x/sys based on the commits history and tracked down that this issue may because this commit on Oct 8, 2020: windows/svc: add IsWindowsService function

I assume because when building the svc example from one earlier state - right before that commit - this issue not exists, the service can start with my dedicated test user without any problem.

Real-world example of this issue (Gitea)

As I said I'm not a go developer (js actually), I am a user of a go project called Gitea, where me and many other users faced this problem with recent versions of Gitea and reported this issue first there. Gitea can be installed as a Windows service and it operated well for a long time. After our discussion, it became clear that the problem is independent of the Gitea code, so I was asked to report the issue here too.

My OS version

Windows 10 Pro version 20H2 build 19042.964

@gopherbot gopherbot added this to the Unreleased milestone May 5, 2021
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 5, 2021
@cagedmantis
Copy link
Contributor

/cc @bufflig

@alexbrainman
Copy link
Member

@coderars thank you for reporting the problem.

I did not have time to investigate this properly, but go-gitea/gitea#15762 looks like a good solution for the moment.

Alex

@networkimprov
Copy link

@gopherbot add OS-Windows

@the-ress
Copy link

this looks like a duplicate of #44921

@alexbrainman
Copy link
Member

this looks like a duplicate of #44921

Agree.

Closing as a duplicate of #44921.

Alex

@golang golang locked and limited conversation to collaborators Dec 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

6 participants