Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up OpenHAB environment on rpi2 #330

Closed
1 task done
130s opened this issue Jan 2, 2019 · 17 comments
Closed
1 task done

Set up OpenHAB environment on rpi2 #330

130s opened this issue Jan 2, 2019 · 17 comments

Comments

@130s
Copy link
Collaborator

130s commented Jan 2, 2019

Following #268


Some tasks taken from #100 (comment)

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

Using https://github.com/openhab/openhab-snap, it seems failing:

uo130s@localhost:~$  sudo snap install openhab
error: cannot perform the following tasks:
- Download snap "openhab" (174) from channel "stable" (write /var/lib/snapd/snaps/openhab_174.snap.partial: structure needs cleaning)
uo130s@localhost:~$ 

@130s 130s added this to the 201901 milestone Jan 2, 2019
@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

After a few times of rebooting the OS, I now got a different error:

$ sudo snap install openhab
error: cannot communicate with server: Post http://localhost/v2/snaps/openhab: EOF

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

sudo journalctl -u snapd.service
:
Jan 02 08:47:25 localhost.localdomain snapd[1562]: goroutine 5 [running]:                 
Jan 02 08:47:25 localhost.localdomain snapd[1562]: panic(0xe8ee00, 0x119340a8)            
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /usr/lib/go-1.6/src/runtime/pancf
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/logger.Panicf(0x109f3a8, 0x37, 0x1152ebc4, 0x3, 0x3)
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/logger/logger.go:67 +0x14c
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/overlord/state.(*State).Unlock(0x116e0100)                                    
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/state/state.go:235 +0x310
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/overlord/snapstate.(*autoRefresh).Ensure(0x1173aa50, 0x0, 0x0)                        
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/snapstate/autorefresh.go:299 +0xee0
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).Ensure(0x1173aa80, 0x0, 0x0)
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/snapstate/snapmgr.go:540 +0xa4
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/overlord.(*StateEngine).Ensure(0x11737540, 0x0, 0x0)                                       
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/stateengine.go:99 +0x194      
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/overlord.(*Overlord).Loop.func1(0x0, 0x0)                                                  
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/overlord.go:262 +0x48         
Jan 02 08:47:25 localhost.localdomain snapd[1562]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0x1150c150, 0x118301b0)                              
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x1c
Jan 02 08:47:25 localhost.localdomain snapd[1562]: created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 02 08:47:25 localhost.localdomain snapd[1562]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0x134
Jan 02 08:47:25 localhost.localdomain systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 02 08:47:25 localhost.localdomain systemd[1]: snapd.service: Unit entered failed state.                                
Jan 02 08:47:25 localhost.localdomain systemd[1]: snapd.service: Failed with result 'exit-code'.                           
Jan 02 08:47:26 localhost.localdomain systemd[1]: snapd.service: Service hold-off time over, scheduling restart.           
Jan 02 08:47:26 localhost.localdomain systemd[1]: Stopped Snappy daemon.                                                   
Jan 02 08:47:26 localhost.localdomain systemd[1]: Starting Snappy daemon...                                                
Jan 02 08:47:26 localhost.localdomain snapd[1587]: AppArmor status: apparmor is enabled and all features are available     
Jan 02 08:47:26 localhost.localdomain snapd[1587]: 2019/01/02 08:47:26.700976 daemon.go:343: started snapd/2.33.1 (series 16) ubuntu-core/16 (armhf) linux/4.4.0-1092-raspi2.
Jan 02 08:47:26 localhost.localdomain systemd[1]: Started Snappy daemon.                  
Jan 02 08:47:28 localhost.localdomain snapd[1587]: 2019/01/02 08:47:28.952405 storehelpers.go:413: cannot refresh snap "pi2": snap has no updates available 

@130s
Copy link
Collaborator Author

130s commented Jan 5, 2019

Tried out some commands recommended in the thread similar error is discussed:
Btw some commands (snap version, snap list) take a few minutes to return.

$ systemctl status snapd
● snapd.service - Snappy daemon
   Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-01-05 23:15:37 UTC; 2min 12s ago
 Main PID: 22219 (snapd)
   CGroup: /system.slice/snapd.service
           └─22219 /usr/lib/snapd/snapd
