Openhab.log errors about Serializing to files and Permissions

  • Platform information: MacMini late 2012
    • Hardware: 2.5 GHz, core i5, 16 GB RAM
    • OS: Mojave 10.14.6
    • Java Runtime Environment: 8.0.252
    • openHAB version: 2.5.5
  • Issue of the topic: Observing the log errors below being recorded. Affecting 5 nodes altogether. 3 are battery devices (flood sensors & smart radiator valve) and 2 are Mains powered (Aeotec Home Energy meter and Fibaro dimmer).System appears fine overall. Should I be concerned? Can’t find any mention in forums. Any actions recommended? Thanks in advance for any advice. Sample of log output included below.
  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences:
2020-06-23 23:44:45.054 [ERROR] [l.initialization.ZWaveNodeSerializer] - NODE 22: Error serializing to file: /Users/burnsidecottage/Desktop/openhab-2/userdata/zwave/network_f9261f94__node_22.xml (Permission denied)
2020-06-23 23:44:45.057 [ERROR] [l.initialization.ZWaveNodeSerializer] - NODE 22: Error serializing to file: /Users/burnsidecottage/Desktop/openhab-2/userdata/zwave/network_f9261f94__node_22.xml (Permission denied)
2020-06-23 23:44:46.720 [ERROR] [l.initialization.ZWaveNodeSerializer] - NODE 23: Error serializing to file: /Users/burnsidecottage/Desktop/openhab-2/userdata/zwave/network_f9261f94__node_23.xml (Permission denied)

Hi @denisdmenace,

I don’t know if it is indeed a problem, but have you checked permissions and ownership?

Regards,
Burzin

Hello Burzin,
These logs have only appeared within the last few days. The nodes in question were included weeks ago. I’m a newbie with very little unix knowledge so can you explain what files I need to check and what the permissions should be? Wondering why file permissions should get corrupted if this is the case.
regards and thank you,
Denis

You need to check directory permissions yourself. We don’t know why they changed on your system. OH does not do that all by itself.
Eventually run openhab-cli reset-ownership to see if that helps.
If updates to those files are missing on startup, OH will run with device parameters like they
re stored in the files. May work short term if you didn’t change anything but will become a major hassle fast so better correct your setup.

Hello Markus,
Thanks for your reply. I do struggle with some of this stuff because I’m new so could I ask WHAT directory or directories I need to check? Do I do that from the present ‘Karaf’ terminal window or do I open up a new terminal window? Also, from which window would I run that “cli” clean cache stuff? I appreciate your patience for what are probably daft questions.
regards,
Denis

at least those errors show up about. See your own log post.
No that cannot be done from Karaf, you need a shell window.
I strongly suggest you read up some on UNIX basics.

Hello Markus,
Thanks for your guidance. I have looked at this directory (folder) that the log highlighted. It has a bunch of .xml files inside it. The files that the logs had listed were in there but there were also other .xml files from other nodes that the logs had NEVER flagged as a problem. I really need some help understanding what should/should not be there. I am a newbie. I can manage stuff when instructions are clear. Anyway, using the simple Mac GUI ‘get info’ menu (to avoid unix commands) on the directory and on the files inside shows the following permissions status: system: read&write, staff: read only, everyone: read only.
Is this what it expected? Shouldn’t I be able to change and apply any permissions changes required using the drop-down GUI info window?
thank you again
Denis

Hello again Markus,
A follow up: I have managed to look at the detailed permissions on that directory and the files inside using a new terminal window and the command ‘ls -l’.
They all have the same permissions BUT the files that the log complains about are OWNED by ‘root’ whereas the files that it DIDN’T complain about are OWNED by me the user ‘burnsidecottage’. Is this the problem? Will I be able to change ownership on those problematic .xml files using the terminal?
Thank you and I hope I haven’t tested your patience :wink:
regards,
Denis

It’s at least one possible reason, change them to be user openhab group openhab owned (chown command)

More precisely, try this cxommand.
sudo chown -R openhab:openhab /Users/burnsidecottage/Desktop/openhab-2

That should change the ownership permissions of oprnhab-2 and all files & folders under it.

Hi Bruce,
Thanks for your very clear instructions…I need that :slight_smile:
This is probably a daft question but does your recommended command change the ownership of everything in the openhab-2 folder FROM ‘burnsidecottage’ TO ‘openhab’? Why is this necessary? What’s the difference for reliable operation? I’m logged in as ‘burnsidecottage’, the only main user, so I’m getting confused about ‘who’ should own the files (still a learner coping with unix). Thanks again,
Denis

Yes it changes everything under it. That is the purpose of the -R (recursive) flag.
OpenHAB runs as the user openHAB. You may want tc place your user account in the openhab user group too. Sorry, I am a UNIX guru, not a MacOS guru.

