Could not lock user prefs Unix error code 2

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

The following appears in the atlassian-jira.log about every 30 seconds:

1 2 3 4 Dec 14, 2011 9:28:51 AM java.util.prefs.FileSystemPreferences syncWorld WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. Dec 14, 2011 9:29:21 AM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode WARNING: Could not lock User prefs. Unix error code 2.

Cause

This occurs when the user being used to run a JIRA application doesn't have a writeable home directory (for example: /home/jira or ~jira didn't exist). It is possible for a plugin to use the prefs module, which defaults to write to ~/.jira/

ℹ️ It is possible the home directory was not created as part of the installation as process, as tracked under JRASERVER-33595 - jira installer does not create the jira home directory when it creates the user.

Resolution

  1. Create the user home directory. This is not $JIRA_HOME, it is the Linux user directory, for example /home/jira.

  2. Make sure the user running JIRA application has the proper permissions to access this direct

  3. If changing the permissions didn't have any effect, add the following JVM parameter:

    -Djava.util.prefs.userRoot=/<some-writable-directory>

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.