Setting --device-cgroup-rules

Hi, I’m currently trying to use balena to run a fleet of Rpi’s with a sensor attached to the device over USB. To do this I need to change the device cgroup rules to ‘c 189:* rmw’ which would be supported with a regular docker run command or with a docker-compose version 2.4. since balena is currently relying on a compose version of 2.1 it’s pretty difficult to do this. is there any chance anyone knows of a work around?

@Carottid Welcome the the forums!

I’m not familiar with setting cgroup rules but I do know that compose file support is based on version 2.4. This reference doesn’t specifically mention device_cgroup_rules being supported though.

I just did a test balena push with this compose file and didn’t get any errors. Not sure if it did anything with the cgroup rules or how to test that… but it is worth a test in your project.

version: '2.4'
services:
  idler:
    image: balenalib/intel-nuc-alpine
    privileged: true
    labels:
      io.balena.features.dbus: '1'
      io.balena.features.sysfs: '1'
    device_cgroup_rules:
      - "c 189:* rmw"
    command: balena-idle

good luck!
//Sam

Hi Sam, thanks for the quick response. With your compose file I just got:

`Unsupported composition version

ValidationError: Unsupported composition version
    at Object.normalize (/usr/local/lib/balena-cli/node_modules/resin-compose-parse/build/compose.js:68:23)
    at createProject (/usr/local/lib/balena-cli/build/utils/compose.js:23:33)
    at loadProject (/usr/local/lib/balena-cli/build/utils/compose_ts.js:73:12)
    at async Object.deployToDevice (/usr/local/lib/balena-cli/build/utils/device/deploy.js:98:21)
    at async PushCmd.pushToDevice (/usr/local/lib/balena-cli/build/commands/push.js:93:13)
    at async PushCmd.run (/usr/local/lib/balena-cli/build/commands/push.js:36:17)
    at async PushCmd._run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/command.js:43:20)
    at async Config.runCommand (/usr/local/lib/balena-cli/node_modules/@oclif/config/lib/config.js:175:24)
    at async CustomMain.run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/main.js:27:9)
    at async CustomMain._run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/command.js:43:20)
    at async /usr/local/lib/balena-cli/build/app.js:76:13
    at async Promise.all (index 2)
    at async oclifRun (/usr/local/lib/balena-cli/build/app.js:94:5)
    at async Object.run (/usr/local/lib/balena-cli/build/app.js:107:9)
    at async run (/usr/local/lib/balena-cli/bin/run:20:2)

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting`

:see_no_evil: my balena-cli was an old version installed through homebrew… the new updated version allows me to deploy with 2.4

1 Like

@Carottid,

If you have the time I’d love to know if this works in your project!

Regards,
//Sam