Karaf "Failed to save history" WARN on ssh logout, how to change history file

  • Platform information:
    • Hardware: Raspberry Pi 2 B+
    • OS: Raspbian Jessie
    • Java Runtime Environment: ???
    • openHAB version: 2.2.0-SNAPSHOT Build 1094 (manual install)

on logging out of the karaf console via ssh OR running my first command after logging in, the following WARN shows up in openhab.log:

2017-11-28 13:50:56.222 [WARN ] [org.jline                           ] - Failed to save history
java.nio.file.AccessDeniedException: /home/openhab
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) [?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) [?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) [?:?]
        at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) [?:?]
        at java.nio.file.Files.createDirectory(Files.java:674) [?:?]
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) [?:?]
        at java.nio.file.Files.createDirectories(Files.java:767) [?:?]
        at org.jline.reader.impl.history.DefaultHistory.save(DefaultHistory.java:119) [15:org.jline:3.5.1.sp1]
        at org.jline.reader.impl.history.DefaultHistory.add(DefaultHistory.java:248) [15:org.jline:3.5.1.sp1]
        at org.jline.reader.impl.LineReaderImpl.finishBuffer(LineReaderImpl.java:870) [15:org.jline:3.5.1.sp1]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:561) [15:org.jline:3.5.1.sp1]
        at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:349) [12:org.apache.karaf.shell.core:4.1.3]
        at java.lang.Thread.run(Thread.java:745) [?:?]

This is probably because /home/openhab doesn’t exist because the user openhab doesn’t have a home directory (on purpose). Is there a way to change the history file that karaf looks for? Or am I forced to create /home/openhab/ ?

Also, is there a way to change the colors used in the karaf console? I am having trouble seeing the default color for completed commands against a black background.

Thanks!

Actually openhab’s home is /var/lib/openhab2. If you cd ~openhab2 that is where you will end up with a default installation.

I’ve no idea why/what it is trying to save to /home/openhab. I get no such error in my system and I do not have a /home/openhab folder.

Google is your friend. First result:

I’m using a manual install, so that shouldn’t be the case. Besides, I presume the home location karaf is looking for would refer to the openhab user I created manually. Again, this is a manual install.

I am not looking to change the log colors. I would like to change the colors of the completed commands on the console itself. I can’t seem to find a source for how to do that, even looking through the karaf user guide doesn’t show anything obvious. This is new behavior from OH 2.1 to OH 2.2.0 snapshot, so I assumed it was an OH configuration change, rather than a Karaf default.

Thanks for the help!

Ah, in that case then yes, you would need to create a home for the openhab user to get rid of this warning.

This worked. That must be hard-coded somewhere, because changing the home directory of user openhab seems to have no effect.

Any hint on the karaf console colors? Not a huge deal, but the ANSI BLUE color doesn’t show up well on a black background, and that is the color of completed commands in the Karaf console. It’s strange that I can’t dig up the information about where this is set.

As a workaround for anyone else: I am using PuTTy, and you can re-map ANSI colors to any other color. Luckily the Karaf console seems to set text to ANSI-BLUE.

It is almost certainly in a config file. You can search through userdata/etc and see if you can find it somewhere.

I will note (for future readers of this thread, not necessarily directed at you) why the community generally recommends using the apt-get or yum installation methods when running on OH and openHABian for users unfamiliar with Linux.

If you can’t change it based on the link I provided above and you couldn’t find anything in the Karaf docs I have nothing further to offer. I rarely use the karaf console so have never really looked, and usually I can control must of that sort of thing by modifying my terminal settings.