$ snap list
Name        Version         Rev   Tracking  Developer  Notes
core        16-2.33.1       4916  stable    canonical  core
pi2         16.04-0.17      29    stable    canonical  gadget
pi2-kernel  4.4.0-1092.100  56    stable    canonical  kernel

$ snap version
snap    2.33.1
snapd   unavailable
series  -
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            455M     0  455M   0% /dev
tmpfs            93M   14M   79M  15% /run
/dev/mmcblk0p2  296M  290M     0 100% /writable
/dev/loop0       74M   74M     0 100% /
/dev/loop1      129M  129M     0 100% /lib/modules
tmpfs           461M  4.0K  461M   1% /etc/fstab
tmpfs           461M     0  461M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           461M     0  461M   0% /sys/fs/cgroup
tmpfs           461M     0  461M   0% /media
tmpfs           461M     0  461M   0% /mnt
tmpfs           461M     0  461M   0% /var/lib/sudo
tmpfs           461M     0  461M   0% /tmp
/dev/loop2       74M   74M     0 100% /snap/core/4916
/dev/loop3      3.8M  3.8M     0 100% /snap/pi2/29
/dev/loop4      129M  129M     0 100% /snap/pi2-kernel/56
/dev/mmcblk0p1  127M   16M  111M  13% /boot/uboot
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs            93M     0   93M   0% /run/user/1000

$ sudo journalctl -f -u snapd
-- Logs begin at Fri 2019-01-04 15:09:48 UTC. --
Jan 05 23:20:40 localhost.localdomain systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 05 23:20:40 localhost.localdomain systemd[1]: snapd.service: Unit entered failed state.
Jan 05 23:20:40 localhost.localdomain systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 05 23:20:40 localhost.localdomain systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 05 23:20:40 localhost.localdomain systemd[1]: Stopped Snappy daemon.
Jan 05 23:20:40 localhost.localdomain systemd[1]: Starting Snappy daemon...
Jan 05 23:20:40 localhost.localdomain snapd[22316]: AppArmor status: apparmor is enabled and all features are available
Jan 05 23:20:40 localhost.localdomain snapd[22316]: 2019/01/05 23:20:40.875434 daemon.go:343: started snapd/2.33.1 (series 16) ubuntu-core/16 (armhf) linux/4.4.0-1092-raspi2.
Jan 05 23:20:40 localhost.localdomain systemd[1]: Started Snappy daemon.
Jan 05 23:20:42 localhost.localdomain snapd[22316]: 2019/01/05 23:20:42.924077 storehelpers.go:413: cannot refresh snap "pi2": snap has no updates available

Jan 05 23:25:43 localhost.localdomain snapd[22316]: 2019/01/05 23:25:43.143721 state.go:235: PANIC cannot checkpoint even after 5m0s of retries every 3s: write /var/lib/snapd/state.json.srD9QjJDy5Td~: no space left on device
Jan 05 23:25:43 localhost.localdomain snapd[22316]: panic: cannot checkpoint even after 5m0s of retries every 3s: write /var/lib/snapd/state.json.srD9QjJDy5Td~: no space left on device
Jan 05 23:25:43 localhost.localdomain snapd[22316]: goroutine 26 [running]:
Jan 05 23:25:43 localhost.localdomain snapd[22316]: panic(0xea8e00, 0x1198e0e8)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /usr/lib/go-1.6/src/runtime/panic.go:481 +0x370
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/logger.Panicf(0x10b93a8, 0x37, 0x1152fbc4, 0x3, 0x3)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/logger/logger.go:67 +0x14c
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/overlord/state.(*State).Unlock(0x116a3500)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/state/state.go:235 +0x310
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/overlord/snapstate.(*autoRefresh).Ensure(0x11721110, 0x0, 0x0)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/snapstate/autorefresh.go:299 +0xee0
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).Ensure(0x11721140, 0x0, 0x0)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/snapstate/snapmgr.go:540 +0xa4
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/overlord.(*StateEngine).Ensure(0x11727540, 0x0, 0x0)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/stateengine.go:99 +0x194
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/overlord.(*Overlord).Loop.func1(0x0, 0x0)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/overlord/overlord.go:262 +0x48
Jan 05 23:25:43 localhost.localdomain snapd[22316]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0x116a6810, 0x1173b318)
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x1c
Jan 05 23:25:43 localhost.localdomain snapd[22316]: created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 05 23:25:43 localhost.localdomain snapd[22316]:         /build/snapd-22JIGV/snapd-2.33.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0x134
Jan 05 23:25:43 localhost.localdomain systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 05 23:25:43 localhost.localdomain systemd[1]: snapd.service: Unit entered failed state.
Jan 05 23:25:43 localhost.localdomain systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 05 23:25:43 localhost.localdomain systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 05 23:25:43 localhost.localdomain systemd[1]: Stopped Snappy daemon.
Jan 05 23:25:43 localhost.localdomain systemd[1]: Starting Snappy daemon...
Jan 05 23:25:43 localhost.localdomain snapd[22358]: AppArmor status: apparmor is enabled and all features are available
Jan 05 23:25:43 localhost.localdomain snapd[22358]: 2019/01/05 23:25:43.988432 daemon.go:343: started snapd/2.33.1 (series 16) ubuntu-core/16 (armhf) linux/4.4.0-1092-raspi2.
Jan 05 23:25:43 localhost.localdomain systemd[1]: Started Snappy daemon.
Jan 05 23:25:46 localhost.localdomain snapd[22358]: 2019/01/05 23:25:46.101986 storehelpers.go:413: cannot refresh snap "pi2": snap has no updates available

