Giter Site home page Giter Site logo

openhab-linuxpkg's Introduction

openHAB 1 Add-ons

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

This repository contains add-ons that are using openHAB 1.x APIs. Earlier branches of this repo also contain the 1.x runtime and designer, which are no longer maintained.

Note that all information about openHAB itself, the IDE setup and the contribution processes can be found in the openhab-distro project, so please go there for any further details!

openhab-linuxpkg's People

Contributors

andrewfg avatar bclark09 avatar fwolter avatar j-n-k avatar kaikreuzer avatar mstormi avatar oliviercommelarbre avatar paulianttila avatar ralle12345 avatar theoweiss avatar thomdietrich avatar wborn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openhab-linuxpkg's Issues

Restore command description

backup [filename]      -- Stores the current configuration of openHAB.
restore filename       -- Restores the state of openHAB to a backup.

I'm not a native English speaker, but should it not be "Restores the state of openHAB from a backup" (instead of "to a backup")?
Also, I think "state" could be confused with item state but I guess we're talking about configuration state, so how about:

backup [filename]      -- Stores the current configuration of openHAB.
restore filename       -- Restores the configuration of openHAB from a backup.

Anyway, a great addition! I will definitely use the backup feature and hopefully never need to use the restore feature :)

Upgrade of OH2 package resets startup configuration

Perhaps this is by design, however, if you install openhab2-online via apt-get on Ubuntu, then disable on-boot startup of OH2 via systemctl disable openhab2, the next time you upgrade your package via apt-get openhab2 will again be set to start on boot (and will even be started at the end of the upgrade process). Tested on Ubuntu 16.04.1 LTS.

Higher maturity packages should be in lower distributions too

DEB

  • Setup separated list of distributions for Deb packages.

RPM

Choose between:

  • RPM Packages need to be duplicated across different directories. Upload multiple times.
  • Leave RPM Packages as they are, documentation already suggests adding multiple this way.

Add single installation script

A script on bintray that can be downloaded and executed to install the openHAB repository and package and then check for the correct version of Java would be helpful.

Virgin install of new package does not proceed

The following steps to install and start the new distro on latest Raspbian update (RPi2 B) get as far as starting but never listens on port 8080, and nothing written to newly created /var/log/openhab2/openhab.log after 20+ minutes.

pi@habpi2:~ $ echo 'deb http://dl.bintray.com/openhab/apt-repo2 unstable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
deb http://dl.bintray.com/openhab/apt-repo2 unstable main
pi@habpi2:~ $ wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
OK
pi@habpi2:~ $ sudo apt-get update
Ign http://dl.bintray.com unstable InRelease
Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]  
Hit http://archive.raspberrypi.org jessie InRelease                                              
Get:2 http://dl.bintray.com unstable Release.gpg [821 B]                                         
Hit http://ppa.launchpad.net trusty InRelease                            
Get:3 http://dl.bintray.com unstable Release [6,054 B]                   
Hit http://archive.raspberrypi.org jessie/main armhf Packages                          
Get:4 http://mirrordirector.raspbian.org jessie/main armhf Packages [8,981 kB]                                            
Hit http://archive.raspberrypi.org jessie/ui armhf Packages                                                               
Hit http://ppa.launchpad.net trusty/main Sources                                                                                                     
Hit http://ppa.launchpad.net trusty/main armhf Packages                                                                            
Get:5 http://dl.bintray.com unstable/main armhf Packages [2,157 B]                                                                                   
Hit http://ppa.launchpad.net trusty/main Translation-en                                                                                 
Ign http://dl.bintray.com unstable/main Translation-en_GB                                                                                            
Ign http://dl.bintray.com unstable/main Translation-en                                                                                               
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB                                                                                     
Ign http://archive.raspberrypi.org jessie/main Translation-en                                                                                        
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB                                                                                       
Ign http://archive.raspberrypi.org jessie/ui Translation-en                                                                                          
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB]                                                                     
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB]                                                                    
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]                                                                         
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB                                                                              
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en                                                                                 
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB                                                                                 
Ign http://mirrordirector.raspbian.org jessie/main Translation-en                                                                                    
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB                                                                             
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en                                                                                
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB                                                                                  
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en                                                                                     
Fetched 9,114 kB in 59s (152 kB/s)                                                                                                                   
Reading package lists... Done
pi@habpi2:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... The following packages were automatically installed and are no longer required:
  libxi6 libxrender1 libxtst6
