eclipse-kura / kura

Eclipse Kura™ is a versatile framework to supercharge your edge devices, streamlining the process of configuring your gateway, connecting sensors, and IoT devices to seamlessly collect, process, and send data to the cloud.
https://eclipse.dev/kura/
Eclipse Public License 2.0
502 stars 309 forks source link

Kura doesn't work properly on Raspberry Pi #2157

Closed mohabh88 closed 6 years ago

mohabh88 commented 6 years ago

Please describe the issue you are encountering in Kura.

Every time when trying to connect to Kura via Raspberry pi "after following the tutorial steps", internal error occurs!.

Fill the following form and provide a textual description if you are reporting a bug. Provide only a textual description otherwise.

Hi guys,

I'm trying to get to work with the Kura example, but I have some errors and it doesn't work for me properly. As stated above, I am using Raspberry PI 2 B+ with Java 1.8.0_65 preinstalled.

Basically, when installing Kura using the sudo dpkg -I kura_1.4.0_raspberry-pi-2_installer.deb or ('kura_1.3.0' for example), the dpkg complains about missing some dependencies and fails, hence, I used the sudo apt-get install -f to download them automatically. The thing is when the later command runs, it breaks the isc-dhcp-server and makes it fail on the reboot of the Raspberry Pi "plus the RPI's IP address got changed to a static one instead".

Furthermore, when accessing Kura's website to install the IoT greenhouse package, I encounter weird internal error that I am not able to fix (logs are attached at the end of the description!). Here is how the phenomenon happens:

First, navigating to the MqttDataTransport in the Services section "on the left hand side of the screen" and changing the broker-url to mqtt://iot.eclipse.org:1883/ and setting the connect.auto-on-startupto true from the DataService section, Kura encounters internal server error on Connect and doesn't let me to proceed "i.e., remains disconnected".

Moreover, when trying to install the http://iot.eclipse.org/java/demo/org.eclipse.greenhouse.iot-0.1.0.dp package in the "install/upgrade" part in the "Packages section", it says that the file was successfully downloaded, but nothing is shown in there; the area says "no packages installed" and even no file(s) is/are found in the RPI folders. In turn, the Greenhouse Publisher didn't show up as expected in the "Service section".

I don't know whether the tutorial is working! I checked the connections too many times. So i think the problem is in another place.

Could you help me in some way? Thank you so much for your time.

Additional information:

The status of the isc-dhcp-server:

$ sudo service isc-dhcp-server status

isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor present: enabled)
Active: failed (Result: exit-code) since wed 2018-07-11 11:55:20 EDT; 5h 51min ago
Docs: man:system-sysv-generator(8)
Process: 625 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
Jul 11 11:55:14 raspberrypi system[1]: Starting LSB: DHCP server...
Jul 11 11:55:17 raspberrypi isc-dhcp-server[625]: Launching both IPv4 and IPv6 servers (please configure INTERFACES in /etc/default/isc-dhcp-server if you only want one or the other).
Jul 11 11:55:18 raspberrypi dhcp[674]: Wrote 0 leases to leases file.
Jul 11 11:55:20 raspberrypi dhcp[674]:
Jul 11 11:55:20 raspberrypi isc-dhcp-server[625]: Starting ISCDHCPv4 server: dhcpcheck syslog for diagnostics. ... failed!
Jul 11 11:55:20 raspberrypi isc-dhcp-server[625]: failed!
Jul 11 11:55:20 raspberrypi system[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Jul 11 11:55:20 raspberrypi system[1]: Failed to start LSB: DHCP server.
Jul 11 11:55:20 raspberrypi system[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 11 11:55:20 raspberrypi system[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

/etc/network/interfaces file contents:

$ sudo vi /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), if down(8)

# The loopback interface
auto lo
iface lo inet static
address 127.0.0.1
netmask 255.0.0.0

# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp

auto wlan0 
iface wlan0 inet static
address 172.16.1.1
netmask 255.255.255.0

$ ifconfig

eth0: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
inet 132.207.28.227 netmask 255.255.255.0 broadcast 132.207.28.255
inet6 fe80::ba27:ebff:fe9c:e18a prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:9c:e1:8a txqueuelen 1000 (Ethernet)
RX packets 41260 bytes 10561442 (10.0 MiB)
RX errors 0 dropped 400 overruns 0 frame 0
TX packets 3878 bytes 468255 (457.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP, LOOPBACK, RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 : :1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local loopback)
RX packets 3434 bytes 7217826 (6.8 MiB)
RX errors 0 dropped 400 overruns 0 frame 0
TX packets 3878 bytes 7217826 (6.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

$ telnet iot.eclipse.org 1883

Trying 198.41.30.241...
Connected to iot.eclipse.org.
Escape character is '^]'

Kura logs: kura.log kura-console.log

On a side note: Also I followed other tutorials on how to install Kura on RPI [1] http://www.opensourcerers.org/installing-and-running-eclipse-kura-on-a-raspberry-pi-b-model-1/ [2] http://eclipse.github.io/kura/intro/raspberry-pi-quick-start.html

According to them, they ask to purge dhcpcd5 and remove network manager first then install Kura; whereas according to the main tutorial https://iot.eclipse.org/java/tutorial, it installs Kura without removing/purging dhcpcd5/network manager settings. I tired both, but still the issue persists.

Thank you so much, and please let me know if additional pieces of information are needed. Looking forward to your reply. Mohab

mohabh88 commented 6 years ago

Hi @ctron. Could you please take a look and assist on this? I saw your contributions in resolving issues related to Kura from the previous tickets presented. Otherwise, could you please refer/suggest someone to assist? Thank you in advance for your time and help, that's greatly appreciated.

MMaiero commented 6 years ago

Hello @mohabh88 , let's try to go in steps. From the log you posted I saw that there are some troubles with the MQTT Data transport. Could you please report the result of ifconfig or ip addr show?

Thanks. Best regards, Matteo

mohabh88 commented 6 years ago

Hi @MMaiero, Thank you so much for replying.

Sure thing, here you are again the result of the ifconfig and ip adds show

ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 132.207.28.227 netmask 255.255.255.0 broadcast 132.207.28.255
ether b8:27:eb:9c:e1:8a txqueuelen 1000 (Ethernet)
RX packets 970 bytes 136116 (132.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 497 bytes 47311 (46.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP, LOOPBACK, RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 23 bytes 1780 (1.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23 bytes 1780 (1.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ip adds show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/loopback b8:27:eb:9c:e1:8a brd ff:ff:ff:ff:ff:ff
inet 132.207.28.227/24 brd 132.207.28.255 scope global eth0
valid_lft forever preferred_lft forever

Please let me know if additional information is needed. Looking forward to your reply! And thank you in advance for assisting :)

MMaiero commented 6 years ago

Hi, I've just tried in my installation to recreate your setup. Effectively, there seems to be some sort of incompatibility between Kura and Debian Stretch. Probably that old version of Kura uses configuration files that are incompatible with the current version of Raspbian.

If you still want to use that old version of Kura, I could suggest two paths: one could be to install from scratch and use the NN version (no network version of Kura) that will not manage the Raspberry network configuration at all. The other option, if you need kura to manage your gateway networking, is to use an older version of Debian.

Best regards, Matteo

markoer commented 6 years ago

Hi @mohabh88,

first let's take a step back and look at the broader picture. Kura 1.3.0 is almost 3 years old and 1.4.0 2.5 yo. And you're trying to run it on a relatively new OS (~1 year) and an unsupported Java (1.8 vs. 1.6). That being said, I also hope you ran dpkg -i, not dpkg -I as the former would install the package and latter would only output info about it.

DHCP server service crashing is not a Kura issue, but one resulting from server's improper initial configuration. See #1695. dhcpcd5 and networkmanager package removal was also added later on as some incompatibilities with Kura were discovered. The new preferred/official installation procedure is gdebi <file>.deb and is described here: https://eclipse.github.io/kura/intro/raspberry-pi-quick-start.html; you mentioned it as reference [2].

Now for the broker connection. clientId is something that is mandatory, but may be automatically filled by Kura by supplying MAC address of eth0 (without ':') to the broker. If Kura doesn't find said nic, it will not assign a value and broker will complain. Can you please check if System->Network menu is empty: image or does it contain some nic (e.g. eth0)? If it's empty, this part is solved (but not the part about why it's empty).

Deployment package is probably a bit more difficult. I tried it on a setup like yours (RPi2, Raspbian Stretch, Java 8) and it didn't install. I then installed it on a RPi3 on Raspbian Jessie with Java 7 and it at least installed from a local file. The message with http installation is also the same with the latest Kura snapshot with new Java. What is also interesting is that when installed from a local file, java process terminates on Stretch (with both versions of Kura, 1.4.0 and 3.3.0-SNAPSHOT). kura-console.log contains this on RPi3:

Unable to determine hardware version. I see: Hardware   : BCM2835
,
 - expecting BCM2708 or BCM2709. Please report this to projects@drogon.net

kura.log:

2018-07-16 13:35:09,305 [qtp32900431-34] INFO  o.e.k.w.s.s.FileServlet - Copying uploaded package file to file: /tmp/org.eclipse.greenhouse.iot-0.1.0.dp
2018-07-16 13:35:09,312 [qtp32900431-34] INFO  o.e.k.w.s.s.FileServlet - Installing package...
2018-07-16 13:35:09,312 [DeploymentAgent] INFO  o.e.k.d.a.i.DeploymentAgent - About to install package at URL file:/tmp/org.eclipse.greenhouse.iot-0.1.0.dp
mohabh88 commented 6 years ago

Hi @MMaiero and @markoer

Thank you so much for your replies and the informative information you have shared with me. That's greatly appreciated.

@MMaiero, as suggested, I tried the NN version of Kura (i.e., using the installation packages of 1.3.0-nn and 3.1.1-nn), unfortunately, still no one of them is working properly -- Invalid client configurations as well as some troubles with the MqttDataTransport, hence, Kura's is failing to start. More details are in the below logs for both of the installations.

kura-1.3.0-nn.log kura-console-3.1.1-nn.log kura-3.1.1-nn.log kura-console-3.1.1-nn.log

Furthermore, when trying to access the Kura's website using the IP address of the Pi, it throws: 404 Error; Invalid page! Have you tried the NN version at yours, @MMaiero? Were you able to get it up and running? If so please refer me to the right installation package(s) you are using in order to be able to use them.

@markoer, that's indeed. I am running the command "dpkg -i."; I just copy and past all the commands in the CLI in order to avoid any mistakes; rarely that I am typing them myself. So, from what you are trying to refer to, I should remove the network manager as well as purge the dhcpcd5 before starting the installation of Kura on the RPI? To be honest, when I saw such instructions, I was a bit concerned about losing any default configurations that may lead to the failure of the Pi itself and losing the OS. But if you affirm that, I would give it a go and try. Please confirm, @markoer!

Just on a side note, for your information: Using kura_3.2.0_deb, Kura got connected! But the greenhouse iot package mentioned in the tutorial keeps failing with this error: failed to install deployment package!. Any idea why? Other times, if I am lucky enough, it downloads the package, but unfortunately, it doesn't show up as if it was never downloaded and--or installed.

I look forward to your reply and thank you for your continued patience and assistance. Mohab

markoer commented 6 years ago

As @MMaiero explained you will only have a chance to run anything on Stretch, if you use Kura 1.3.0-nn/1.4.0-nn version. The other option is to install old Raspbian and old Java from the archives. Only in that case you have a chance at running greenhouse sample. If you're not constrained to greenhouse, you can remain with current OS and Java, remove dhcpcd5 and network manager (OS won't have issues with it as Kura takes care of networking), install Kura 3.2.0 and explore the other samples that are available in Marketplace and/or Kura source tree. Your /etc/network/interfaces file will be overwritten with one assigning DHCP address to eth0, but even so you can still find the device on the network. And even if you somehow misconfigure everything, flashing a fresh Raspbian is not too painful.

mohabh88 commented 6 years ago

Thank you so much @markoer for your reply and suggestions. Greatly appreciated.

I'd prefer to continue with the tutorial provided and the greenhouse sample since I got all the required hardware listed in there. Also this is a part of a project that I am working on in meantime and I would like to get a grasp on how everything is working.

Could you please recommend and refer to the old Raspbian OS as well as the old Java version from the archives to be used? I found the below images (Raspbian and Raspbian lite) and not sure exactly which one should I go for!

downloads.raspberrypi.org/raspbian/images downloads.raspberrypi.org/raspbian_lite/images

Could you please assist?

I would try other samples in the Marketplace after finishing this one so that I understand well how everything is working and how can I use kura with different applications. Thank you and I look forward to your reply. Mohab

markoer commented 6 years ago

As far as Raspbian goes, try this one: http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2015-11-24/. If it happens not to boot, use a newer version. Use either Java oracle-java6-jdk, if available, or oracle-java7-jdk that comes with OS.

mohabh88 commented 6 years ago

Thank you so much @markoer for your suggestion and recommendation. I have tried the full version of the Raspbian "Raspbian_Jessie_2015-11-24" instead of the lite one as the later didn't work properly for me (specially faced some issues installing GUI on top of it and when I succeeded to do so, it froze and nothing worked on top of it) -- also I have used Java oracle-java7-jdk as Java 6 wasn't exist.

Fortunately, Kura got connected when specified the configurations in the tutorial

2018-07-17 20:00:03,701 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.t.m.MqttDataTransport - # Connected!

and everything was okay, but not for the greenhouse package which threw a "Deployment exception: no manifest present in deployment pkg!" error.

2018-07-17 20:04:01,725 [DeploymentAgent] INFO  o.e.k.d.a.i.DeploymentAgent - About to install package at URL http://iot.eclipse.org/java/demo/org.eclipse.greenhouse.iot-0.1.0.dp
2018-07-17 20:04:01,940 [DeploymentAgent] ERROR o.e.k.d.a.i.DeploymentAgent - Exception installing package at URL http://iot.eclipse.org/java/demo/org.eclipse.greenhouse.iot-0.1.0.dp
org.osgi.service.deploymentadmin.DeploymentException: No manifest present in deployment package!

Basically, when I tried to download the package, it usually says "file was successfully downloaded", but it doesn't show up any where, also it throws "INTERNAL_ERROR".

Full logs are attached below:

  1. kura-jessie.log
  2. kura-console-jessie.log

kura_jessie_connected kura_jessie_pkg_sucessfully_downloaded kura_jessie_internal_error_iot_pkg

On a side note: all the above also applied to Jessie's newer version: "raspbian-2016-02-08". I tried to see if there are any differences, but the behavior was typically the same.

I wonder if the package is removed or so! Could you please highlight what might be wrong that prevents to have the tutorial fully up and running? Do you have any other suggestions/recommendations to share?

Thank you for your continued efforts and assistance, that's really greatly appreciated. Looking forward to your reply. Mohab

markoer commented 6 years ago

OK, so you made some progress. What you can do now is download the .dp file manually (to your PC) and install it from this file (System->Packages->+Install->File) instead of URL. That way it will install and likely also work since you have the rest of the hardware available. Don't forget to enable I2C in Raspbian, if you haven't done it, yet.

mohabh88 commented 6 years ago

Thank you so much @markoer for your reply.

I tried a lot to have the .dp file downloaded manually, but unfortunately, WebUI doesn't allow to do so. I tried from the RPI as well as regular machines (Windows, Linux and Unix) browsers, but the same thing. No "save as" or "save" is found there, and even when I have the link opened in regular browser's tab, I select all and then right click to download, I cannot find the "save" or "save as" as well.

This is how the file looks like (not correctly parsed):

dp-iot

screen shot 2018-07-18 at 11 16 00 am

Could you please refer and-or give me a way to be able to download such file? Or possible if you attach the file that you downloaded here so that I can use it?

On a side note: I searched for that on Eclipse Community Forums and one of the suggestions is to use "https://" for the dp file in Kura's browser, but even such thing didn't work for me... internal error as usual!

I look forward to you reply and thank you for your continuous efforts on this matter. Mohab

mohabh88 commented 6 years ago

Here you are the updates:

After lots of searching, I was able to download the files from here (i.e., the http and the https .dp) and the upload was successful to Kura. I was able to see the Greenhouse Publisher under the Services section and made the required changes :)

But I the Grove LED didn't light up :/ although the wires are correctly places on the RPI's pins! Possibly I am doing something wrong? Should there be additional stuff to be done on the RPI so that I can get the readings? Were you able to have them working before?

img_2239

2018-07-18-124552_1280x1024_scrot

markoer commented 6 years ago

This is actually the extent to which I can support you as I don't have the required hardware. Best of luck with getting it to work!

mohabh88 commented 6 years ago

@markoer Thank you so much Matteo for your reply.

Fair enough, I'll try my best to get it working. I hope it will not be so complex to see the expected results.

However, I'd be more grateful and thankful if you refer me to other Kura IoT tutorials to get hands on experience while dealing with them and get to know more how they are working.

Thank you again for your continued assistance; that's really so kind of you. Looking forward to your reply. Mohab

MMaiero commented 6 years ago

Closing as most of the difficulties seem to be solved now.

Please feel free to reopen, if needed.

shivamcasit commented 6 years ago

@MMaiero as per your instruction i have tried as in 2157, but still no success.

https://www.eclipse.org/forums/index.php/t/1094212/

still I am not able to connect with wifi connectivity. Raspberry pi is out of network. please suggest.

MMaiero commented 6 years ago

Could you please detail your setup? Just to understand if it can be referred to this case or is a different one.

Best regards, Matteo

shivamcasit commented 6 years ago

@MMaiero Thank you for you quick reply.

As per Kura installation guide : http://eclipse.github.io/kura/intro/raspberry-pi-quick-start.html Kura version : 3.2.0 and Raspberry Pi 3 Below are the commands used for download and installaltion. wget http://download.eclipse.org/kura/releases/3.2.0/kura_3.2.0_raspberry-pi-2-3_installer.deb Install Kura with: sudo gdebi kura_3.2.0_raspberry-pi-2-3_installer.deb during installation only Raspberry connectivity is lost with wifi network. even after reboot still issue exist. Also tried the steps mentioned in above issue 2157. Please let me know if you need more information.

Thanks & Regards, Shivappa

MMaiero commented 6 years ago

Hi, if you are accessing the raspberry via wifi, what you are seeing is correct: kura is a network manager and, by default, it sets the wifi module in access point. In fact you should be able to see a new SSID if scanning from your device. No changes should be applied to the eth interface that is configured to work in dhcp

shivamcasit commented 6 years ago

@MMaiero Thank you for your help. I am able to add my wifi network through Kura UI.

Thanks & Regards, Shivappa

sharmmoh1983 commented 5 years ago

@shivamcasit

Can you let me know the steps to add my wifi network through Kura UI.

shivamcasit commented 5 years ago

@sharmoh1983 In kura ui you will get option to change the network settings.

sharmmoh1983 commented 5 years ago

@shivamcasit Is this on Network Page on UI. I tried to remove Kura Gateway Access Point and override my wifi Access Point. But post that wlan0 is not workingand hence no internet Am i doing something wrong?

shivamcasit commented 5 years ago

@sharnmoh1983

Please try as below ->In browser type 172.16.1.1 you will get kura admin UI. ->Go to Network->Interface Name -> wlan0 -> select TCP/IP -> configure DHCP-> Apply -> In wirless tab ->set wirless security and password ->Search Network Name -> Apply -> reboot ->Check below link for UI instructions. For more information check in link : https://www.hackster.io/naresh-krish/create-an-iot-gateway-using-eclipse-kura-and-orange-pi-board-d9c2b8

sharmmoh1983 commented 5 years ago

@shivamcasit Thanks a lot for your inputs

sharmmoh1983 commented 5 years ago

@shivamcasit

Do you have any link to integrate modbus simulator to kura ?