Issue 2062: Installation of 2.6.1 failed with OrmException: Cannot initialize schema
Status:  New
Owner: ----
Reported by jose....@fuhu.com, Aug 18, 2013
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version:

What steps will reproduce the problem?
1. Create user "gerrit"
2. Create "/git" folder and provide "gerrit" user to permission to access to that folder
3. Download gerrit 2.6.1
4. java -jar gerrit-2.6.1.war init -d /home/gerrit/
5. It crashed after installing "replication version 2.6.1" plugin

What is the expected output? 
Keep going with the installation

What do you see instead?
com.google.gwtorm.server.OrmException: Cannot initialize schema
	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:57)


Please provide any additional information below.

gerrit@pm-repo:~$ java -jar gerrit-2.6.1.war init -d /home/gerrit/

*** Gerrit Code Review 2.6.1
*** 


*** Git Repositories
*** 

Location of Git repositories   [git]: /git     

*** SQL Database
*** 

Database server type           [h2]: 

*** User Authentication
*** 

Authentication method          [OPENID/?]: OPENID

*** Email Delivery
*** 

SMTP server hostname           [localhost]: smtp.gmail.com
SMTP server port               [(default)]: 587
SMTP encryption                [NONE/?]: ?
       Supported options are:
         none
         ssl
         tls
SMTP encryption                [NONE/?]: tls
SMTP username                  [gerrit]: xxxx
xxxx's password         : 
              confirm password : 

*** Container Process
*** 

Run as                         [gerrit]: 
Java runtime                   [/usr/lib/jvm/java-6-openjdk-amd64/jre]: 
Copy gerrit.war to /home/gerrit/bin/gerrit.war [Y/n]? 
Copying gerrit.war to /home/gerrit/bin/gerrit.war

*** SSH Daemon
*** 

Listen on address              [*]: 
Listen on port                 [29418]: 

Gerrit Code Review is not shipped with Bouncy Castle Crypto v144
  If available, Gerrit can take advantage of features
  in the library, but will also function without it.
Download and install it now [Y/n]? 
Downloading http://www.bouncycastle.org/download/bcprov-jdk16-144.jar ... OK
Checksum bcprov-jdk16-144.jar OK
Generating SSH host key ... rsa... dsa... done

*** HTTP Daemon
*** 

Behind reverse proxy           [y/N]? 
Use SSL (https://             [y/N]? 
Listen on address              [*]: 
Listen on port                 [8080]: 
Canonical URL                  [http://internal-repo:8080/ http://192.168.1.100:8080/

*** Plugins
*** 

Prompt to install core plugins [y/N]? y
Install plugin reviewnotes version 2.6.1 [y/N]? y
Install plugin commit-message-length-validator version 2.6.1 [y/N]? y
Install plugin replication version 2.6.1 [y/N]? y

Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot initialize schema
	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:57)
	at com.google.gerrit.pgm.Init$SiteRun.upgradeSchema(Init.java:175)
	at com.google.gerrit.pgm.Init.run(Init.java:78)
	at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:168)
	at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:92)
	at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
	at Main.main(Main.java:25)
Caused by: java.io.IOException: Cannot create repository All-Projects
	at com.google.gerrit.server.schema.SchemaCreator.initAllProjects(SchemaCreator.java:195)
	at com.google.gerrit.server.schema.SchemaCreator.create(SchemaCreator.java:113)
	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:55)
	... 11 more
Caused by: org.eclipse.jgit.errors.RepositoryNotFoundException: repository not found: Cannot create repository All-Projects
	at com.google.gerrit.server.git.LocalDiskRepositoryManager.createRepository(LocalDiskRepositoryManager.java:222)
	at com.google.gerrit.server.schema.SchemaCreator.initAllProjects(SchemaCreator.java:189)
	... 13 more
Caused by: java.io.IOException: Creating directories for /git/All-Projects.git failed
	at org.eclipse.jgit.util.FileUtils.mkdirs(FileUtils.java:315)
	at org.eclipse.jgit.internal.storage.file.FileRepository.create(FileRepository.java:251)
	at com.google.gerrit.server.git.LocalDiskRepositoryManager.createRepository(LocalDiskRepositoryManager.java:210)
	... 14 more

Oct 1, 2013
#2 HApoll...@gmail.com
Friend, i had the same issue today and after 2-3 hours of searching whether it's my Java, the Gerrit version etc, i realized the most obvious... in the end, i hadn't given write access to the folder creating the Gerrit projects, although i thought i had.. You can see this from the "Creating directories for /git/All-Projects.git failed" error.

As user gerrit, try to touch/create something in /git, see if you can...