txoof / PaperPi

E-Paper display loop with plugins
97 stars 10 forks source link

crash on daemon launch with non HD screens under bookworm #158

Closed txoof closed 1 month ago

txoof commented 2 months ago

Describe the bug rpi.gpio is no longer supported under bookworm. Need to migrate to rpi-lgpio

This can likely be resolved by updating the requirements file.

PaperPi will crash on launch with the error below.

To Reproduce Steps to reproduce the behavior: Install PaperPi under Bookworm and start it.

Hardware

OS Info

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Additional context See crash below

Jun 15 22:34:41 office-p3-127 paperpi[1997]: 2024-06-15 22:34:41 xCreatePipe: Can't set permissions (436) for //.lgd-nfy0, No such file or directory
Jun 15 22:34:41 office-p3-127 paperpi[1997]: /usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/devices.py:300: PinFactoryFallback: Falling back from lgpio: [Errno 2] No such file or directory: '.lgd-nfy-3'
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   warnings.warn(
Jun 15 22:34:41 office-p3-127 paperpi[1997]: Traceback (most recent call last):
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/paperpi.py", line 746, in <module>
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     exit_code = main()
Jun 15 22:34:41 office-p3-127 paperpi[1997]:                 ^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/paperpi.py", line 668, in main
Jun 15 22:34:41 office-p3-127 kernel: export_store: invalid GPIO 24
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     screen_return = setup_display(config)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:                     ^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/paperpi.py", line 407, in setup_display
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     screen = Screen(epd=epd, vcom=vcom)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 240, in __init__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     self.epd = epd
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     ^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 63, in new_f
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     return f(self, *args, **kwds)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:            ^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 333, in epd
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     myepd = self._load_non_hd(epd)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:             ^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 482, in _load_non_hd
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     myepd = import_module(f'waveshare_epd.{epd}')
Jun 15 22:34:41 office-p3-127 paperpi[1997]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     return _bootstrap._gcd_import(name[level:], package, level)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/waveshare_epd/epd7in5.py", line 32, in <module>
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     from . import epdconfig
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/waveshare_epd/epdconfig.py", line 276, in <module>
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     implementation = RaspberryPi()
Jun 15 22:34:41 office-p3-127 paperpi[1997]:                      ^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/waveshare_epd/epdconfig.py", line 56, in __init__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     self.GPIO_BUSY_PIN   = gpiozero.Button(self.BUSY_PIN, pull_up = False)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/devices.py", line 108, in __call__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     self = super().__call__(*args, **kwargs)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/input_devices.py", line 412, in __init__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     super().__init__(
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/mixins.py", line 417, in __init__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     super().__init__(*args, **kwargs)
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/input_devices.py", line 168, in __init__
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     self.pin.when_changed = self._pin_changed
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     ^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/pins/__init__.py", line 471, in <lambda>
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     lambda self, value: self._set_when_changed(value),
Jun 15 22:34:41 office-p3-127 paperpi[1997]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/pins/pi.py", line 639, in _set_when_changed
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     self._enable_event_detect()
Jun 15 22:34:41 office-p3-127 paperpi[1997]:   File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/pins/rpigpio.py", line 220, in _enable_event_detect
Jun 15 22:34:41 office-p3-127 paperpi[1997]:     GPIO.add_event_detect(
Jun 15 22:34:41 office-p3-127 paperpi[1997]: RuntimeError: Failed to add edge detection
txoof commented 1 month ago

related to the following issues at gpiozero: https://github.com/gpiozero/gpiozero/issues/1106 https://github.com/joan2937/lg/issues/12

This only happens when paperpi is run as a daemon; this is because the paperpi user does not have permission to create a file within the daemon environment.

txoof commented 1 month ago

A working directory where the paperpi daemon user can have read/write edit needs to be specified.

add the following lines to the unit file:

RuntimeDirectory=paperpi
WorkingDirectory=/run/paperpi