Enable USB on Raspberry CM4 install

Hi,

I have a CM4 with 32 GB local flash running Supervised HA together with a companion board for Ethernet and USB2.
I intend to add the Sonoff Zigbee stick.
I learnt that on a CM4 the USB2 is not active by default and I need to add a few lines in Boot.txt to make it work.
My question how can get access to Boot.txt?

  • The HassOS SSH port 22222 Configurator does not work on the supervised HA version.
  • Connecting the CM4 to my Mac, using RPIBoot does not give access to the local flash - you can use it to load HA in the flash memory. I have found now way to access the flash memory directly.

I am stuck at this moment.
Anybody suggestions to get access to boot.txt on a CM4 ?
Thanks!

i am not familiar with this kind of installation as i run HA via docker and tested the whole HAOS only for a short time, but isn’t it possible to install ssh/terminal via an addon/plugin from the shop. was it called that?.

since i run raspbian, on my system it would be called config.txt and is in /boot
you should be able to find the file via this command
find / -name boot.txt

Thanks for reply. you are fully right, I need edit config.txt in the HA Root to enable USB. To challenge was how to get access.

I was not able to get HassOS SSH port 22222 Configurator working.
I followed this german guide that did not work for me as it assumes that the authentication key for root acces can be uploaded via an USB drive. As USB is disabled on a CM4 that won’t work. I put the key - as test - on a SDcard - did not work either.
There is a youtube version : https://www.youtube.com/watch?v=1Is7Breg690

After many hours searching:
I did found a trick to access the HA root system :slight_smile:

In the SSH terminal put these commands
docker run --privileged --pid=host -it alpine:latest
nsenter -t 1 -m -u -n -i sh

Via a docker command this gives direct access to the root system.
That works but it installs alpine application [no idea what it is] .
HA supervised does not like that and want it removed.

I found the config.txt in /mnt/boot
enabled the USB Ports by adding
dtoverlay=dwc2,dr_mode=host
to config.txt

After reboot connected the sonoff zigbee dongle, and it was nicely recognised by ZHA integration.

  • I did remove the antenna -

Now i have to find a way to get rid of alpine - but that is a small worry.

I hope other people can benefit from my journey.

2 Likes

[edit - found workaround]:
I found out that if I attached the Raspberry Pi to my computer and ran rpiboot, the file system would show up and I could edit the config.txt file!

After editing, saving and rebooting, the USB is now enabled and everything seems to be working. That was a lot of searching and trial and error to get to a fix that took about 5 minutes in the end!
[end of edit]

I realize this is a few months old, but I’m having a similar problem. USB is disabled so I can’t use a keyboard on the console and I can’t import an authorized_keys file either.

I tried installing alpine like you did, but docker isn’t installed. I flashed with the 64 bit HAOS 9.5 image: haos_rpi4-64-9.5.img.xz, but I don’t see docker.

How did you get docker installed?

At one point I just installed raspbian and ran Home Assistant in a docker container and that worked for devices, but then I needed access to Add-Ons and found out I couldn’t access add-ons running this way. So now that I’m back to HAOS I can’t find a way to get access to config.txt to enable USB - frustrating that it’s this difficult.