After reboot of the tinypilot device (purchased with pre-programmed sd card) due to power loss nginx reports error 502.
tinypilot service is active but reports import failure:
root@tinypilot:/home/pilot# systemctl status tinypilot
● tinypilot.service - TinyPilot - RPi-based virtual KVM
Loaded: loaded (/lib/systemd/system/tinypilot.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-10-28 07:59:10 BST; 919ms ago
Main PID: 1006 (python)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/tinypilot.service
└─1006 /opt/tinypilot/venv/bin/python app/main.py
Oct 28 07:59:10 tinypilot systemd[1]: Started TinyPilot - RPi-based virtual KVM.
Oct 28 07:59:11 tinypilot python[1006]: Traceback (most recent call last):
Oct 28 07:59:11 tinypilot python[1006]: File "app/main.py", line 18, in
Oct 28 07:59:11 tinypilot python[1006]: import public_api
Oct 28 07:59:11 tinypilot python[1006]: File "/opt/tinypilot/app/public_api.py", line 13, in
Oct 28 07:59:11 tinypilot python[1006]: import js_to_hid
Oct 28 07:59:11 tinypilot python[1006]: File "/opt/tinypilot/app/js_to_hid.py", line 1, in
Oct 28 07:59:11 tinypilot python[1006]: from hid import keycodes as hid
Oct 28 07:59:11 tinypilot python[1006]: ImportError: cannot import name 'keycodes' from 'hid' (/opt/tinypilot/app/hid/init.py)
root@tinypilot:/home/pilot# ls /opt/tinypilot/app/hid/
init.py pycache keyboard.py keyboard_test.py mouse.py mouse_test.py write.py write_test.py
the "hid" module's directory is missing keykodes.py file (compared to content of this directory on github).
I will re-crelate the keycodes file but just wat to leave a trace here in case someone faces similar problem.
- ZZbigniew Zasieczny @zasiecznyz
Once the keycodes.py was created in /opt/tinypilot/app/hid/ using github source (https://raw.githubusercontent.com/tiny-pilot/tinypilot/master/app/hid/keycodes.py) the tinypilot service started without problems and everything works ok.
- CCharles Hague @cghague2022-10-28 14:04:29.862Z
Hi Zbigniew - thanks for sharing your solution with us!
I'm pleased to hear that this is now resolved. It sounds like this was a one-off issue caused by a power outage, but if you'd like to reduce the likelihood of filesystem corruption in future you can do so by enabling the read-only filesystem on your TinyPilot device.
I hope this is helpful. Please let me know if you have any questions!