Use 'apt-get autoremove' to remove them.
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@habpi2:~ $ sudo apt-get install openhab2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libxi6 libxrender1 libxtst6
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  openhab2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 52.1 MB of archives.
After this operation, 58.5 MB of additional disk space will be used.
Get:1 http://dl.bintray.com/openhab/apt-repo2/ unstable/main openhab2 all 2.0.0~20170110001819-1 [52.1 MB]
Fetched 52.1 MB in 5min 47s (150 kB/s)                                                                                                               
Selecting previously unselected package openhab2.
(Reading database ... 31674 files and directories currently installed.)
Preparing to unpack .../openhab2_2.0.0~20170110001819-1_all.deb ...
Unpacking openhab2 (2.0.0~20170110001819-1) ...
Processing triggers for systemd (215-17+deb8u5) ...
Setting up openhab2 (2.0.0~20170110001819-1) ...
### NOT starting on installation, please execute the following statements to configure openHAB to start automatically using systemd
 sudo /bin/systemctl daemon-reload
 sudo /bin/systemctl enable openhab2.service
### You can start openhab2 by executing
 sudo /bin/systemctl start openhab2.service
pi@habpi2:~ $ sudo /bin/systemctl daemon-reload
pi@habpi2:~ $ sudo /bin/systemctl enable openhab2.service
Synchronizing state for openhab2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d openhab2 defaults
Executing /usr/sbin/update-rc.d openhab2 enable
Created symlink from /etc/systemd/system/multi-user.target.wants/openhab2.service to /usr/lib/systemd/system/openhab2.service.
pi@habpi2:~ $ sudo /bin/systemctl start openhab2.service
pi@habpi2:~ $ cd /var/log/openhab2
pi@habpi2:/var/log/openhab2 $ ls -al
total 8
drwxr-xr-x 2 openhab openhab 4096 Jan 10 08:23 .
drwxr-xr-x 7 root    root    4096 Jan 10 06:25 ..
-rw-r--r-- 1 openhab openhab    0 Jan 10 08:23 events.log
-rw-r--r-- 1 openhab openhab    0 Jan 10 08:23 openhab.log
-rwxr-xr-x 1 openhab openhab    0 Jan  9 23:18 Readme.txt
pi@habpi2:/var/log/openhab2 $ ssh openhab@localhost -p 8101
ssh: connect to host localhost port 8101: Connection refused
pi@habpi2:/var/log/openhab2 $ sudo /bin/systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Tue 2017-01-10 08:23:26 UTC; 1min 22s ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
 Main PID: 7980 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─7980 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           └─8131 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dope...

Jan 10 08:23:26 habpi2 systemd[1]: Started openHAB 2 - empowering the smart home.
Jan 10 08:23:26 habpi2 start.sh[7980]: Launching the openHAB runtime...
pi@habpi2:/var/log/openhab2 $ date
Tue 10 Jan 08:44:55 UTC 2017
pi@habpi2:/var/log/openhab2 $ netstat -an | grep LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 127.0.0.1:41797         :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     4914     /run/systemd/private
unix  2      [ ACC ]     SEQPACKET  LISTENING     4936     /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     4940     /run/systemd/journal/stdout
unix  2      [ ACC ]     STREAM     LISTENING     5773     /var/run/dhcpcd.sock
unix  2      [ ACC ]     STREAM     LISTENING     5775     /var/run/dhcpcd.unpriv.sock
unix  2      [ ACC ]     STREAM     LISTENING     8649     /var/run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     8652     /var/run/dbus/system_bus_socket
pi@habpi2:/var/log/openhab2 $ cat openhab.log 

Formatting of files.

As discussed earlier, a standard formatting should be adhered too. A new PR should change the formatting of this code.

Add /usr/bin/openhab

