I am trying to add udev rules to config.json and make it available as a configuration variable. I have tried to follow this guide, but I can’t get it to work: Advanced boot settings - Balena Documentation
I have done the following:
Created a USB stick with the balena OS image
Added the udev rules to config.json on the USB stick. This is what I have added:
Hi, unfortunately in this case the docs are incorrect and the udev rules are not shown in the dashboard.
I will create an issue so the docs are corrected with a more specific description of what is displayed. Would you like to recommend that the udev rules are displayed? I can submit it as a suggested product improvement.
What I want to achieve is that my udev rules can be deployed - and updated at a later point if needed, without having to go into the terminal on each device.
It is fine by me if this is done in the configuration variables, but if it somehow can be added to the docker-compose.yml, then that would also be a solution (not sure if that is feasible).
You can set udev rules from a service container by using a balenalib base image, and doing the following:
Save your udev rules into a .rules file (e.g. 48-usb.rules) and include a build step in your Dockerfile that copies the file into the /etc/udev/rules.d/ path of your service.
Add privileged: true to your container’s service definition on the docker-compose.yml file
You should be able to use the same approach to set udev rules for your devices from within the service and update those rules as you update the services for the fleet.