Logfile 0kb

I’m using openHAB 2.2.0 Release Build on a raspberry-pi and recently updated via apt-get.

I’ve mounted a /mnt/Openhab_log and stated that as my log-directory.
Logfiles should be written to my Synology NAS.

This worked perfectly untill I updated. Now the log-file is created but it stays at 0kb.
When I remove the file, it’s created again after a reboot, but still 0kb.

Reading the forum I found this post from @Benjy:
openHAB 2.2 logging broken

My output:

pi@raspberrypi-1:~ $ openhab-cli info
Version:     2.2.0 (Build)

User:        openhab (Active Process 406)
User Groups: openhab tty dialout audio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /mnt/Openhab_log            | root:root
             OPENHAB_BACKUPS  | /var/lib/openhab2/backups   | root:root

URLs:        http://192.168.2.110:8080
             https://192.168.2.110:8443

When I try to read this correctly, it states that only root has acces to OPENHAB_LOGDIR and OPENHAB_BACKUPS. Is this a correct conlcusion?

How should I ad openhab:openhab to this location?
I’m not a Linux hero…

Please type

sudo chown openhab: /mnt/Openhab_log /var/lib/openhab2/backups

https://linux.die.net/man/1/chown
To sort that out:

  • sudo -> do this as super user
  • chown -> change ownership
  • openhab -> new owner (but wait… there is a colon so)
    openhab: -> new owner, use same ownership for group
    long version is openhab:openhab, so first part is the user, second part is the group, separated by the colon
  • /mnt/Openhab_log and /var/lib/openhab2/backups -> file (or folder) names for which the ownership should be changed

That’s strange…not allowed to

pi@raspberrypi-1:~ $ sudo chown openhab: /mnt/Openhab_log /var/lib/openhab2/backups
chown: changing ownership of '/mnt/Openhab_log': Operation not permitted

The Backup is changed. I’ll dig into the user-wrights of that /mnt/Openhab_log

hmm… is that a real mount?

I mount the NAS from my /etc/fstab

192.168.2.10:/volume1/Openhab_log /mnt/Openhab_log nfs defaults,noauto,x-systemd.automount 0 0

If there is a drive mounted to /mnt/Openhab_log there will be no way to change the ownership for the root folder (i.e. Openhab_log), so create a folder within Openhab_log, change the ownership to this subfolder and change the settings for logging accordingly.

OK, I’ll give it a try.
What I don’t understand is when I (as user ‘pi’) go to /mnt/Openhab_log I can create a text.txt file.
I would expect that this is only possible as root

That depends on permissions.
ls -l /mnt/ will show you the permissions for Openhab_log (maybe it’s dxrwxrwxrw)

But even if its only dxrwxrwxr- maybe pi is member of the group root :slight_smile:

@Udo_Hartmann, thanks for your help. The user-rights are driving me crazy.
Even with a subdir it’s not working as expected.
I’ll start all over again with logging to a local dir and when that’s working trying to figure out the mounting-procedure again.