OH3: openhab-logs missing in /srv after migration

Hello community,

I migrated my OH2.5 to 3.0 on a RPI4 using openhabian-config. So far things look great, all items, things etc. are migrated. As I want to do some testing now, I was trying to access the logs via the shortcut-folder (samba-share openHAB-share pointing to /srv). I understand that this share exposes everything mounted under /srv

But what I am missing is openhab-logs:

drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-addons
drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-conf
drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-logs
drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-sys
drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-userdata
drwxr-xr-x   2 openhab openhab 4096 Dec 27 15:50 openhab-addons
drwxrwxr-x+ 14 openhab openhab 4096 Dec  5 13:00 openhab-conf
drwxr-xr-x   4 openhab openhab 4096 Dec 27 15:50 openhab-sys
drwxrwxr-x+ 18 openhab openhab 4096 Dec 27 15:51 openhab-userdata

I know that I can set up a separate share for logs in smb.conf but I would like to continue using this shared folder. Where can I find the configuration for this folder /srv so I can add openhab-logs and remove the old openhab2-stuff?

Check menu entry 13 in openhabian-conf.
/var/log/openhab folder is available on your system ?

Yes, /var/log/openhab is present, I also can access the logs when logged into the RPi. The logs themselves are not the issue.

After running option 13 in Openhabian Config, the old folders (openhab2) are recreated, you can see the timestamps (19:59):

drwxr-xr-x   2 root    root    4096 Dec 27 19:59 openhab2-addons
drwxrwxr-x+ 14 openhab openhab 4096 Dec 27 15:50 openhab2-conf
drwxr-xr-x   2 root    root    4096 May 28  2020 openhab2-logs
drwxr-xr-x   3 root    root    4096 Dec 27 19:59 openhab2-sys
drwxrwxr-x+ 15 openhab openhab 4096 Dec 27 15:49 openhab2-userdata
drwxr-xr-x   2 openhab openhab 4096 Dec 27 15:50 openhab-addons
drwxrwxr-x+ 14 openhab openhab 4096 Dec  5 13:00 openhab-conf
drwxr-xr-x   4 openhab openhab 4096 Dec 27 15:50 openhab-sys
drwxrwxr-x+ 18 openhab openhab 4096 Dec 27 15:51 openhab-userdata
-rw-rw-rw-   1 openhab openhab 1430 Dec 27 19:59 README.txt

This was the output of openhabian-config:

$ umount -q /srv/openhab2-sys /srv/openhab2-conf /srv/openhab2-userdata /srv/openhab2-addons

$ rm -f /etc/systemd/system/srv-openhab-addons.mount /etc/systemd/system/srv-openhab-conf.mount /etc/systemd/system/srv-openhab-logs.mount /etc/systemd/system/srv-openhab-sys.mount /etc/systemd/system/srv-openhab-userdata.mount

$ mkdir -p /srv/openhab2-sys /srv/openhab2-conf /srv/openhab2-userdata /srv/openhab2-addons

$ cp /opt/openhabian/includes/srv_readme.txt /srv/README.txt

$ chmod ugo+w /srv /srv/README.txt

$ create_mount /usr/share/openhab2 sys
2020-12-27_19:59:51_CET [openHABian] Creating mount /usr/share/openhab2 in '/srv/openhab2-sys'...
$ systemctl enable --now srv-openhab2-sys.mount
Created symlink /etc/systemd/system/multi-user.target.wants/srv-openhab2\x2dsys.mount → /etc/systemd/system/srv-openhab2\x2dsys.mount.
OK

$ create_mount /etc/openhab2 conf
2020-12-27_19:59:52_CET [openHABian] Creating mount /etc/openhab2 in '/srv/openhab2-conf'...
$ systemctl enable --now srv-openhab2-conf.mount
Created symlink /etc/systemd/system/multi-user.target.wants/srv-openhab2\x2dconf.mount → /etc/systemd/system/srv-openhab2\x2dconf.mount.
OK

$ create_mount /var/lib/openhab2 userdata
2020-12-27_19:59:53_CET [openHABian] Creating mount /var/lib/openhab2 in '/srv/openhab2-userdata'...
$ systemctl enable --now srv-openhab2-userdata.mount
Created symlink /etc/systemd/system/multi-user.target.wants/srv-openhab2\x2duserdata.mount → /etc/systemd/system/srv-openhab2\x2duserdata.mount.
OK

