Karaf command history fail

Karaf is logging correctly, but when entering a command in console, it fails to save the history of commands with:

2022-01-24 11:25:00.506 [WARN ] [org.jline                           ] - Failed to save history
java.nio.file.AccessDeniedException: /var/lib/openhab2/.karaf/karaf.history

For some reason karaf still tries to save history to the wrong directory. The dir permissions for /var/lib/openhab are for openhab, and /var/lib/openhab2 is set as root. I would rather just change the pointer to the correct directory than change permissions to an otherwise empty directory.

Is there a karaf config file that can be modified to correct this location?

Apparently the issue was reported some time back…

https://github.com/openhab/openhab-distro/issues/1195

You may override the default value that you can get from within the karaf console with :

env|grep hist

by adding a line in $OPENHAB_USERDATA/etc/system.properties
like

karaf.history=/somedir/karaf.history
1 Like

Thanks Wolfgang. It worked perfectly.

1 Like