There should be a set of openhab commands that are easy to use and fairly self explanatory. Ones I can think of:

Usage:  openhab command [options]

Possible commands:
  start                          -- Starts openHAB as a daemon service.
  stop                           -- Stops an existing openHAB daemon service.
  restart                        -- Stops then starts an openHAB daemon service.
  status                         -- Checks to see if openHAB is running or prints systemctl status.
  console                        -- Opens the openHAB console.
  backup [filename]              -- Stores the current configuration of openHAB.
  restore filename               -- Restores the state of openHAB to a backup.
  showlogs [-l lines] ] [--tail] -- Displays the last log messages of openHAB.

@ThomDietrich, think of any more?

build does not work from Windows

I'm not sure if anything can be done about this, every important file is replaced with Windows style line endings.

Twice I've fallen into the trap of building a change on my windows machine, to thoroughly screw-up the state of dpkg on my linux machine when I go to test it.

Might be best to remove gradle.bat and simply expect that Linux packages should be built on Linux...

Error message at "/var/lib/dpkg/info/openhab2.postinst" with fresh installation

Hello, this is my first entry ever in GitHub, so bear with me. When I recently did a fresh install of the openHAB2 SNAPSHOT on a RaspberyPi with Raspbian Jessie, I encountered the following error in the post installation script:

The following NEW packages will be installed:
openhab2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 53.2 MB of archives.
After this operation, 60.0 MB of additional disk space will be used.
Get:1 http://openhab.jfrog.io/openhab/openhab-linuxpkg/ unstable/main openhab2 all 2.1.0 20170314145804-1 [53.2 MB]
Fetched 53.2 MB in 30s (1,760 kB/s)
Selecting previously unselected package openhab2.
(Reading database ... 156452 files and directories currently installed.)
Preparing to unpack .../openhab2_2.1.0 20170314145804-1_all.deb ...
Unpacking openhab2 (2.1.0 20170314145804-1) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up openhab2 (2.1.0 20170314145804-1) ...
/var/lib/dpkg/info/openhab2.postinst: 81: [: Illegal number: configure

A quick look at the script at line 81 showed this:

case "$1" in
configure|1|2)
if [ -z $2 ] && [ $1 -ne 2 ] ; then # this is a fresh installation
if [ -x /bin/systemctl ] ; then
echo "### NOT starting on installation, please $
echo " sudo /bin/systemctl daemon-reload"
echo " sudo /bin/systemctl enable openhab2.serv$
echo "### You can start openhab2 by executing"
echo " sudo /bin/systemctl start openhab2.servi$
elif [ -x /usr/sbin/update-rc.d ] ; then

It seems it's only about the instructions on how to install openHAB2 as a service. So, I did not miss much and was able to continue. However, I suppose that it should get fixed for future users.

I wasn't able to figure out what's wrong, so I leave it here for the experts to fix.

Cheers,
Andreas

Detect use of non-standard service file

Installation or upgrade should detect if there is an existing service file that isn't /usr/lib/systemd/system/openhab2.service.

Recommended action is to remove anything that isn't the above file. I'm not sure how, but some users have a service file that isn't part of the apt installation that exists in /lib/systemd/system. This is likely due to using rc.init methods which are overridden.

Automatic updates with ppa (Ubuntu 14.04)

on your request here: openhab/openhab-distro#327

I've installed openhab2-offline with the snapshot ppa. My system installs updates every night. After more updates openhab doesn't run without a complete system reboot.

All UI's have an "ERR_CONNECTION_REFUSED" in the browser, and "sudo service openhab2 status" returns a "Ignoring predefined value for KARAF_HOME - status: Not running..."

An "ps -ef | grep openhab" return a lot of running processes (actually 8).

Any hint to prevent this behavior for a openhab noob?

At the moment i've stopped the automatic updates for openhab with "sudo apt-mark hold openhab2", but this is only a workaround :)

Thx for your great work, i love Openhab!

Huaba

Provide info command for openhab-cli

A command that can be used for quick diagnostic information should be added to the CLI:

user@server:~ $ openhab-cli info

