Gerrit install on Windows 10 Pro

409 views
Skip to first unread message

Jonathan Winer

unread,
Feb 8, 2022, 6:54:13 PM2/8/22
to Repo and Gerrit Discussion
Followed instructions from https://gerrit-review.googlesource.com/Documentation/install.html#installation_on_windows to install as a Windows Service.

We are running java 1.8.0.60, common-daemons 1.2.4, command prompt running as administrator.  Gerrit code review windows service installs, but does not start.  Event Viewer has this error, but could not find a reference to it here in the group - "The Gerrit Code Review service terminated with the following service-specific error:
Incorrect function."

Here is a copy of our command line - 
prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto --Jvm="C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll" --Classpath=C:\MY\GERRIT\SITE\bin\gerrit-3.5.0.war --LogPath=C:\MY\GERRIT\SITE\logs --StartPath=C:\MY\GERRIT\SITE --StartMode=jvm --StopMode=jvm --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop

Git is also installed.

Thanks for your help.

David Ostrovsky

unread,
Feb 9, 2022, 2:10:03 AM2/9/22
to Repo and Gerrit Discussion
See 3.5.0 release notes: [1], minimum Java 11 is required. Also see 3.5.0.1
announcement: [2], that states:

  Please note that version 3.5.0 had issues during the
  publishing phase to Maven and therefore has been withdrawn.

You should use 3.5.0.1 release instead: [3].

Jonathan Winer

unread,
Feb 11, 2022, 12:24:24 PM2/11/22
to Repo and Gerrit Discussion
Thank you David.  I do have Java 11  present on the machine with the environment variables updated.  I uninstalled the gerrit service via prunsrv and then reinstalled referencing 3.5.0.1.  Here is the command line - 

prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto --Jvm="C:\Program Files\Eclipse Adoptium\jdk-11.0.14.101-hotspot\bin\server" --Classpath=C:\MY\GERRIT\SITE\bin\gerrit-3.5.0.1.war --LogPath=C:\MY\GERRIT\SITE\logs --StartPath=C:\MY\GERRIT\SITE --StartMode=jvm --StopMode=jvm --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop

I'm still receiving the same error.

Thanks.

Jonathan Winer

unread,
Feb 11, 2022, 1:31:35 PM2/11/22
to Repo and Gerrit Discussion
The common-daemons log file also states the following - %1 is not a valid Win32 application.

I found this post - https://bugs.chromium.org/p/gerrit/issues/detail?id=1406, but I'm not able to follow the specifics of how it suggests to remedy.

David Ostrovsky

unread,
Feb 12, 2022, 6:51:33 PM2/12/22
to Repo and Gerrit Discussion

Please avoid top posting on this list. Just answer inline.

jwin...@gmail.com schrieb am Freitag, 11. Februar 2022 um 18:24:24 UTC+1:
Thank you David.  I do have Java 11  present on the machine with the environment variables updated.  I uninstalled the gerrit service via prunsrv and then reinstalled referencing 3.5.0.1.  Here is the command line - 

prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto --Jvm="C:\Program Files\Eclipse Adoptium\jdk-11.0.14.101-hotspot\bin\server" --Classpath=C:\MY\GERRIT\SITE\bin\gerrit-3.5.0.1.war --LogPath=C:\MY\GERRIT\SITE\logs --StartPath=C:\MY\GERRIT\SITE --StartMode=jvm --StopMode=jvm --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop


Disclaimer: I don't use Windows, and prunsrv.exe.

I have acces to a Windows 10 machine, 64 bit, where I just installed Zulu JDK 17 64 bit: [1],
and downloaded Gerrit from this CI-job: [2]. Then I downloaded prunsrv from here: [3].

First of all you need to setup gerrit site, using

  $> java -jar gerrit.war init -d <path-to-gerrit-site>

Also verify, that you can start gerrit daemon before even trying to install Windows service:

  $> java -jar gerrit.war daemon -d <path-to-gerrit-site>

