TeamScheire / familiekiosk

Bouwplannen en uitleg om zelf een fotokanaal te maken, net zoals Maria in het RVT
https://www.canvas.be/team-scheire/maria-wil-meer-contact-met-haar-familie
Apache License 2.0
10 stars 4 forks source link

Problem with chatbox service on startup #9

Closed janvangent closed 4 years ago

janvangent commented 4 years ago

Today I had to make a fresh install of raspbian (latest version, istalled by using the NOOBS installer). Last time I didn't have this issues, but now it seems impossible to get the fk_chatbox to startup automatically when the raspberry pi is booted. I followed (and repeated multiple times) the procedure explained in the manual. The files are in the systemd/system folder, they have been chmod'ed, and i ran these commands (sequentially): sudo systemctl daemon-reload sudo systemctl enable fk_chatbot.service sudo systemctl enable fk_tvbox.service sudo service fk_chatbot start sudo service fk_tvbox start

Any further suggestions?

When the system boots, the raspberry does display the pictures automatically, but the chatbox doesn't start on startup....

bmcage commented 4 years ago

I don't have a setup with latest raspbian yet, so no way to test yet. Don't see specific systemd changes for raspbian 10 over the previous 9. Any output on

systemctl status fk_chatbot.service

Normally if there was an error this should show what the error was

janvangent commented 4 years ago

fk_chatbot.service - Telegram Family Chat Bot Loaded: loaded (/lib/systemd/system/fk_chatbot.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2019-12-27 22:41:14 CET; 5 days ago Process: 655 ExecStart=/usr/bin/python /home/pi/familiekiosk/src/FK_ChatBot.py > /home/pi/familiekiosk/output_chatbot.log 2>&1 (code=exited, status=1/FAILURE) Main PID: 655 (code=exited, status=1/FAILURE)

dec 27 22:41:14 raspberrypi python[655]: result = func(self, args, kwargs) dec 27 22:41:14 raspberrypi python[655]: File "/usr/local/lib/python2.7/dist-packages/telegram/bot.py", line 199, in get_me dec 27 22:41:14 raspberrypi python[655]: result = self._request.get(url, timeout=timeout) dec 27 22:41:14 raspberrypi python[655]: File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 270, in get dec 27 22:41:14 raspberrypi python[655]: result = self._request_wrapper('GET', url, urlopen_kwargs) dec 27 22:41:14 raspberrypi python[655]: File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 224, in _request_wrapper dec 27 22:41:14 raspberrypi python[655]: raise NetworkError('urllib3 HTTPError {0}'.format(error)) dec 27 22:41:14 raspberrypi python[655]: telegram.error.NetworkError: urllib3 HTTPError HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot*API gegevens verwijderd dec 27 22:41:14 raspberrypi systemd[1]: fk_chatbot.service: Main process exited, code=exited, status=1/FAILURE dec 27 22:41:14 raspberrypi systemd[1]: fk_chatbot.service: Failed with result 'exit-code'.

janvangent commented 4 years ago

After a reboot, when I check the status of the service I get the message above. If afterwards I start it manually by entering

sudo service fk_chatbot start It starts, and when I check the status of the service it is running succesfully.

Any ideas?

janvangent commented 4 years ago

OK now it works. What I did: Run sudo raspi-config . Select Option 3 (Boot Options). Select B2 (Wait for Network at Boot).

I believe systemd was trying to run the service, before the wifi connection was active, resulting in a failed attempt/error. Now it waits during boot until network connection is active.

bmcage commented 4 years ago

Great. The install md files to update with this. You fancy a PR for that?

I see also it was made for Python 2.7, which now is deprecated. Normally code should work with python 3 too though. As raspbian 10 still ships python2.7, we can worry about it later though.

bmcage commented 4 years ago

Dit gedocumenteerd in de documentatie nu, zie FamilieKiosk.md