Could not lock User prefs Unix error code 2
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Problem
The following appears in the atlassian-confluence.log
about every 2 milliseconds:
2014-09-28 13:24:33,960 WARN [Timer-10] [java.util.prefs] syncWorld Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
2014-09-28 13:25:03,958 WARN [Timer-10] [java.util.prefs] checkLockFile0ErrorCode Could not lock User prefs. Unix error code 2.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
2014-09-28 13:25:03,960 WARN [Timer-10] [java.util.prefs] syncWorld Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
2014-09-28 13:25:33,958 WARN [Timer-10] [java.util.prefs] checkLockFile0ErrorCode Could not lock User prefs. Unix error code 2.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
2014-09-28 13:25:33,960 WARN [Timer-10] [java.util.prefs] syncWorld Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
2014-09-28 13:26:03,958 WARN [Timer-10] [java.util.prefs] checkLockFile0ErrorCode Could not lock User prefs. Unix error code 2.
-- referer: https://my.site.com | url: /display/SPACE/my+wiki | userName: username
Cause
This occurs when the user being used to run Confluence does not have a writeable home directory (for example: /home/confluence
or ~confluence
didn't exist). It is possible for a plugin to use the preferences module, which defaults to write to ~/.confluence/
Resolution
- Create the confluence user home directory. This is not
$CONFLUENCE_HOME
, it is the Linux user directory, for example/home/confluence
. Make sure the user running Confluence has the proper permissions to access this directory. You may use the following commands:
chown -R <user_running_confluence> <path-of-user_home> chmod -R u+rwX <path-of-user_home>
If changing the permissions didn't have any effect, add the following JVM parameter:
-Djava.util.prefs.userRoot=/<some-writable-directory>