Then I used this command (cmd.exe should be opened with admin ACL):

  $>  D:\pgm\prunsrv.exe install gerrit ^
        --DisplayName "Gerrit" --Classpath "D:\pgm\gerrit_site\bin\gerrit.war" --StopClass "com.google.gerrit.launcher.GerritLauncher" ^
        --StopMethod "daemonStop" --StopMode "jvm" --StartPath "D:\pgm\gerrit_site" --StartClass "com.google.gerrit.launcher.GerritLauncher" ^
        --StartParams "-d;D:\pgm\gerrit_site" --StartMethod "daemonStart" --StartMode "jvm" --LogPath "D:\pgm\gerrit_site\logs" --LogLevel "Debug"

Now, I was able to use both, start gerrit in the console:

 $> D:\pgm\prunsrv.exe run gerrit

and start gerrit as a service:

$> D:\pgm\prunsrv.exe start gerrit

You can also check commons-daemon-log and also error_log files located in gerrit site
directory. Another option is to check Windows Event Viewer for related error messages.

Jonathan Winer

unread,
Feb 15, 2022, 10:47:19 AM2/15/22
to Repo and Gerrit Discussion
Thanks David.  I made some forward progress.  I had not setup the site initially as those instructions were outside of the Windows setup instructions section.  But once I did that, I was able to run gerrit as an exe/daemon!

When I go back to trying to run it as a Windows Service, I get the following generic error and the service does not successfully start and stay running.  Appreciate your ongoing help.

Here is the command line: 

prunsrv.exe install gerrit --DisplayName "Gerrit" --Classpath "C:\MY\GERRIT\SITE\bin\gerrit.war" --Jvm="C:\Program Files\Zulu\zulu-11\bin\server\jvm.dll" --StopClass "com.google.gerrit.launcher.GerritLauncher" --StopMethod "daemonStop" --StopMode=jvm --StartPath "C:\MY\GERRIT\SITE" --StartClass "com.google.gerrit.launcher.GerritLauncher" --StartParams "-d;C:\MY\GERRIT\SITE" --StartMethod "daemonStart" --StartMode=jvm --LogPath "C:\MY\GERRIT\SITE\logs" --LogLevel "Debug"

Event viewer has an error of "Incorrect function"