@130s
Copy link
Collaborator Author

130s commented Jan 5, 2019

I'm getting to convinced that the board I'm using is RPi3 (this kit from Sparkfun) but the image might be RPi2 specific. Will wipe out and try RPi3 image.

@130s
Copy link
Collaborator Author

130s commented Jan 6, 2019

I think the Pi device I've been stuck with is RPi2 (this kit from Sparkfun. The one in #330 (comment) is not the one I'm using for this ticket I suppose).

@130s
Copy link
Collaborator Author

130s commented Jan 6, 2019

Asked on snapcraft about Ubuntu Core community.

@130s
Copy link
Collaborator Author

130s commented Jan 11, 2019

Not sure btw if openhab/openhab-snap#8 is related.

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

Using a branch new SD card, Ubuntu Core seems to be working much smoothly #332 (comment), and openhab seems to have been installed.

uo130s@localhost:~$ sudo snap install openhab
openhab 2.0.0 from openHAB Foundation e.V. (openhab) installed

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

Not entirely sure but Ubuntu Core only allows ssh login by ssh pub keys? So on shell every time I need to run:

ssh-add %PRIVATEKEY_PATH%

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

  • Run basic functionality of OpenHAB

Confirmed http://%HOSTIP%:8080 takes me to the web control panel.

@130s 130s mentioned this issue Feb 2, 2019
3 tasks
@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

  • Z-wave connectivity via Razberry with other Z-wave devices
  • Controlling Z-wave devices via Z-Way panel.
  • Controlling Z-Wave devices via OpenHAB Z-Wave binding.

Delegated to #338

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

Upstream latest is 2.4 while Snap is still 2.0 openhab/openhab-distro#542. Decided to source build.

$ sudo snap info openhab 
name:      openhab
summary:   openHAB smart home server
publisher: openHAB Foundation e.V. (openhab)
contact:   snaps@canonical.com
license:   unset
description: |
  openHAB - a vendor and technology agnostic open source automation software for your home.
commands:
  - openhab.clean
  - openhab.client
  - openhab.debug
  - openhab.help
  - openhab.start
  - openhab.status
  - openhab.stop
services:
  openhab: simple, enabled, active
snap-id:      WpdPxW72JupkC8XTgaJsig3LEHdrR56x
tracking:     stable
refresh-date: today at 08:44 UTC
channels:
  stable:    2.0.0          2017-11-14 (174) 101MB -
  candidate: 2.1.0          2017-11-11 (212) 138MB -
  beta:      2.2.0-SNAPSHOT 2017-11-09 (201) 147MB -
  edge:      2.2.0-SNAPSHOT 2017-11-09 (201) 147MB -
installed:   2.0.0                     (174) 101MB -

@130s 130s reopened this Feb 2, 2019
@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

Looks like multiple options are available for setting openHAB, not just source build necessarily (2.4 release note). But maybe source build is the only option for Ubuntu Core?

  • openHABian -> looks like SD card image solution.
  • apt, yum are not available on snap I think.

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

On Ubuntu Core, sounds like apt is basically not available https://askubuntu.com/questions/902905/install-applications-in-ubuntu-core/925505#925505

