Bitbucket Server Install or Upgrade Fails: Error validating Perl

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Installing or upgrading Bitbucket Server fails and the following error can be seen in atlassian-bitbucket.log:

2012-12-21 14:01:32,041 DEBUG [localhost-startStop-1]  c.a.s.i.h.HookExternalProcessConfigurer Not configuring hooks for '/usr/local/bin/git init /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir' because it's not being executed in a repository directory (null)
2012-12-21 14:01:32,041 DEBUG [localhost-startStop-1]  c.a.u.process.ExternalProcessImpl [/usr/local/bin/git, init, /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir]
2012-12-21 14:01:32,291 DEBUG [ExtProcess - IO Pump:thread-8]  c.a.s.i.scm.git.GenericGitCommand /usr/local/bin/git init /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir: Completed with the following output:Initialized empty Git repository in /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir/.git/
2012-12-21 14:01:32,392 DEBUG [localhost-startStop-1]  com.atlassian.bitbucket.scm.BaseCommand Executed /usr/local/bin/git init /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir
2012-12-21 14:01:32,392 DEBUG [localhost-startStop-1]  c.a.s.i.s.git.GitCommandExitHandler /usr/local/bin/git init /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir did not fail, but the following was written to stderr:
2012-12-21 14:01:32,402 DEBUG [localhost-startStop-1]  c.a.s.i.h.HookExternalProcessConfigurer Not configuring hooks for '/usr/local/bin/git add -A --' because it's not being executed in a repository directory (/home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir)
2012-12-21 14:01:32,402 DEBUG [localhost-startStop-1]  c.a.u.process.ExternalProcessImpl /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir
2012-12-21 14:01:32,519 DEBUG [localhost-startStop-1]  c.a.s.i.h.HookExternalProcessConfigurer Not configuring hooks for '/usr/local/bin/git commit -m Initial' because it's not being executed in a repository directory (/home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir)
2012-12-21 14:01:32,520 DEBUG [localhost-startStop-1]  c.a.u.process.ExternalProcessImpl /home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir java.io.FileNotFoundException: File '/home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir/.git/perl-version' does not exist
2012-12-21 14:01:32,704 ERROR [localhost-startStop-1]  c.a.s.internal.scm.PluginScmService Error validating Perl: 'File '/home/bitbucket/tmp/git/perl-validationXXXXXXXXXXXXXXXXXXdir/.git/perl-version' does not exist'

Diagnosis

Perform the following steps with the user that will run Bitbucket Server:

  1. git --version
    cd $BITBUCKET_HOME/tmp
    git init git-perl-test
    cd git-perl-test
  2. Create a new file .git/hooks/pre-commit with the following content:

    #!/usr/bin/env bash
    perl -v > .git/perl-version
  3. Make sure the file is executable and create a commit to test that the Git hooks work and the Perl version is compatible:

    chmod u+x .git/hooks/pre-commit
    echo test > temp
    git add -A --
    git commit -m "Initial"
    cat .git/perl-version

For reference, an output similar to the following is expected:

kraken:~ mheemskerk$ git --version
git version 1.7.10.2 (Apple Git-33)
kraken:tmp mheemskerk$ cd $BITBUCKET_HOME/tmp
kraken:tmp mheemskerk$ git init git-perl-test
Initialized empty Git repository in /Users/mheemskerk/tmp/git-perl-test/.git/
kraken:tmp mheemskerk$ cd git-perl-test
kraken:git-perl-test mheemskerk$ emacs .git/hooks/pre-commit
kraken:git-perl-test mheemskerk$ chmod u+x .git/hooks/pre-commit
kraken:git-perl-test mheemskerk$ echo test > temp
kraken:git-perl-test mheemskerk$ git add -A --
kraken:git-perl-test mheemskerk$ git commit -m "Initial"
[master (root-commit) 5b50935] Initial
 1 file changed, 1 insertion(+)
 create mode 100644 temp
kraken:git-perl-test mheemskerk$ cat .git/perl-version

This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2010, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Cause

There are two possible causes for this behavior:

  • $BITBUCKET_HOME is mounted over NFS with the "noexec" option and thus no hooks can be executed.
  • Perl has been upgraded after the Git installation.

Resolution

According to the causes, there are two solutions:

  • Remove the NFS "noexec" option and remount.
  • Recompile Git with the newer version of Perl.
Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.