Problems with MapDB

I included MapDB as suggested in other tasks
(org.eclipse.smarthome.persistence:default=mapdb and
Strategies {
default = everyUpdate
}

Items {
* : strategy = everyChange,restoreOnStartup
})

But on every restart i get a FileNotFoundException for MapDB (No Permission)
I tried to change the permissions and also deleted the DB. It has been recreated.
But on reboot the same error occurs.
Any ideas?

Welcome to the openHAB Forum :raised_hand_with_fingers_splayed::raised_hand_with_fingers_splayed::raised_hand_with_fingers_splayed:

Which OS are you on?
Which openHAB version do you run?
Which user does run openHAB?
Did you install Mapdb? Setting it as the default persistence service does NOT install it.

Hi,
i am on a pi4 with openhabian 1.5.4
the openhab version is the latest and greatest 2.5.2-1
yes, MapDb has been installed via paperui
the user should be openhab, i guess. i do not know how to find out

Stacktrace (partial)
2020-03-01 13:06:51.387 [ERROR] [org.openhab.persistence.mapdb ] - bundle org.openhab.persistence.mapdb:1.14.0 (262)[org.openhab.persistence.mapdb(277)] : The activate method has thrown an exception
java.io.IOError: java.io.FileNotFoundException: /var/lib/openhab2/persistence/mapdb/storage.mapdb (Keine Berechtigung)
at org.mapdb.Volume$FileChannelVol.(Volume.java:812) ~[?:?]
at org.mapdb.Volume.volumeForFile(Volume.java:202) ~[?:?]
at org.mapdb.Volume$1.createIndexVolume(Volume.java:276) ~[?:?]
at org.mapdb.StoreDirect.(StoreDirect.java:202) ~[?:?]
at org.mapdb.StoreWAL.(StoreWAL.java:74) ~[?:?]
at org.mapdb.DBMaker.extendStoreWAL(DBMaker.java:981) ~[?:?]
at org.mapdb.DBMaker.makeEngine(DBMaker.java:758) ~[?:?]
at org.mapdb.DBMaker.make(DBMaker.java:701) ~[?:?]
at org.openhab.persistence.mapdb.internal.MapDBPersistenceService.activate(MapDBPersistenceService.java:117) ~[?:?]

OK,

the reasons seems to be that the folder mapdb and its contents changes to owner “root” after reboot. I do not know why though.

Off topic comment - it’s very easy to store and restore all Items. But do have a think about it - why would you want to do that? It costs little, but there is a cost, writing every change to a database etc.
I have exactly three Items I need to restore.

tons of enocean window sensors :slight_smile:

Sure, but remember you are restoring a guessed state. If there are security concerns then “not known yet” can be more appropriate, it’s usually only a case of writing your rules to take it into account. Just suggestions, it’s your system.

Window state CLOSED - secure.
Window state restored to CLOSED ? Well I don’t know, it was closed last time I heard but it might have changed while I was away. Plus, now I don’t know if it’s really closed or guessed closed.
Window state NULL - I don’t know yet, so can assume it’s insecure - if that’s important.

thanks
but i know what i am doing there. i am not new to this

Check openhab-cli info for the permissions
And run, just to be sure, openhab-cli reset-ownership

Secondly, I have had the same problem when I used zram for my openhab. Maybe that’s the reason why after a reboot it become root

The problem seems to be tmpfs. I followed a tutorial lower writes on the sd card via tmpfs. additionally the logfiles and the mapdb files are copied away and then on reboot copied back. When this is done a chown and chmod command are used. However after startup everything ends up with “root” as owner.

Have you tried using the openhabian-config tool, and selecting “Apply Improvements” then select numbers 11, 13, and 14?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.