brightnessctl icon indicating copy to clipboard operation
brightnessctl copied to clipboard

Ubuntu 20 udev rules not working

Open ITler opened this issue 5 years ago • 8 comments

I did sudo apt install brightnessctl, but it seems for Ubuntu 20 LTS that although udev rules get copied to /lib/udev/rules.d/ as desired in the debian install routine, it is not possible to use brigthnessctl without sudo.

ITler avatar Mar 01 '21 15:03 ITler

Can you show me the installed rules and the output of your id command?

Hummer12007 avatar Mar 02 '21 00:03 Hummer12007

sure .. and I am very confident that my user is the default user created during OS installation, so no special tweaks in regards of group membership.

$ id
uid=1000(itler) gid=1000(itler) groups=1000(itler),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare),998(docker)

$ cat /lib/udev/rules.d/90-brightnessctl.rules 
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp input /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"

$ brightnessctl s 20%+
Can't modify brightness: Permission denied

You should run this program with root privileges.
Alternatively, get write permissions for device files.

$ ls -la /sys/class/backlight/intel_backlight/brightness
-rw-rw-r-- 1 root video 4096 Mar  2 08:11 /sys/class/backlight/intel_backlight/brightness

ITler avatar Mar 02 '21 08:03 ITler

Ah, I am blind. Yes that could be the reason. Maybe GIDs changed in Ubuntu20

ITler avatar Mar 02 '21 11:03 ITler

The easiest way to fix it would be to add yourself to the video group via usermod -aG video ${USER} or something similar.

Hummer12007 avatar Mar 02 '21 13:03 Hummer12007

Sure no worries. Just wondering if this is a generic problem on Ubuntu 20 to be dealt with or some specifics to my machine. Anyways, thanks for supporting. Feel free to close this issue if not needed anymore.

ITler avatar Mar 05 '21 16:03 ITler

I am running with that same problem but I am unable to use the program without using sudo. My user is nelson and it is the only user on the system. I am using Elementary which follows the Ubuntu 18.04LTS

$ cat /etc/group | grep video
video:x:44:nelson
 $ cat /etc/group | grep input
input:x:104:nelson
 $ cat /lib/udev/rules.d/90-brightnessctl.rules
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp input /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"

nelson-ricardo avatar Mar 08 '21 23:03 nelson-ricardo

sudo usermod -aG video ${USER} and rebooting fixed my issue. For a temporary solution you can change permissions of /sys/class/backlight/%k/brightness from other=read to other=read+write. Just remember the permissions will be reverted after a reboot.

nickcat1 avatar Sep 17 '21 12:09 nickcat1

sudo usermod -aG video ${USER}

This indeed fixed it for me, could it be made clearer in the readme or error message? (that you may need to add current user to video and input)

Eliot-Roxbergh avatar Nov 23 '22 09:11 Eliot-Roxbergh