Json and openhab2 permissions denied

Hi guys,

I have recently reinstalled OH2 on a system I had running that crashed and cannot figure out how to give myself permissions to edit files.

I am running a RPi 3b+.

I have tried a few things to no avail.

2018-12-31 20:52:30.947 [ERROR] [me.storage.json.internal.JsonStorage] - Error writing JsonDB to /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json. Cause /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json (Permission denied).

2018-12-31 20:52:31.429 [ERROR] [me.storage.json.internal.JsonStorage] - Error writing JsonDB to /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.link.ItemChannelLink.json. Cause /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.link.ItemChannelLink.json (Permission denied).

2018-12-31 20:58:03.904 [WARN ] [rthome.core.service.WatchQueueReader] - Access to folder ‘/etc/openhab2’ was denied, therefore skipping it.

I have searched read and tried many things and at this point I am looking for some input. Any help is greatly appreciated.

Thanks
Jared

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The “syslog” option is deprecated
Processing section “[homes]”
Processing section “[printers]”
Processing section “[print$]”
Processing section “[openHAB-share]”
Processing section “[openHAB-conf]”
Processing section “[OpenHAB Config]”
WARNING: No path in service OpenHAB Config - making it unavailable!
NOTE: Service OpenHAB Config is flagged unavailable.
Loaded services file OK.
WARNING: You have some share names that are longer than 12 characters.
These may not be accessible to some older clients.
(Eg. Windows9x, WindowsMe, and smbclient prior to Samba 3.0.)
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

Found this.

Did you install via apt-get or manually?

I noticed that as I have been reading.

I downloaded image and mounted to sd card with etcher.

Try using the sudo openhabian-config tool to apply the proper permissions, install needed packages, etc…

How/why did the other OH system crash?

Can you be a little more specific? I have run through the set up on the instruction webpage as well has tried a few permission commands that I found on the forums.

I even tried a fresh setup from the config tool.

At this point I can’t remember how I bricked the last one. I edited a file and that caused a crash. I did a fresh install from download onto the formatted SD card.

Thanks
Jared

Openhabian Image install? If so, you shouldn’t have issues with permissions. Did you have a backup that you tried to reinstall on the fresh install?

In the error messages above use ls -al on the location and post the output.

Example
ls -al /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json

EDIT: Checking my server the files giving the error are owned my openhab so you can use sudo chown openhab:openhabian /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json to change owners if needed. Permissions are -rw-rw-r-- and you can use chmod to change if needed.

Output Below:

[15:32:38] openhabian@openhab:~$ ls -al /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json
-rw-rw-r-- 1 openhab openhabian 227 Jan 1 15:28 /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json

I dropped the items and things folders over from the backups and the ecobee and unifi.cfgs.

I am getting to the point where a format and reinstall is sounding good.

Did you stop OH from running, place the backup in /var/lib/openha2/backups and use openhab-cli restore /var/lib/openhab2/backups then start OH running?