Developer mode, which can be enabled by installing a classic" snap, allows apt. Someone said it's too restrictive with chroot being required. I have a feeling this is not the road I want to go down.

So, will try source install. Source install openHAB on linux https://www.openhab.org/docs/installation/linux.html#manual-installation

@130s
Copy link
Collaborator Author

130s commented Feb 2, 2019

$ sudo adduser --system --no-create-home --group --disabled-login openhab
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_PAPER = "en_US.UTF-8",
	LC_ADDRESS = "en_US.UTF-8",
	LC_MONETARY = "en_US.UTF-8",
	LC_NUMERIC = "en_US.UTF-8",
	LC_TELEPHONE = "en_US.UTF-8",
	LC_IDENTIFICATION = "en_US.UTF-8",
	LC_MEASUREMENT = "en_US.UTF-8",
	LC_TIME = "en_US.UTF-8",
	LC_NAME = "en_US.UTF-8",
	LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
Adding system user `openhab' (UID 111) ...
Adding new group `openhab' (GID 112) ...
groupadd: cannot lock /etc/group; try again later.
adduser: `/usr/sbin/groupadd -g 112 openhab' returned error code 10. Exiting.

Using --extrausers is suggested but it didn't work smoothly. Now I'm afraid user db might be corrupted.

$ sudo adduser --system --no-create-home --group --disabled-login --extrausers openhab

uo130s@localhost:/var/log$ sudo adduser --extrausers openhab 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_PAPER = "en_US.UTF-8",
	LC_ADDRESS = "en_US.UTF-8",
	LC_MONETARY = "en_US.UTF-8",
	LC_NUMERIC = "en_US.UTF-8",
	LC_TELEPHONE = "en_US.UTF-8",
	LC_IDENTIFICATION = "en_US.UTF-8",
	LC_MEASUREMENT = "en_US.UTF-8",
	LC_TIME = "en_US.UTF-8",
	LC_NAME = "en_US.UTF-8",
	LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
Adding user `openhab' ...
Adding new group `openhab' (1001) ...
ENTER EXTRAUSERS_GROUP_FILEEXIT EXTRAUSERS_GROUP_FILEENTER EXTRAUSERS_SHADOWGROUP_FILEEXIT EXTRAUSERS_SHADOWGROUP_FILEAdding new user `openhab' (1001) with group `openhab' ...
Creating home directory `/home/openhab' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
No password supplied
Enter new UNIX password: 
Retype new UNIX password: 
No password supplied
Enter new UNIX password: 
Retype new UNIX password: 
No password supplied
passwd: Authentication token manipulation error
passwd: password unchanged
Try again? [y/N] 
Changing the user information for openhab
Enter the new value, or press ENTER for the default
	Full Name []: ^Cadduser: `/usr/bin/chfn --extrausers openhab' exited from signal 2. Exiting.
uo130s@localhost:/var/log$ sudo adduser --system --no-create-home --disabled-login --extrausers openhab 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_PAPER = "en_US.UTF-8",
	LC_ADDRESS = "en_US.UTF-8",
	LC_MONETARY = "en_US.UTF-8",
	LC_NUMERIC = "en_US.UTF-8",
	LC_TELEPHONE = "en_US.UTF-8",
	LC_IDENTIFICATION = "en_US.UTF-8",
	LC_MEASUREMENT = "en_US.UTF-8",
	LC_TIME = "en_US.UTF-8",
	LC_NAME = "en_US.UTF-8",
	LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
adduser: The user `openhab' already exists. Exiting.

I'm not comfortable moving forward with this. Decided to give it a try on openHABian.

@130s
Copy link
Collaborator Author

130s commented Oct 12, 2019

It's been awhile and I'm no longer sure what is left to do for this ticket, but:

I'm not comfortable moving forward with this. Decided to give it a try on openHABian.

Looks like the RPi3 is running on it with apt package. Seems like it's been running reliably for 8 months. Closing.

n130s@openHABianPi:~ $ apt-cache policy openhab2
openhab2:
  Installed: 2.4.0-1
  Candidate: 2.4.0-1
  Version table:
 *** 2.4.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf Packages
        100 /var/lib/dpkg/status
     2.3.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf Packages
     2.2.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf Packages
     2.1.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf Packages
     2.0.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main armhf Packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant