question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.0 alpha ignores serviceaccount value

See original GitHub issue

I’m trying to start PostgreSQL server with winsw. postgres process must be started under unprivileged user. This is the part of a greater task, so please ignore patroni names here. Right now the issue is to start postgres.

Steps to reproduce

<service>
	<id>patroni</id>
	<name>Patroni HA Windows Service</name>
	<description>Patroni high-availability solution using Python and etcd</description>
	<executable>C:\Users\pasha\Code\pgsql\bin\postgres.exe</executable>
	<arguments>-D C:\Users\pasha\Code\pgsql\data</arguments>
	<stopparentprocessfirst>true</stopparentprocessfirst>
	<log mode="roll"></log>
	<logpath>%BASE%\log</logpath>
	<serviceaccount>
		<user>postgres</user>
		<password>12345</password>
		<allowservicelogon>true</allowservicelogon>
	</serviceaccount>
</service>
$ .\patroni_service.exe install
13:35:06,941 - Installing service 'Patroni HA Windows Service (patroni)'...
13:35:07,102 - Service 'Patroni HA Windows Service (patroni)' was installed successfully.
$ sc qc patroni
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: patroni
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : "C:\PES\patroni_service.exe"
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Patroni HA Windows Service
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem

I’m not sure if this is correct SERVICE_START_NAME : LocalSystem, I’m waiting for something like SERVICE_START_NAME : postgres

When I’m trying to start:

$ .\patroni_service.exe start
13:42:56,990 - Starting service 'Patroni HA Windows Service (patroni)'...
13:42:58,599 - Failed to start the service.

Log:

2020-08-13 14:08:59,573 INFO  - Starting service 'Patroni HA Windows Service (patroni)'...
2020-08-13 14:09:00,072 DEBUG - Starting WinSW in service mode.
2020-08-13 14:09:00,112 INFO  - Starting C:\Users\pasha\Code\pgsql\bin\postgres.exe
2020-08-13 14:09:00,208 INFO  - Started process postgres (9656).
2020-08-13 14:09:00,216 ERROR - Failed to start service.
System.InvalidOperationException: Cannot process request because the process (9656) has exited.
   at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetProcessHandle(Int32 access)
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at WinSW.WrapperService.StartProcess(String executable, String arguments, LogHandler logHandler, Action`1 onExited)
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)
2020-08-13 14:09:00,288 FATAL - Unhandled exception
System.InvalidOperationException: Cannot process request because the process (9656) has exited.
   at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetProcessHandle(Int32 access)
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at WinSW.WrapperService.StartProcess(String executable, String arguments, LogHandler logHandler, Action`1 onExited)
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)
   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.ServiceProcess.ServiceBase.Run(ServiceBase[] services)
   at System.ServiceProcess.ServiceBase.Run(ServiceBase service)
   at WinSW.Program.<>c.<Main>b__6_14(String pathToConfig)
2020-08-13 14:09:01,144 FATAL - Failed to start the service.

Event Log:

Execution of PostgreSQL by a user with administrative permissions is not  permitted. 
The server must be started under an unprivileged user ID to prevent  possible system security compromises. 
See the documentation for more information  on how to properly start the server.
--

Environment

  • WinSW version: v3.0.0-alpha.3
  • WinSW package type: WinSW.NETCore.x64.exe
  • Windows version: 10
  • Wrapped executable and version: postgres.exe (PostgreSQL 13)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nxtncommented, Aug 13, 2020

YAML configuration support hasn’t been released in any 2.x or 3.x versions yet. 2.10.0 is likely to be the first to support it.

0reactions
nxtncommented, Aug 14, 2020

The roadmap is still being drafted. The deadline is far from certain. Alpha releases can be unpredictably unstable: the configuration schema may change and there may be serious regressions. It’s up to you. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

GCP IAM: Binding role to Service Account fails
For a binding with condition, run "gcloud alpha iam policies lint-condition" to identify issues in condition.
Read more >
Well-Known Labels, Annotations and Taints
The value for this annotation must be true to take effect. This annotation indicates that Pods running as this ServiceAccount may only reference...
Read more >
kube-apiserver
The service account token authenticator will validate that tokens used against ... ignoring value of service-account-max-token-expiration.
Read more >
Kubernetes 1.23 - What's new? - New features and ...
Kubernetes 1.23 brings 50 enhancement, including improved support for OpenAPI v3, a new kubectl events command. Discover more!
Read more >
Kustomization | Flux
The Kustomization API defines a pipeline for fetching, decrypting, building, validating and applying Kustomize overlays or plain Kubernetes manifests.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found