Synology DiskStation

Tags: #<Tag:0x00007f182920e4a8>

(Alexander Warmbold) #222

Thank you Erkan,

I had some difficulties with the “vi setenv”, I wasn’t able to save the file after changing to port 8445.
So I copied it to the public folder, opened it with TextWrangler, changed the port and saved the changes. After that I deleted the original and copied my changed file back to the folder …/runtime/bin.

And boom, it worked, OpenHAB2 is running. Thank you very much.

(Erkan Balci) #223

Yeah, it is some other way to do that :slight_smile: To be on the safe side please check the file owner. ssh to the Synology, go to /volume1/@appstore/openHAB2/runtime/bin folder and type ls -la. check the setenv file, the owner should be openhab2, group is users. If the owner is root, type “chown openhab2 setenv” to make it openhab2. In the meantime check from the Synology Control Panel-Users if openhab2 user is created automatically.
Dealing with openhab2 on Synology is twice as harder…

(Dries) #224

Did anyone upgrade their OpenHab 2.1 to a newer snapshot? How?

(Christian Häussler) #225

A update Mechanismen for Snapshot versions is currently at work!
Only way at the Moment is, to uninstall your existing version and install it new.

(Dries) #226

@cniweb: thanks!µµ

If I uninstall/reinstall, what files should I restore? Obviously all files in the /conf folder, but I also did some config in PaperUI. Is that config stored elsewhere?

(Dries) #227

Does nobody have an idea?
My 2.1 snapshot is already 1.5 month old (I don’t know where you can check a version number).
How do I upgrade without loosing all my config?

(Erkan Balci) #228

You have to also backup userdata folder and addons folder if you put any.jar files there. I am not so really sure about runtime folder. But the config files of paper ui resides in jsondb folder under userdata. Also do not update yet if you do not have serious problems, since distro package is 2.1.0. You do not want to install nightly development builds. For syno latest is

(Dries) #229

Hi @febz11,
Thank you for your information.

I have installed OpenHAB via package, but this is already more than a month ago (mid March). The package automatically downloads the latest successful build from Cloudbees.

Since then, a lot of new builds have been released (the last one 3 days ago), hence my upgrade question.

So if I get this right, the procedure (assuming you have installed via the Synology package) is:

  • Stop the OpenHAB package in the Package center;
  • Backup the entire @appstore/OpenHAB2 folder;
  • Download the latest successful build from Cloudbees;
  • Unzip this in the @appstore/OpenHAB2 folder - overwriting existing files;
  • Restore the following folders: \addons, \conf, \userdata (overwriting existing files);
  • Start the OpenHAB package in the Package center;

This would restore all my settings (also the ones I configured in PaperUI) without disrupting my installation. Correct?

(Erkan Balci) #230

Hello Dries,

btw forget about the addons folder since new snapshot will download latest bindings. However, as i see you want to update stable version of openhab2 to development versions nightly snapshot. Please bear in mind that the nightly snapshots are development builds and might cause you some other problems, think of it as beta versions. Distro versions are the latest stable builds.

