SpudGunMan / meshing-around

BBS Mesh Scripts for Meshtastic
GNU General Public License v3.0
44 stars 9 forks source link

Installation & Service Issues Ubuntu 20.04 LTS #37

Closed brad07x closed 2 months ago

brad07x commented 2 months ago

Thanks for sharing a great project.

Wanted to share a few issues I experienced on Ubuntu 20.04 LTS on Raspberry Pi along with fixes for each.

The most significant issue I encountered was with the systemd service unit file. On service startup, systemctl would show logs that the mesh_bot.service unit file would exit with an error repeatedly until systemd disabled the unit.

Aug 10 18:06:07 5424-rPi-02 systemd[1]: mesh_bot.service: Scheduled restart job, restart counter is at 4.
<omitted for brevity>
Aug 10 18:06:07 5424-rPi-02 python[5510]:   File "/opt/mesh/meshing-around/launch.sh", line 4
Aug 10 18:06:07 5424-rPi-02 python[5510]:     cd "$(dirname "$0")"
Aug 10 18:06:07 5424-rPi-02 python[5510]:        ^
Aug 10 18:06:07 5424-rPi-02 python[5510]: SyntaxError: invalid syntax
Aug 10 18:06:07 5424-rPi-02 systemd[1]: mesh_bot.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mesh_bot.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.

I was able to reproduce the error in an interactive terminal by invoking the same command as in the unit file, ExecStart=/usr/bin/python /opt/mesh/meshing-around/launch.sh mesh:

root@rPi-02:/opt/mesh/meshing-around# python ./launch.sh mesh
  File "./launch.sh", line 4
    cd "$(dirname "$0")"
       ^
SyntaxError: invalid syntax

Changing the unit file to interpret the launch.sh script with bash instead of python resolves the issue.

ExecStart=/usr/bin/bash /opt/mesh/meshing-around/launch.sh mesh

root@5424-rPi-02:/opt/mesh/meshing-around# systemctl status mesh_bot.service
● mesh_bot.service - MESH-BOT
     Loaded: loaded (/etc/systemd/system/mesh_bot.service; disabled; vendor preset: enabled)
     Active: active (running) since Sat 2024-08-10 18:22:11 UTC; 21min ago
   Main PID: 8985 (bash)
      Tasks: 5 (limit: 9254)
     Memory: 27.0M
     CGroup: /system.slice/mesh_bot.service
             ├─8985 /usr/bin/bash /opt/mesh/meshing-around/launch.sh mesh
             └─8987 python mesh_bot.py

Aug 10 18:22:13 5424-rPi-02 bash[8987]:
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,381 |     INFO | System: Autoresponder Started for Device1 brad07x->
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,382 |    DEBUG | System: BBS Enabled, bbsdb.pkl has 1 messages. Dir>
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,382 |    DEBUG | System: Celestial Telemetry Enabled
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,382 |    DEBUG | System: Location Telemetry Enabled using NOAA API
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,382 |    DEBUG | System: Dad Jokes Enabled!
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,383 |    DEBUG | System: Store and Forward Enabled using limit: 3
Aug 10 18:22:13 5424-rPi-02 bash[8987]: 2024-08-10 18:22:13,383 |    DEBUG | System: Respond by DM only

The other installation issues I encountered were: 1) Didn't have python3.8-venv installed Fix: sudo apt install python3.8-venv and rerun install.sh

2) On my Ubuntu 20.04 LTS install, /usr/bin/python is not present, but /usr/bin/python3 is. The install script and unit files seem to all require invoking python instead of python3. Fix: Create a symlink pointing /usr/bin/python -> /usr/bin/python3 ln -s /usr/bin/python3 /usr/bin/python

3) Encountered errors during requirements installation for pubsub, pyephem, and pyqrcode - error: invalid command 'bdist_wheel' when building wheels for these packages.

Fix: - Activate the newly created venv root@5424-rPi-02:/opt/mesh/meshing-around# source venv/bin/activate - Install wheel (venv) root@5424-rPi-02:/opt/mesh/meshing-around# pip install wheel - Remove & Reinstall pubsub, pyephem, and pyqrcode (pip uninstall/pip install for each from within venv) - I re-ran the setup script, but likely not necessary

I have not tested the installer on a newer version of Ubuntu yet to see if the same issues exist. I do need to upgrade this Pi to 24.04 LTS now that it is available, but 20.04 LTS does have a bit more standard support time (April 2025).

Thanks again!

SpudGunMan commented 2 months ago

your welcome! and glad it got worked out! thanks so much for the details I was able to improve some of the concerns you had and correct some errors on my part! thank you!