$ create_mount /usr/share/openhab2/addons addons
2020-12-27_19:59:55_CET [openHABian] Creating mount /usr/share/openhab2/addons in '/srv/openhab2-addons'...
$ systemctl enable --now srv-openhab2-addons.mount
Created symlink /etc/systemd/system/multi-user.target.wants/srv-openhab2\x2daddons.mount → /etc/systemd/system/srv-openhab2\x2daddons.mount.

I fixed by myself, just in case someone has the same problem:

As root, change directory to:

/etc/systemd/system

Create a new file:

nano 'srv-openhab\x2dlogs.mount'

Content:

[Unit]
Description=openhab-logs mount
DefaultDependencies=no
Before=smbd.service
After=zram-config.service

[Mount]
What=/var/log/openhab
Where=/srv/openhab-logs
Type=none
Options=bind,rw

[Install]
WantedBy=multi-user.target

Now enable this config:

systemctl enable --now 'srv-openhab\x2dlogs.mount'

Now the Log-Directory for openhab appears in Openhab-Share:

2020-12-27 20_24_39-Window

1 Like

Seems I was happy too early
 after a reboot the shares are read-only via samba and I don’t know why.

The directories look like this:

drwxr-xr-x   7 openhab openhab 4096 Dec 28 10:36 .
drwxr-xr-x  23 root    root    4096 May 30  2020 ..
drwxrwxrwx   2 openhab openhab 4096 Dec 27 15:50 openhab-addons
drwxrwxrwx+ 14 openhab openhab 4096 Dec  5 13:00 openhab-conf
drwxrwxrwx   2 openhab openhab 4096 Dec 28 11:14 openhab-logs
drwxrwxrwx   4 openhab openhab 4096 Dec 27 15:50 openhab-sys
drwxrwxrwx+ 18 openhab openhab 4096 Dec 28 09:28 openhab-userdata

And for example in openhab-logs the permissions are like this:

drwxrwxrwx 2 openhab openhab     4096 Dec 28 11:14 .
drwxr-xr-x 7 openhab openhab     4096 Dec 28 10:36 ..
-rw-rw-rw- 1 openhab openhab        0 Dec 27 15:50 audit.log
-rw-r--r-- 1 openhab openhab    95545 Dec 28 11:40 events.log
-rw-rw-rw- 1 openhab openhab   229724 Dec 27 17:01 events.log.1
-rw-rw-rw- 1 openhab openhab 16777220 Dec 28 01:26 events.log.2
-rw-rw-rw- 1 openhab openhab   258143 Dec 28 09:29 events.log.3
-rw-rw-rw- 1 openhab openhab   123529 Dec 28 10:21 events.log.4
-rw-rw-rw- 1 openhab openhab   135123 Dec 28 10:59 events.log.5
-rw-rw-rw- 1 openhab openhab   123271 Dec 28 11:13 events.log.6
-rw-r--r-- 1 openhab openhab  4835770 Dec 28 11:41 openhab.log
-rw-rw-rw- 1 openhab openhab 16779425 Dec 27 21:44 openhab.log.1
-rw-rw-rw- 1 openhab openhab 16778012 Dec 27 22:59 openhab.log.2
-rw-rw-rw- 1 openhab openhab 16777694 Dec 28 00:22 openhab.log.3
-rw-rw-rw- 1 openhab openhab  8317929 Dec 28 09:29 openhab.log.4
-rw-rw-rw- 1 openhab openhab  9471018 Dec 28 10:21 openhab.log.5
-rw-rw-rw- 1 openhab openhab  6788942 Dec 28 10:59 openhab.log.6
-rw-rw-rw- 1 openhab openhab  2174853 Dec 28 11:13 openhab.log.7
-rwxrwxrwx 1 openhab openhab        0 Dec 21 15:29 Readme.txt

Whenever I try to update a file via samba, Windows tells me it is write protected


Hi all!

Same problem here. Coming from a openhabian 2.5 installation on a Rpi4.

mount shows lines like this after a reboot:

/dev/sda1 on /srv/openhab-conf type ext4 (ro,relatime)

(I manually deleted all openhab2-xxx shares.)

Yeah here to. It is strange because in the unit-file it is defined rw:

[Unit]
Description=openhab-addons mount
DefaultDependencies=no
Before=smbd.service
After=zram-config.service

[Mount]
What=/usr/share/openhab/addons
Where=/srv/openhab-addons
Type=none
Options=bind,rw

[Install]
WantedBy=multi-user.target

After enabling it with systemctl everything is fine, but after reboot it is read-only.

Perhaps there is another config hidden somewhere which overrides it.

I am having this same problem upgrading to OH3 on Debian 10 using openhabian. It is re-creating old /openhab2 systemd services/mounts. The command “systemctl” shows the following:

UNIT                                     LOAD   ACTIVE     SUB          DESCRIPTION               
srv-openhab2\x2daddons.mount             loaded active     mounted      openhab2-addons mount    
srv-openhab2\x2dconf.mount               loaded active     mounted      openhab2-conf mount      
srv-openhab2\x2dsys.mount                loaded active     mounted      openhab2-sys mount       
srv-openhab2\x2duserdata.mount           loaded active     mounted      openhab2-userdata mount

The odd thing is, if you rewrite the units to match openhab mounts, they are mounted readonly. This is what I did.

Additionally, it seems the 10 | Apply Improvements --> 16 | Samba option in openhabian is also still setting up samba with the old OH2 folder locations.

After running this option, my “/etc/samba/smb.conf” file is overwritten with the following:

#=================== Custom Share Definitions ====================

;[openHAB-share]
;  comment=openHAB combined folders
;  path=/srv
;  writeable=yes
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

[openHAB-conf]
  comment=openHAB site configuration
  path=/etc/openhab2
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

[openHAB-userdata]
  comment=openHAB userdata
  path=/var/lib/openhab2
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

[openHAB-sys]
  comment=openHAB application
  path=/usr/share/openhab2
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

[openHAB-logs]
  comment=openHAB log files
  path=/var/log/openhab2
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

I wish there was a way to tag people on this message board system.

openhabian-config was updated.
I also had the problem that the directories were mounted ro.
They should be mounted rw now.

@richaardvark

you can tag people here, just use the @ sign and start typing username :wink:

1 Like

I think then you are not on the right branch of openhabian-config

1 Like

Now it worked, I updated openhabian-config, choose 3.0 branch. But it did not apply to openhab-logs, is there a way to include it also in /srv?

1 Like

Thank you! :man_facepalming:t2: This is indeed my problem it seems


I followed the migration directions provided here:

Perhaps there needs to be an additional step added here stating you also need to go to:
01 | Select Branch → openHAB3

I will try now and see if this fixes my problems. Thank you!

Re-reading the description in the “Select Branch” openhabian menu area, it seems perhaps the upgrade function is supposed to automatically select the openHAB3 branch, but it appears that function/feature did not properly execute as it should have.

All fixed and working! :heavy_check_mark: I had my /etc/openhabian.conf file open in the background and this apparently caused issues with openhabian properly executing. I kept selecting “openHAB3” branch but it kept reverting back to “stable.” Once I closed the .conf file, and then selected 3.0 branch and ran the upgrade menu option again it worked without issue. I then ran through all of the “Apply Improvements” options one at a time and finally the Samba “Optional Components” option and it quickly fixed the samba share locations to /openhab and not /openhab2.

The “Fix Permissions” option under “Apply Improvements” is erroring out for some reason. I have debugging on but can’t figure out what went wrong but there doesn’t seem to be any file permission error at the moment.

I managed to add logs to /srv like this:

As root:

cd /etc/systemd/system
nano 'srv-openhab\x2dlogs.mount'

Content:

[Unit]
Description=openhab-logs mount
DefaultDependencies=no
Before=smbd.service
After=network.target zram-config.service

[Mount]
What=/var/log/openhab
Where=/srv/openhab-logs
Type=none
Options=bind,rw

[Install]
WantedBy=multi-user.target

Then activate the unit:

systemctl enable --now 'srv-openhab\x2dlogs.mount'

1 Like

Could it be that you are on Debian 10 system on a non Raspi hardware ( esp. x86 ) alternatively you are running on a system without ZRAM configured ?
The fix permisson tries to fix permission in several directories in one run. As the ZRAM is not there on x86 systems resp. non ZRAM availability it causes an error.
An github issue is filed and being under preparation.

I used your manual as you described.

The ‘srv-openhab\x2dlogs.mount’ is created correctly.
In the folder /srv I can see:

[17:14:58] openhabian@openHABianPi:/srv$ ls
openhab2-addons  openhab2-logs  openhab2-userdata  openhab-conf  openhab-sys       README.txt
openhab2-conf    openhab2-sys   openhab-addons     openhab-logs  openhab-userdata

and mount shows me:

[17:15:00] openhabian@openHABianPi:/srv$ mount
/dev/mmcblk0p2 on /srv/openhab-addons type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p2 on /srv/openhab-conf type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p2 on /srv/openhab-userdata type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p2 on /srv/openhab-sys type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p2 on /srv/openhab-logs type ext4 (rw,noatime,data=ordered)

In my opinion everything should work. But when I try to mount the smb shares from my Mac, there’s still “openhab-logs” missing.

PS: Sorry for my poor Linux skills.