You can see the same question in How to upgrade a OH2 distro? and Whats your way to update OH2 with another nightly build?. and as you can see life with openhab on Synology is always harder to use since we do not have apt-get on Synology. Copying /conf always works bu copying /userdata not works so smoothly. What i reccommend is that you create everything on config files like rules, items, transformations and etc. except for things and bindings. What i did is to create some of the things in text file and some on Paper UI; like ntp, weather, printer, hue on text files but Zwave modules on Paper UI since Zwave node management is flawed on text file configurations on openHAB2. So if i update, i copy /conf folder, and recreate all bindings and zwave items in Paper UI and don’t bother with /userdata folder, since you have to delete some files from /userdata folder for openhab to recreate with the new snapshot.
So that means nearly delete and reinstall openhab2! I would personally reccommend that you go with distro editions since in Synology if you do not use the package version ( openhab2 requires manual installation which i didnot dared to use.
In summary, you have to struggle a bit to do that on Synology. If you are brave enough please let us know how did it go :slight_smile:

And also i realized 2.1.0 004 is a snapshot too :wink: I still prefer to go with the package scripts and wait for the next one until i fully understand the versioning and updating mechanisms…

I was also wondering since the script in shows as the download address. So uninstalling and reinstalling the .spk might yield a newer snapshot of openhab?

(Erkan Balci) #231

So, Dries, following your ambition i also choose to update my snapshot. But this time i carried my openhab2 installation from package source to debian chroot environment on synology.

So i installed Debian chroot and oracle java, in which both had me some problems at first with apt-get update and java installation but handled at last. Then i installed openhab2 with apt-get. First installed all the bindings i needed, and then the things that do not rest in my config files, like Zwave controller and nodes. And then copied my /conf folder to it new location. Made some small changes in the rules regarding file location folders and tadaaa… Openhab2 in its new environment and easier to manage. Then i remembered that my MQTT transformations are not working since i didnot installed mosquitto on chroot environment. Did that, and made the changes for the Synology to restart openhab2 service in case of reboots and everything. Now it is a lot easier to handle than the package one since i can install anything i like with apt-get.

(Dries) #232

Hi Erkan,

Thank you for both interesting posts.
I think I am going to follow your proposal and go the chroot-way on Synology.
I’ll post my findings here. I’m not sure I’ll be able to do it next week. I’m in the middle of integrating my alarm system with OpenHAB, and want to get that stable first. Also, I want to pick a moment when I’m alone in the house. In case the OpenHAB-install goes wrong, I can try to fix it before anyone notices. :slight_smile:

(Wesley Schijven) #233

I have problems with my configuration files.
First I made a map “conf” in public folder. After that I installed OH2 on synology.
I gave user “openhab2” read/write rights via “shared maps” in synology dsm.
But the conf map in public remains empty and can’t find my conf files.
When I login with WinSCP in volume1/@appstore/openHAB2, I find a shortcut to map public/conf.

How to set this up right?

I tried to manually put the standard map structure in the public/conf map, but that doesnt help either.

(Erkan Balci) #234

What do you mean by map? Normally openhab2 will not create any folders or configuration files under conf. You have to create these directories manually (like items, things, rules, services etc.) and put your .items file under items folder, .things file under things folder etc. So it will remain empty until you put your configuration files there. Paper UI or Habmin will not create any configuration files under conf.

(Wesley Schijven) #235

exactly, that is what I did.
But OH doens’t recognize the conf files. At least they aren’t shown in e.g. Paper UI.

(Erkan Balci) #236

Try to create the conf directory like: / volume1/public/openhab2/conf; not /volume1/public/conf. Then uninstall and reinstall the openhab package.

(Tilman) #237

My Synology doesn’t shows the folder public as as subdir of volume1. should i create a folder named pulic/openhub2

(Erkan Balci) #238

Yes normally you should create a ‘public/openHAB2/conf’ directory under volume1 prior to installing OH2 if you are installing a package installation.

(Wolfgang) #239

After trying to get openHAB running in docker on my DS1815+ I switched to this packages. Docker had some limitations, e.g. exec not usable. Hope that will work with this here. :slight_smile:

The installation worked as described but I have some additional questions/remarks. (maybe I can update the official Synology openHAB setup page afterwards?).

  • it’s not always possible to use the latest Java8 SE version because the package from PC-Loadletter is not up to date. And it happens that you download the wrong version. That should be mentioned. The PC-Loadletter package will show the needed version when started.
  • I struggled a lot with the config and logs folder at the beginning.
    ** I’m used to work with the shared folders and wanted to have my configuration there. One reason is that it is then accessible via web UI as well as a network share. Second reason is that HyperBackup can only access shared folders.
    ** I don’t wanted to have a public shared folder (I had the impression it will only work with a public folder)
    ** I wanted to have the config in another shared folder which is encrypted

So what I did after some research on this page (and others) is as someone suggested further up to create some symlinks. Here is what I did:

  • created a openHAB2 folder on my encrypted shared folder (appstorage) - it includes a conf and a logs folder
  • I copied the conf files from my local (windows) testsystem to this folder (you can also copy the generated folder from volume1/@appstore/openHAB2/conf)
  • I deleted the conf folder from volume1/@appstore/openHAB2/ and created a new symlink to my new conf folder destination (changed the owner too):
    sudo ln -s /volume1/appstorage/openHAB2/conf /volume1/@appstore/openHAB2/conf
    sudo chown -R openhab2:users /volume1/@appstore/openHAB2/conf
  • I deleted the logs folder from volume1/@appstore/openHAB2/userdata/ and created a symlink there too:
    sudo ln -s /volume1/appstorage/openHAB2/logs /volume1/@appstore/openHAB2/userdata/logs
    sudo chown -R openhab2:users /volume1/@appstore/openHAB2/userdata/logs

Currently everything starts and I can reach the openHAB instance on port 8080. My config is also available and the logs are created in my new log folder.
My question now is, if there is any drawback of this solution or does someone see a problem with that? I’m not a Linux expert so I’m not sure if I missed some important point.

(Wolfgang) #240

Short update to my previous post. I’ve seen/realized that most of the configurable stuff done e.g. via paperUI is stored in userdata. Therefore I removed the link for the logs folder and added a symlink for the whole userdata and addons folder. I created a bash script for that:

# remove standard folders
sudo rm -rf /volume1/@appstore/openHAB2/conf
sudo rm -rf /volume1/@appstore/openHAB2/userdata
sudo rm -rf /volume1/@appstore/openHAB2/addons

# create symlink to new folder destination
sudo ln -s /volume1/appstorage/openHAB2/conf /volume1/@appstore/openHAB2/conf
sudo ln -s /volume1/appstorage/openHAB2/userdata /volume1/@appstore/openHAB2/userdata
sudo ln -s /volume1/appstorage/openHAB2/addons /volume1/@appstore/openHAB2/addons

# set user/group for symlinks
sudo chown -R openhab2:users /volume1/@appstore/openHAB2/conf
sudo chown -R openhab2:users /volume1/@appstore/openHAB2/userdata
sudo chown -R openhab2:users /volume1/@appstore/openHAB2/addons

# make sure openhab2 user has r/w access to shared folder (appstorage)

It works as far as I’ve seen. Everything starts and files/folders are updated and changed. Only drawback is currently that I would like to move the logs, cache and tmp folder out of the userdata and just link them but I don’t know if HyperBackup would still back all the data which is linked anyway. Therefore I leave it as it is and just deselect this folders in HyperBackup (have to select newly created folders (e.g. from addons) in HyperBackup later).

Still the question is open if anyone sees a drawback in my way or has any other comment.

Should I use user openhab or openhab2 (and which group) in openhab2
(Avner) #241

Erkan, you mentioned having problems with the Oracle Java installation. In my Synology DS213J (DSM 6.1.2-15132) I have OpenJDK java which I want to replace with Oracle java.

I’m following the instructions from here but getting errors in the Oracle java installation. I’m using the Debian chroot package. The error that I’m getting is:

/var/packages/debian-chroot/scripts/start-stop-status chroot
apt-get install oracle-java8-installer
Preparing to unpack .../oracle-java8-installer_8u131-1~webupd8~2_all.deb ...
readelf: Error: '/proc/self/exe': No such file
dpkg: error processing archive /var/cache/apt/archives/oracle-java8-installer_8u131-1~webupd8~2_all.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any one has an idea how to install Oracle java on Synology?

I installed Oracle java, using these instructions (section: Java (ARMv7 models, DSM 6.0 or later)). Now java shows the right version (I think, as it does not show OpenJDK anymore)
To make it accessible within the chroot, I added the following steps

  1. Download the Oracle java package (Linux ARM 32 Hard Float ABI, jdk-8u131-linux-arm32-vfp-hflt-demos.tar.gz) from here

  2. Copy the tar file into the chroot environment from outside chroot, as root

cp \
/tmp/jdk-8u131-linux-arm32-vfp-hflt.tar.gz \
  1. Untar and copy the untarred directory
mkdir -p /tmp/tmp2
pushd /tmp/tmp2
tar -xzvf ../jdk-8u131-linux-arm32-vfp-hflt.tar.gz
cp -r  /tmp/tmp2/jdk1.8.0_131/* /var/packages/Java8/target/j2sdk-image/

  1. Set up paths
    export LD_LIBRARY_PATH=/var/packages/Java8/target/j2sdk-image/jre/lib/arm/jli

  2. Check java version after installation of Oracle java

root@DiskStation:/# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)