Log file entries:
[2022-02-15 10:29:27] [info]  ( prunsrv.c:1896) [ 7360] Apache Commons Daemon procrun (1.2.4.0 64-bit) started.
[2022-02-15 10:29:27] [info]  ( prunsrv.c:907 ) [ 7360] Starting service 'gerrit'...
[2022-02-15 10:29:27] [warn]  ( service.c:143 ) [ 7360] Failed to obtain service description
[2022-02-15 10:29:27] [debug] ( prunsrv.c:1892) [13248] Apache Commons Daemon procrun log initialized.
[2022-02-15 10:29:27] [info]  ( prunsrv.c:1896) [13248] Apache Commons Daemon procrun (1.2.4.0 64-bit) started.
[2022-02-15 10:29:27] [info]  ( prunsrv.c:1806) [13248] Running Service 'gerrit'...
[2022-02-15 10:29:27] [debug] ( prunsrv.c:1577) [10464] Inside ServiceMain...
[2022-02-15 10:29:27] [debug] ( prunsrv.c:1032) [10464] reportServiceStatusE: dwCurrentState = 2, dwWin32ExitCode = 0, dwWaitHint = 3000, dwServiceSpecificExitCode = 0.
[2022-02-15 10:29:27] [info]  ( prunsrv.c:1325) [10464] Starting service...
[2022-02-15 10:29:27] [debug] ( javajni.c:216 ) [10464] Explicit RuntimeLib specified 'C:\Program Files\Zulu\zulu-11\bin\server\jvm.dll'
[2022-02-15 10:29:27] [debug] ( javajni.c:280 ) [10464] Adding Java bin path to the PATH to fix loading of awt.dll: 'C:\Program Files\Zulu\zulu-11\bin'
[2022-02-15 10:29:27] [debug] ( javajni.c:286 ) [10464] Loading JVM DLL 'C:\Program Files\Zulu\zulu-11\bin\server\jvm.dll'
[2022-02-15 10:29:27] [debug] ( javajni.c:414 ) [10464] Loaded JVM DLL 'C:\Program Files\Zulu\zulu-11\bin\server\jvm.dll', home ''.
[2022-02-15 10:29:27] [debug] ( javajni.c:419 ) [10464] JNI_GetCreatedJavaVMs...
[2022-02-15 10:29:27] [debug] ( javajni.c:817 ) [13240] Jvm Option[0] -Djava.class.path=C:\MY\GERRIT\SITE\bin\gerrit.war
[2022-02-15 10:29:27] [debug] ( javajni.c:817 ) [13240] Jvm Option[1] exit
[2022-02-15 10:29:27] [debug] ( javajni.c:817 ) [13240] Jvm Option[2] abort
[2022-02-15 10:29:28] [debug] ( javajni.c:1003) [13240] argv[0] = -d
[2022-02-15 10:29:28] [debug] ( javajni.c:1003) [13240] argv[1] = C:\MY\GERRIT\SITE
[2022-02-15 10:29:28] [debug] ( javajni.c:1062) [13240] Java worker thread started for com/google/gerrit/launcher/GerritLauncher:daemonStart
[2022-02-15 10:29:28] [debug] ( javajni.c:1068) [13240] JNI calling static void method com/google/gerrit/launcher/GerritLauncher:daemonStart
[2022-02-15 10:29:29] [debug] ( prunsrv.c:1389) [10464] Java started 'com/google/gerrit/launcher/GerritLauncher'.
[2022-02-15 10:29:29] [info]  ( prunsrv.c:1488) [10464] Service started in 1531 milliseconds.
[2022-02-15 10:29:29] [debug] ( prunsrv.c:1032) [10464] reportServiceStatusE: dwCurrentState = 4, dwWin32ExitCode = 0, dwWaitHint = 0, dwServiceSpecificExitCode = 0.
[2022-02-15 10:29:29] [debug] ( prunsrv.c:1732) [10464] Waiting for worker to finish...
[2022-02-15 10:29:29] [debug] ( javajni.c:1157) [10464] WaitForSingleObject 0x00000000000001F8 -1 milliseconds (INFINITE=-1)...
[2022-02-15 10:29:30] [debug] ( service.c:547 ) [ 7360] apxServiceControl(): Sleeping 1000 milliseconds
[2022-02-15 10:29:31] [debug] ( service.c:551 ) [ 7360] apxServiceControl(): QueryServiceStatus OK
[2022-02-15 10:29:31] [info]  ( prunsrv.c:925 ) [ 7360] Started service 'gerrit'.
[2022-02-15 10:29:31] [info]  ( prunsrv.c:936 ) [ 7360] Finished starting service 'gerrit', returning 1.
[2022-02-15 10:29:31] [info]  ( prunsrv.c:1980) [ 7360] Apache Commons Daemon procrun finished.
[2022-02-15 10:29:55] [debug] ( javajni.c:1075) [13240] Exception has been thrown
[2022-02-15 10:29:55] [debug] ( javajni.c:1087) [13240] Java worker thread finished com/google/gerrit/launcher/GerritLauncher:daemonStart with status = 6
[2022-02-15 10:29:55] [debug] ( javajni.c:1160) [10464] WaitForSingleObject 0x00000000000001F8 = 0 (WAIT_TIMEOUT=258)
[2022-02-15 10:29:55] [debug] ( prunsrv.c:1737) [10464] Worker finished.
[2022-02-15 10:29:55] [debug] ( prunsrv.c:1764) [10464] Waiting for all threads to exit.
[2022-02-15 10:29:55] [debug] ( prunsrv.c:1032) [10464] reportServiceStatusE: dwCurrentState = 3, dwWin32ExitCode = 0, dwWaitHint = 0, dwServiceSpecificExitCode = 0.
[2022-02-15 10:29:55] [debug] ( prunsrv.c:1768) [10464] JVM destroyed.
[2022-02-15 10:29:55] [debug] ( prunsrv.c:1032) [10464] reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 1066, dwWaitHint = 0, dwServiceSpecificExitCode = 1.
[2022-02-15 10:29:55] [info]  ( prunsrv.c:1808) [13248] Run service finished.
[2022-02-15 10:29:55] [info]  ( prunsrv.c:1980) [13248] Apache Commons Daemon procrun finished.
[2022-02-15 10:30:44] [info]  [ 8264] Apache Commons Daemon procrun (1.2.4.0 64-bit) started.
[2022-02-15 10:30:44] [info]  [ 8264] Deleting service...
[2022-02-15 10:30:44] [warn]  [ 8264] Failed to obtain service description
[2022-02-15 10:30:44] [info]  [ 8264] Delete service finished.
[2022-02-15 10:30:44] [info]  [ 8264] Apache Commons Daemon procrun finished.