Version:        2.2.0-SNAPSHOT
User Groups:    The user 'openhab' belongs to groups 'openhab tty dialout'
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   | /var/log/openhab2              | openhab:openhab
                OPENHAB_BACKUPS  | /var/lib/openhab2/backups      | openhab:openhab

@ThomDietrich, can you think of any other stat that may be useful here?

Openhab user is not member of audio group

The openhab user created is not a member of the audio group. This is necessary of course to play audio.
This is a small issue but if you don't know it can take a while. Foremost because there isn't any error logged.

Linux distro: Ubuntu 16.04

sysVinit Upgrade from RC1 - Requires reboot of OS

This issue is related to the tests for this PR #24 . An upgrade of sysVinit systems from RC1 to 2.0.0 requires a reboot of the OS.

First of all I think you don't have to reboot, but have to kill the running openHAB server with kill -9 $OHPID.

I've made some tests with debian 7 and I think the upgrade is not working because the openHAB server from the previous installation is not reliable stopped. I think it is a bug of karaf because calling /usr/share/openhab2/runtime/bin/stop returns with exit code 0 but the process is still running and needs some extra time stop.

I'm preparing a PR with a workaround.

Reinstallation with apt-get on RPI, Karaf doesnt react.

Hello,

i posted an issue on openhab-distro and was delegated to here by @BClark09.

Maybe someone here thinks this schould be solved.

Following the uninstall and install opening the Karaf console takes very long. I uninstalled and reinstalled openhab twice because i was very impatient the first time i tried opening Karaf after uninstallation. I Also restartet the RPI. But then i got following message:

ssh -p 8101 openhab@localhost
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:XXX Please contact your system administrator. Add correct host key in /home/pi/.ssh/known_hosts to get rid of this message. Offending RSA key in /home/pi/.ssh/known_hosts:1 remove with: ssh-keygen -f "/home/pi/.ssh/known_hosts" -R [localhost]:8101 RSA host key for [localhost]:8101 has changed and you have requested strict checking. Host key verification failed.

The answer is to delete the RSA key from the known host. But shouldnt that also be taken care of when uninstalling? Maybe addig following line to the tutorial or imlement it in the uninstall routoine would be a solution.
ssh-keygen -f "/home/pi/.ssh/known_hosts" -R [localhost]:8101

I think at least cleaning up all thinks that could have been initialized is a good way of uninstalling! Maybe i´m just to precise.

Thank you in advance,
Josua

Installation should not include .bat or contrib files.

The purpose of openhab-linuxpkg is to provide a fully configured (but editable) installation of openHAB 2. There should be no need to package the .bat files in /usr/share/openhab2, nor should the service templates exist in /usr/share/openhab2/runtime/bin/contrib as these are provided already. Seems wasteful to include them in the package and should therefore be excluded.

@ThomDietrich wdyt?

Debian packages lack dependency on java

Debian packages are missing a required dependency on java. Following installation steps on a blank debian minimal works but daemon is unable to start because java is missing.

I think a "Depends: java8-runtime-headless" should be added.

init.d restart does not wait for process to stop

  • restart should wait for process to stop, otherwise it doesn't work
  • stop, if the pidfile is incorrect, then it should also check for the existing process and stop it
  • rework into functions so we can re-use logic for stop/start in the restart call

"apt-get upgrade" reinstalls same version

This may be by design, but on the cutting edge cloudbees apt configuration, each time you run apt-get upgrade, apt-get will reinstall OH2 regardless of whether the repo version is the same as the current version.

openhab2 incorrectly does not depend on java

I could install openhab2 on a raspian (Jessie) system without previous installation of any java runtime.

I created /etc/apt/sources.list.d/openhab2.list with the following contents:
deb https://dl.bintray.com/openhab/apt-repo2 stable main
$ aptitude update
$ aptitude install openhab2
worked without any mention of java.

Only when looking into journalctl I saw the following lines:
Aug 28 21:15:51 z3 start.sh[524]: /usr/share/openhab2/runtime/bin/setenv: line 176: type: java: not found
Aug 28 21:15:51 z3 start.sh[524]: /usr/share/openhab2/runtime/bin/setenv: line 179: die: command not found