Haha I guessed I was talking to a UNIX man…but sure Mac is built on UNIX…
I understood the -R ok but I still don’t understand why it’s advisable to change the ownership of everything from ‘burnsidecottage’ since the system is working well at the moment. I should perhaps clarify that my entire ‘openHAB-2’ folder sits on the desktop and I open a terminal window, which shows me ‘burnsidecottage’ as the logged in user, and then I drag the ‘start.sh’ file from the openHAB folder and drop it into my terminal window. It launches and ends up in a ‘Karaf’ window (another independent shell?) and the cursor does then show ‘openhab’ as the user. So has this launch approach resulted in all my files being ‘branded’ as being owned by ‘burnsidecottage’? I don’t know how else to launch openHAB and I don’t ‘get’ the other concept of ‘openhabian’…I do my BACKUPS the same way, dragging the runtime/bin/backup file into a NEW terminal window and doing a ‘SUDO’ backup. I notice now that all my backups appear to be ‘owned’ by root! Will this cause problems later? Have I made a mess of things? I appreciate you all giving your time. regards,
Denis

OK, we need to step back a bit because I think everyone on the thread is assuming you are running OH installed on Linux. Based on this last post (and the slight hint given the paths that generated the errors in the OP that it was complaining about files in /Users/burnsidecottage/Desktop/openhab-2/... instead of /var/lib/openhab2.

Given this, unless you created an openhab user manually, there is no openhab user on your OS. When you install openHAB on Linux, it creates an OS user to run openhab under.

In short, yes, that is the original problem. At some point, you ran openHAB using user root. This caused openHAB to create some files. When openHAB creates files it does so as the user it is running under, so those files it created are owned by root and your login user doesn’t have permission to read/write to those files. In all likelihood there are other files under userdata that are also owned by root as well.

Contrary to the advice above, which is the correct advice on an installed openHAB for Linux, you need to change the ownership of the files to the user under which openHAB will be running.

I have no idea how dragging a shell script to a terminal works on a Mac. It would never occur to me to even try it. But that is perhaps something you need to research to figure out what user the script and therefore openHAB itself will run as when you do that. On at least one occasion it ran as user root. That’s all I can say.

Once you understand how all that works, you will know what the ownership for the openHAB files.

Alternatively, you can open the terminal, navigate to the openhab script and run it from the command line. Unless you use sudo, at that point you will know exactly what user openHAB will be running under.

The Karaf console is a command line interface to the “container” in which openHAB runs. The openhab user you see there is specific to openHAB and does not exist in your OS.

In the terminal navigate to the folder where openHAB’s start script is and run ./start.sh.

As for openHABian, that’s a Debian Linux only thing tuned specifically for the RaspberryPi. It provides a near turn-key solution that include not only openHAB but a dozen or so other third party programs that are commonly used with openHAB preconfigured to work with openHAB as well as a number of tweaks to the underlying operating system. It’s way less work to get up and running with openHABian than pretty much any other approach.

Not necessarily. It just means that you have to run the restore using sudo and you may need to reset the ownership back to your login user.

I was wrong, in too much of a hurry…
It changes everything under the openhab-2 folder on the Desktop.

Hello Rich,
Thank you very much for that detailed and clear exposition of what’s going on. Really excellent! I’ve learned a lot today! Yes I agree that openHAB must have run as root on one occasion.
YES with MacOS you can drag shell scripts into a terminal window and it automatically fills in the correct path and runs it… Mac people are usually GUI driven so I’m not comfortable/not much patience with typing a bunch of syntax to run a program :slight_smile:
I propose to keep running openHAB as ‘me’ ‘burnsidecottage’ so it won’t have its own ‘openhab’ user. I’ll use a ‘chown’ command to rip through the openhab folder and make sure everything is ‘owned’ by burnsidecottage which is me, the login user. Do you think this is the simplest way to clean things up? I may also do the same with my backups to ensure they can be read by ‘openhab’. Finally, can you (or Bruce) spell out the exact syntax to rip through the folder as I’m proposing?
Thank you all again for your assistance and patience with a GUI Mac man :slight_smile:
Denis

Hi Bruce,
You probably will see Rich’s reply and mine to him.
Can you kindly give me the exact syntax to rip through my openhab-2 folder and make sure everything is owned by ‘burnsidecottage’ and there are no files lurking about owned by ‘root’?
Thanks for your time,
Denis

Bruce already did above.

As what user? That’s the gotcha and that’s the reason why I kind of hate using Macs most of the time. They hide far too much from you so if you need to go even slightly outside of their pre-conceved way of doing something you are either SOL or it’s going to be really complicated.

At some point in time you ended up running the script as root. Do you know when and how? You are going to have to prevent that from happening again in the future.

Haha Rich yes my PC friends say the same about Macs, they do hide the murky workings under the hood from you :slight_smile: I’ve learned a small bit of UNIX to do a few simple things and appreciate what’s under the hood. I understand your view though that you like to see everything.
Anyway, whatever user is logged in at the time then the terminal will run the shell as that user…that’s my understanding. So I was probably lost and floundering at some point and typed in a ‘SUDO’ and that caused the mayhem. The whole Openhab paradigm is a steep learning curve.
Do you approve of my strategy to stick with ‘burnsidecottage’ as the openhab user? Nobody else uses my dedicated MacMini so I’m the only one ever logging in.
Denis

If the files have group write by default, you can have both users in the same group for sharing, Directories also need the x permission to be able to browse the directory.

Using the openHABian SAMBA configuration with a windows machine for editing handles the user part for you.