thingsboard / thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.
https://thingsboard.io
Apache License 2.0
17.61k stars 5.21k forks source link

Thingsboard-gateway failed to start #6378

Closed jessedcpc closed 2 years ago

jessedcpc commented 2 years ago

Component

Description thingsboard-gateway.service failed to start.

Environment

PS: I am a Linux and Thingsboard novice, so greatly appreciate any support :)

I have attempted a fresh install of Ubuntu and followed the (DEB) install and gateway install guide. From what I've found online, I would guess my config is incorrect, but I don't know enough about Thingsboard/Linux to investigate further.

Result of "systemctl status thingsboard-gateway":

thingsboard-gateway.service - ThingsBoard Gateway Loaded: loaded (/etc/systemd/system/thingsboard-gateway.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2022-04-06 08:42:29 AEST; 14min ago Process: 12388 ExecStart=/usr/bin/python3 -c from thingsboard_gateway.tb_gateway import daemon; daemon() (code=exited, status=1/FAILURE) Main PID: 12388 (code=exited, status=1/FAILURE) Apr 06 08:42:29 crisp-desktop systemd[1]: thingsboard-gateway.service: Scheduled restart job, restart counter is at 5. Apr 06 08:42:29 crisp-desktop systemd[1]: Stopped ThingsBoard Gateway. Apr 06 08:42:29 crisp-desktop systemd[1]: thingsboard-gateway.service: Start request repeated too quickly. Apr 06 08:42:29 crisp-desktop systemd[1]: thingsboard-gateway.service: Failed with result 'exit-code'. Apr 06 08:42:29 crisp-desktop systemd[1]: Failed to start ThingsBoard Gateway.

Gateway config files below: (saved as .txt so I can upload) tb_gateway.txt modbus.json left as default for now modbus.txt

Gateway log files are not updating so I have not uploaded them

Backdraft007 commented 2 years ago

Hi, is there something in /var/los/syslog?

jessedcpc commented 2 years ago

Hi Backdraft,

Below is the syslog. I restarted the gateway and ran a status check just before saving the file :)

syslog.txt

Backdraft007 commented 2 years ago

Hi, is it a fresh system?

Can you please try the following: pip3 show protobuf pip3 install --upgrade protobuf pip3 show protobuf

jessedcpc commented 2 years ago

Thanks for the info! Yes, it is a fresh install (as I thought I may have botched something lol)

I shall give that a go in the morning, really appreciate your help 😄

jessedcpc commented 2 years ago

Ok so I have updated from 3.06 to 3.20 and rebooted the machine. Restarted thingsboard-gateway service and still getting the same error.

Attached below is latest syslog if that helps syslog.txt

I can see that just before the gateway errors, it has the following: Apr 8 08:03:52 crisp-desktop python3[2936]: create_key=_descriptor._internal_create_key, Apr 8 08:03:52 crisp-desktop python3[2936]: AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key' Unsure how to correct this.

Backdraft007 commented 2 years ago

Can you please uninstall protobuf.

pip3 uninstall protobuf

Run this command twice to be sure it is uninstalled. After that install it again.

pip3 install --upgrade protobuf

jessedcpc commented 2 years ago

I uninstalled protobuf 3.20.0, 3.6.1 was still lingering which I had to manually rm the folder. Once deleted, it was skipped when I tried to uninstall 👍

I re-installed protobuf 3.20.0, restarted the machine and then restarted the gateway. Still the same issue it appears :(

syslog.txt

Backdraft007 commented 2 years ago

Strange, can you show the version with pip3 show protobuf, is it 3.20.0? Have a look in "/usr/lib/python3/dist-packages/google/protobuf/init.py", which version?

Backdraft007 commented 2 years ago

Ah, please remove protobuf from apt. sudo apt remove python3-protobuf then rerun the installation of gateway sudo apt install ./python3-thingsboard-gateway.deb -y

I can reproduce it, with a fresh install. This way worked for me.

jessedcpc commented 2 years ago

Thanks so much for the help thus far, Chris!! I wish I could be of more assistance, but I'm a bit out of my depth on this one.

Sadly, this has not resolved it. Perhaps the issue is when installing the gateway, it comes up with an error just before installation completed? ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I'd be happy to do a re-install if you think that will help. Is it possible to restore from the image of your fresh install? (I realise it's probably different hardware)

Backdraft007 commented 2 years ago

Hi, no problem. Is it possible that I can have a look on your server? I think a re-install is not necessary.

jessedcpc commented 2 years ago

Absolutely, I have AnyDesk installed on the machine and can message you the ID (I guess GitHub doesn't have private message tho). I'll be available any time during your morning :)

Backdraft007 commented 2 years ago

Sorry for late respond. I can support after easter. Is it okay?

jessedcpc commented 2 years ago

Hey Chris, let me know if you have a chance sometime this week to assist. No worries if you're busy

jessedcpc commented 2 years ago

Any update mate? I've had another go last week to no success... any help is greatly appreciated!

jessedcpc commented 2 years ago

So I ended up re-installing a bunch of times and eventually installed v3.2 Thingsboard and v2.9 of Gateway and it worked perfectly fine together.