This was issue #526, openhab/openhab-distro#526

apt-repo2 testing is older than stable

Hi there,

I installed openHAB for the first time and decided to go for testing packages, as they promise a trade off between freshness and stability. Two days later I noticed that openhab.org offers downloads for version 2.1 where I had 2.0.0-RC1 installed.

My expectation was, that the versions in the repositories always fulfill unstable >= testing >= stable.
If this promise is not fulfilled the documentation should state that testing and stable repositories should be active at the same time (the only other possibility interpreting the docs).

Thanks and kind regards,
Andre

(Follow-up to openhab/openhab-distro#545)

Install repo paths on install or update

If it doesn't exist already, we should add the openHAB repository to the sources list.

The repo/list file should enable the current repository by default.

For apt based Linux:

/etc/apt/sources.list.d/openhab2.list

### openHAB 2.X Repositories ###

# This file contains the repos for the different versions of openHAB.
# Remove the hash comment on the deb line to enable a particular repo

## openHAB Stable Repository
deb https://dl.bintray.com/openhab/apt-repo2 stable main

## openHAB Testing Repository
#deb https://openhab.jfrog.io/openhab/openhab-linuxpkg testing main

## openHAB Snapshot Repository
#deb https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable main

For rpm based Linux

/etc/yum.repos.d/openhab2.repo

### openHAB 2.X Repositories ###

# This file contains the repos for the different versions of openHAB.
# set enabled to 1/0 to enable/disable a repo respectively

[openHAB-Stable]
name=openHAB 2.x.x Snapshots
baseurl=https://dl.bintray.com/openhab/rpm-repo2/stable
gpgcheck=1
gpgkey=https://bintray.com/user/downloadSubjectPublicKey?username=openhab
enabled=1

[openHAB-Testing]
name=openHAB 2.x.x Snapshots
baseurl=https://openhab.jfrog.io/openhab/openhab-linuxpkg-rpm/testing
gpgcheck=1
gpgkey=https://bintray.com/user/downloadSubjectPublicKey?username=openhab
enabled=0

[openHAB-Snapshots]
name=openHAB 2.x.x Snapshots
baseurl=https://openhab.jfrog.io/openhab/openhab-linuxpkg-rpm/unstable
gpgcheck=1
gpgkey=https://bintray.com/user/downloadSubjectPublicKey?username=openhab
enabled=0

Check for errors in logs when using openhab-cli info

Show for example:

Version:     4.0.0 (Build)

User:        openhab (Active Process 15929)
User Groups: openhab tty dialout audio bluetooth

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

URLs:        http://0.0.0.0:8080
             https://0.0.0.0:8443

Warning:     There are errors in your logs!
             Please check the contents of them using the commands (use q to exit):
                 journalctl -b -u openhab.service
                 less /var/log/openhab/openhab.log

client script misbehaving since recent build

Hello,
I suspect this to be one of the implications of the recent Karaf upgrade or the recent changes here. It seems like the client script is not working properly any longer. I have an idea what's going on but I believe @BClark09 has a better understanding of all these files by now.
Please let me know how I can help fix this issue! ;) Best!

sudo su -s /bin/bash -c '/usr/share/openhab2/runtime/bin/client' openhab
mkdir: cannot create directory ‘/usr/share/openhab2/userdata/tmp’: No such file or directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata

Move nightly builds to Artifactory

Artifactory needs to be the container for nightly builds of openHAB. I have started a branch here:

List of things to do (or have been done):

  • Change references of bintray to artifactory.
  • Make sure upload syntax matches new spec.
  • Make sure metadata is calculated on each upload.
  • Test the downloads of these packages using apt-get for deb https://openhab.jfrog.io/openhab/debian-local unstable main
  • Add a GPG key to Artifactory, and use this to sign packages. Could you help with this @theoweiss?
  • Restart the CI build.

Upgrade fails to launch

I am new to openHAB world and I have worked with it a little on my pine64. I had the server working for a while. Until I decided to upgrade from my openHAB 2 - offline to the recently released openhab2 713. It has not gone well. And I am at a loss as to how to correct the permission problems I appear to have. Any help would be appreciated. Here is the problem:

● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-01-10 16:15:57 EST; 13min ago
Docs: http://docs.openhab.org
https://community.openhab.org
Process: 11392 ExecStop=/usr/share/openhab2/runtime/bin/stop (code=exited, status=3)
Process: 11214 ExecStart=/usr/share/openhab2/start.sh server (code=exited, status=255)
Main PID: 11214 (code=exited, status=255)

Jan 10 16:15:54 pine64 start.sh[11214]: Unable to update instance pid: /usr/share/openhab2/runtime/instances/instance.properties (Permission denied)
Jan 10 16:15:55 pine64 start.sh[11214]: /var/log/openhab2/openhab.log (Permission denied)
Jan 10 16:15:55 pine64 start.sh[11214]: Unable to update instance pid: /usr/share/openhab2/runtime/instances/instance.properties (Permission denied)
Jan 10 16:15:55 pine64 systemd[1]: openhab2.service: Main process exited, code=exited, status=255/n/a
Jan 10 16:15:55 pine64 stop[11392]: stop: Ignoring predefined value for KARAF_HOME
Jan 10 16:15:57 pine64 stop[11392]: /var/lib/openhab2/tmp/port shutdown port file doesn't exist. The container is not running.
Jan 10 16:15:57 pine64 systemd[1]: openhab2.service: Control process exited, code=exited status=3
Jan 10 16:15:57 pine64 systemd[1]: Stopped openHAB 2 - empowering the smart home.
Jan 10 16:15:57 pine64 systemd[1]: openhab2.service: Unit entered failed state.
Jan 10 16:15:57 pine64 systemd[1]: openhab2.service: Failed with result 'exit-code'.

Here is what I did: openhab2 user has admin privileges.

sudo apt-get purge openhab2
sudo rm /etc/apt/sources.list.d/openhab2.list
echo 'deb http://dl.bintray.com/openhab/apt-repo2 unstable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -

sudo apt-get update
sudo apt-get install openhab2
sudo reboot

Sudo systemctl start openhab2.service

It failed due to permissions, so I tried….

sudo chown openhab2:openhab2 /usr/share/openhab2
sudo chown openhab2:openhab2 /etc/openhab2
sudo chown openhab2:openhab2 /var/log/openhab2
sudo chown openhab2:openhab2 /var/lib/openhab2

Which resulted in:
openhab2@pine64:~$ ls -l /usr/share/openhab2
total 32
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 15:34 addons
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 15:33 bin
-rw-rw-r-- 1 openhab2 openhab2 11232 Jan 9 18:18 LICENSE.TXT
drwxrwxr-x 7 openhab2 openhab2 4096 Jan 10 15:52 runtime
-rwxr-xr-x 1 openhab2 openhab2 73 Jan 9 18:18 start_debug.sh
-rwxrwxr-x 1 openhab2 openhab2 116 Jan 9 18:18 start.sh

openhab2@pine64:~$ ls -l /etc/openhab2
total 48
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 17:54 Demo files
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 html
drwxrwxr-x 3 openhab2 openhab2 4096 Jan 8 17:06 icons
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 items
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 persistence
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 rules
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 scripts
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 services
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 sitemaps
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 sounds
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 things
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:08 transform

openhab2@pine64:~$ ls -l /var/log/openhab2
total 0
-rwxr-xr-x 1 openhab2 openhab2 0 Jan 9 18:18 Readme.txt

openhab2@pine64:~$ ls -l /var/lib/openhab2
total 28
drwxr-xr-x 6 openhab2 openhab2 4096 Jan 9 10:38 config
drwxrwxr-x 2 openhab2 openhab2 4096 Jan 10 11:26 etc
drwxr-xr-x 2 openhab2 openhab2 4096 Jan 9 10:35 hueemulation
drwxr-xr-x 3 openhab2 openhab2 4096 Jan 9 10:40 jsondb
drwxr-xr-x 2 openhab2 openhab2 4096 Jan 8 17:10 log
drwxr-xr-x 5 openhab2 openhab2 4096 Jan 10 11:08 persistence
drwxr-xr-x 2 openhab2 openhab2 4096 Jan 10 11:26 tmp

start.sh fails on (at least) debian packages if called directly

See https://community.openhab.org/t/oh2-3-fails-to-start/52064/3

As that's not documented (or as it may be but people didn't read it, at least I couldn't find it), I believe we can avoid a number of people to run into trouble if we check the startup/user environment we're in before proceeding.

According to @BClark09:
This happens because the environment variables that specify where each folder is aren't set yet.
We can override/replace these scripts in the package to correct this.

Change snapshot version numbering to include build number

Currently, we use a timestamp to mark the time that the package was built i.e. 2.4.0~20181122121212-1 but without inspection on the CI server, it is difficult to tell which build number this relates to. The build number is often referred to on the community when debugging or referencing versions.

We could use the distro build number for the version number, which would give use more easily identifiable versions, such as 2.4.0~S1234-1 or 2.4.0~Snapshot1234-1. If we ever needed to build more than one apt/yum package off the same build (unlikely) then we should use the release number: i.e. 2.4.0~S1234-2

Related Community thread

openhab-cli: tail vs. multitail, function override

"showlogs"|"logs")
tail -f "${OPENHAB_LOGDIR:?}"/*.log
;;

@BClark09 openHABian now includes a multitail color scheme: openhab/openhabian#196

How do you feel about multitail vs tail? The two panes and colors of multitail are clearly nice but I sometimes miss the option to scroll back up in tail (in my console). Which do you favor?
(If you want to see the difference, execute openhablog, openhablog2 and openhablog3 on a fresh openHABian system.)

Going one step further, I wonder if it would be beneficial to be able to tune the behavior of the stiff distribution script openhab-cli on an openHABian system or potentially other systems. I'd fancy the option to modify how and what openhab-cli presents when called with the showlogs argument. How do you feel about the following proposal: IF certain alias exists THEN execute alias ELSE execute default routine. We could add such a behavior to all subroutines (even though I'd be interested in the log one).

What do you think? Did I miss anything? A potential security risk maybe?

Initial work

I've opened a PR for the initial checkin #1. I want to use this issue to discussing the further development. Here is a to-do list with the next things which have to be done. For sure the list is not complete, just add further to-dos if they are necessary.

Todo list for openhab b5

  • test debian packages from gradle build
    • fresh installation
    • upgrades from current cloudbees snapshot
    • upgrades from gradle snapshots
    • for openhab2-offline and openhab2-online builds
  • fix bugs in gradle build
  • remove deb and apt-repo build from openhab-distro project
  • add release task for b5
  • add release task for snapshots
  • release snapshots to bintray (replacement for apt-repo plugin)
  • integrate snapshot build and release into cloudbees
  • update projects Readme.md
  • update docs
  • test test test debian packages

Todo list for openhab 2.0.0

  • stabilize deb build
  • build and release rpm packages

Unlinked Channels after restart ObenHab

Hello.
Since installing Openhabian 1.4 with Stable 2.2 i see, that some Linked Channels in PaperUI are unlinked after a Reboot or restart. Not always the same things/channels. Different Bindings.

What can i do here? Sometimes i have to restart my pi and then i can't always go through all Things (more than ~130) and check all Linked Items.

Do You Know the Problem?

Thanks

Tobi

Reinstall fails due to existing user

The above is just my first theory. I've executed sudo apt purge openhab2. An error was shown:

Purging configuration files for openhab2 (2.2.0-1) ...
userdel: user openhab is currently used by process 597
/usr/sbin/deluser: `/usr/sbin/userdel openhab' returned error code 8. Exiting.
/usr/sbin/delgroup: `openhab' still has `openhab' as their primary group!

Next I reinstalled openhab2 but the service was not able to start:

Jan 16 11:19:01 openHABianPiFuchsbau systemd[1]: Started openHAB 2 - empowering the smart home.
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: !SESSION 2018-01-16 11:19:04.204 -----------------------------------------------
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: eclipse.buildId=unknown
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: java.version=1.8.0_152
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: java.vendor=Azul Systems, Inc.
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: BootLoader constants: OS=linux, ARCH=arm, WS=gtk, NL=en_US
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: !ENTRY org.eclipse.osgi 4 0 2018-01-16 11:19:04.205
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: !MESSAGE Error reading configuration: Unable to create lock manager.
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: !STACK 0
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: java.io.IOException: Unable to create lock manager.
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:698)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1792)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1809)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.storage.Storage.<init>(Storage.java:129)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:88)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.apache.karaf.main.Main.launch(Main.java:256)
Jan 16 11:19:04 openHABianPiFuchsbau karaf[23673]: #011at org.apache.karaf.main.Main.main(Main.java:179)
Jan 16 11:19:04 openHABianPiFuchsbau systemd[1]: openhab2.service: Main process exited, code=exited, status=255/n/a
Jan 16 11:19:06 openHABianPiFuchsbau karaf[23806]: /var/lib/openhab2/tmp/port shutdown port file doesn't exist. The container is not running.
Jan 16 11:19:06 openHABianPiFuchsbau systemd[1]: openhab2.service: Control process exited, code=exited status=3
Jan 16 11:19:06 openHABianPiFuchsbau systemd[1]: Stopped openHAB 2 - empowering the smart home.
Jan 16 11:19:06 openHABianPiFuchsbau systemd[1]: openhab2.service: Unit entered failed state.
Jan 16 11:19:06 openHABianPiFuchsbau systemd[1]: openhab2.service: Failed with result 'exit-code'.

The problem was solved by another purge followed by a manual removal of the user (after stopping the other service under the user), followed by a successful reinstall.

Related to openhab/openhabian#285

Add reset commands to openhab-cli

Two commands would be useful here:

One that resets the files in userdata/etc to the packaged versions. Possibly by deleting them then restoring them with conf-miss (and whatever the rpm equivalent is)

One that resets ownership of everything to openhab:openhab @ThomDietrich, I understand that openhabian already does this. Would it make sense to reuse code here?

Package ordering

When I apt-get (dist-)upgrade on my openHABian (or any debian), it'll offer me the packages to upgrade in a particular order, openhab2 being first and openhab2-addons(-legacy) after.
Now that resulted in openhab2 being (re)started without that the next package was installed (apt-get was still busy downloading that).
So that results in the updated OH2 version running against old addons, and a "restart" of that addons part of the code whenever the remaining packages installed successfully.
Not sure about the full impact but one for sure thing is that it'll delay startup (and given the large number of users to run on RPi that's not to be underestimated as a problem/improvement).

Shouldn't we sort of rework-reorder-whatever this to force addons to get installed BEFORE main OH2?
Not sure if we can simply change the order of packages the repo offers, or how to accomplish that at all.

Build Release/Testing Distribution Task

Previously, I have been setting up stable releases and testing releases manually using the web UI. The jfrog REST api allows us to deploy artifacts to Bintray:

I've now setup the distribution repo to sort .rpm and .deb files, and automatically calculate the path to place in Bintray, all we need to do is select the file place it "in" the distribution repo.

To do that we must:

  • Build a task named deployToBintray that:
    • Finds or creates the artifact path stored on jFrog and store as $packagePath
    • Deploys $packagePath to openhab-linuxpkg-distribution distribution repository
  • Test the task using dryRun=true
  • Setup deployToBintray to run on cloudbees after buildRelease or buildTesting
  • Finish by running the task CalculateMetadata

Example:

task deployToBintray(type:Exec) {
  def distributeRepo = 'openhab-linuxpkg-distribution'
  def distributeURL = ''https://openhab.jfrog.io/${ARTIFACTORY_ORG}/api/distribute"
  def packagePath = "openhab-linuxpkg/pool/main/2.1.0/openhab2_2.1.0-1_all.deb"

  executable "curl"
  args '-X', 'POST', '-H', "X-JFrog-Art-Api: ${ARTIFACTORY_KEY}", '-H', 'Content-Type: application/json', '-d', "{\"targetRepo\" : \"${distributeRepo}\", \"packagesRepoPaths\" : [\"${packagePath}\"]}, "${distributeURL}"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.