Jonathan Winer

unread,
Feb 25, 2022, 1:42:20 PM2/25/22
to Repo and Gerrit Discussion
Apologies for top posting, but still stuck and unable to find resources.  Please see details of issue below.  Thanks.

Dennis W

unread,
Apr 14, 2022, 8:10:36 AM4/14/22
to Repo and Gerrit Discussion
Hi,

jwin...@gmail.com schrieb am Freitag, 25. Februar 2022 um 19:42:20 UTC+1:
Apologies for top posting, but still stuck and unable to find resources.  Please see details of issue below.  Thanks.

The initial error "%1 is not a valid Win32 application" is something you get, when you register the service with the 32-bit version of prunsrv, since you are using a 64 bit JDK. But you seem to have fixed that.
 

On Tuesday, February 15, 2022 at 10:47:19 AM UTC-5 Jonathan Winer wrote:
Thanks David.  I made some forward progress.  I had not setup the site initially as those instructions were outside of the Windows setup instructions section.  But once I did that, I was able to run gerrit as an exe/daemon!

When I go back to trying to run it as a Windows Service, I get the following generic error and the service does not successfully start and stay running.  Appreciate your ongoing help.

Here is the command line: 

prunsrv.exe install gerrit --DisplayName "Gerrit" --Classpath "C:\MY\GERRIT\SITE\bin\gerrit.war" --Jvm="C:\Program Files\Zulu\zulu-11\bin\server\jvm.dll" --StopClass "com.google.gerrit.launcher.GerritLauncher" --StopMethod "daemonStop" --StopMode=jvm --StartPath "C:\MY\GERRIT\SITE" --StartClass "com.google.gerrit.launcher.GerritLauncher" --StartParams "-d;C:\MY\GERRIT\SITE" --StartMethod "daemonStart" --StartMode=jvm --LogPath "C:\MY\GERRIT\SITE\logs" --LogLevel "Debug"

Event viewer has an error of "Incorrect function"

I have seen that error on a tomcat server with a JVM-Mismatch, where the environment variable was set to a different jdk, than the tomcat-config was pointing to.
Could that be the issue? Notably, just in this thread, you mentioned three different Java JVMs.
Is the JVM in your gerrit.config (container.javaHome) the same as the one you registered the service with?
Did you change the user your service is running as?
At one point "clever me" initialized gerrit with my regular user and tried to run the service as a dedicated service user, which did not go well.
The service user needs to have read and write access to your gerrit site or at least certain subfolders.

Here is how I registered the service on my Windows testserver (without using StartParam, since the StartPath is set):
prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto ^
      --Description="Server for web-based team code collaboration tool." ^
      --Jvm="C:\Dev\jre11.0.14.1\bin\server\jvm.dll" ^
      --Classpath=C:\Dev\gerrit\bin\gerrit.war ^
      --LogPath=C:\Dev\gerrit\logs ^
      --StartPath=C:\Dev\gerrit ^
      --StartMode=jvm --StopMode=jvm ^
      --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^
      --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop

I used the JRE 11 from Zulu and initialized gerrit with a dedicated service user which I also use as the "Log On" user for that service.
Reply all
Reply to author
Forward
0 new messages