Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various install.sh crashes due to unloaded kernel modules and missing dependencies on Bookworm Lite #116

Open
Devonavar opened this issue Feb 27, 2024 · 8 comments · Fixed by #119
Labels
bug Something isn't working

Comments

@Devonavar
Copy link

Devonavar commented Feb 27, 2024

Just installed bluetooth_2_usb on a fresh image of Raspberry PI OS Lite (32-bit) (bookworm), using a Raspberry Pi Zero W.

I encountered three crashes during the install process due to missing dependencies. These were easy to fix manually, but should probably be included in the script. I'm filing it here as a bug because I don't know the code at all, so I feel safer reporting it and letting someone who knows the whole process better fix it.

Error #1: (script error): Aborting installation. Failed installing dependencies.
(python error):

rpi_ws281x_wrap.c:154:11: fatal error: Python.h: No such file or directory
        154 | # include <Python.h>

Fix #1: sudo apt install python3-dev (missing dependency)

Error HeuristicPerson#2: (script error): Installation failed. The version information could not be retrieved.
(python error): Exception: dwc2 module not present in your kernel. did you insmod it?

Fix HeuristicPerson#2: sudo modprobe dwc2 (kernel module not loaded)

Error #3: (script error): Installation failed. The version information could not be retrieved.
(python error): Exception: libcomposite module not present in your kernel. did you insmod it?

Fix #3: sudo modprobe libcomposite (kernel module not loaded)

For both HeuristicPerson#2 and #3, the module was correctly added to /etc/modules, so presumably it would work on after reboot, and it just needs to be loaded in the script to the installation script doesn't error out.

Error #4: dtoverlay=dwc2 is written to the wrong file in a new Bookworm installation (which is now necessary due to the Python3.11 version requirement). config.txt is now located at /boot/firmware/config.txt instead of /boot/config.txt

Workaround #4: Manually add dtoverlay=dwc2 to /boot/firmware/config.txt. Presumably the script now needs some OS version checking code to fix this properly.

@Devonavar Devonavar changed the title Various install.sh crashes due to unloaded kernel modules and missing dependencies Various install.sh crashes due to unloaded kernel modules and missing dependencies on Bookworm Lite Mar 7, 2024
@mrjones-plip
Copy link

Just tested all these fixes on a Pi4 running Pi Lite 32-bit Bookworm and can confirm all the above is correct. Thank you @Devonavar !!

Minor notes:

  • #1 - it is indeed super important to install python3-dev - I researched the issue and came to the same conclusion.
  • #2 and #3 - indeed fixed by a reboot - but presumably the modbprobe in the install script would be a lot easier
  • #4 - I was struggling to debug this and couldn't understand the error, so really glad this ticket was opened! Including the error message in case others are searching for it. I found it via journalctl -u bluetooth_2_usb.service -n 50 :
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: StopIteration
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: 24-05-18 22:45:17 [ERROR] vc4-hdmi-1 HDMI Jack failed!
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: Traceback (most recent call last):
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 248, in _async_relay_events
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     relay = DeviceRelay(device, self._grab_devices)
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 120, in __init__
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     init_usb_gadgets()
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 46, in init_usb_gadgets
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     usb_hid.enable(
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/venv/lib/python3.11/site-packages/usb_hid.py", line 758, in enable
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     udc = next(Path("/sys/class/udc/").glob("*"))
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: StopIteration
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: 24-05-18 22:45:17 [ERROR] VB87MT Keyboard failed!
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: Traceback (most recent call last):
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 248, in _async_relay_events
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     relay = DeviceRelay(device, self._grab_devices)
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 120, in __init__
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     init_usb_gadgets()
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/src/bluetooth_2_usb/relay.py", line 46, in init_usb_gadgets
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     usb_hid.enable(
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:   File "/home/pi/bluetooth_2_usb/venv/lib/python3.11/site-packages/usb_hid.py", line 758, in enable
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:     udc = next(Path("/sys/class/udc/").glob("*"))
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 18 22:45:17 raspberrypi bluetooth_2_usb[775]: StopIteration

@Devonavar
Copy link
Author

Thanks!

@Devonavar Devonavar reopened this May 18, 2024
@Devonavar
Copy link
Author

Reopening since I see you were using my workarounds and haven't committed anything yet. I'll let the process work as intended...

@quaxalber quaxalber linked a pull request May 22, 2024 that will close this issue
@quaxalber
Copy link
Owner

Hey there,

Thanks a lot for your input.

python3-dev is now added to the installer.

@mrjones-plip
Copy link

Thanks @quaxalber! Great to see a fix added here.

However, this issue cites two fixes needed, only which one is addressed in your PR:

  1. install python3-dev
  2. add dtoverlay=dwc2 to config.txt

The trick for number 2 is that the path for config.txt in our installer is hardcoded to /boot/config.txt, however we should check to see if it's in /boot or in /boot/firmware/ and call append_if_not_exist with correct path.

@quaxalber
Copy link
Owner

Ah right, totally missed that. Another patch incoming then. I'll also add the modprobes

Thanks again!

@quaxalber quaxalber reopened this May 22, 2024
@quaxalber quaxalber added the bug Something isn't working label May 22, 2024
@mrjones-plip
Copy link

Great - thank you!

@PhilippParis
Copy link

PhilippParis commented Aug 10, 2024

Hi!
i just got the setup working with the Pi Zero 2 W!
additionally to the problems described in this issue I had the problem when adding "dtoverlay=dwc2" to config.txt:

the default config.txt looks like this

...

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[cm5]
dtoverlay=dwc2,dr_mode=host

[all]

the script does not add dtoverlay=dwc2 to the file because it already exists.
but there are the follwing problems:

  • it is under the [cm5] section, which is ignored for pi zero
  • and dr_mode=host is (probably) wrong (i have not tested it, i just assume)

i update the config.txt to the following and now it works!

...

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]
dtoverlay=dwc2,dr_mode=peripheral

[all]

maybe you can update install.sh to fix that

thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants