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

Ubuntu 20 udev rules not working #63

Open
ITler opened this issue Mar 1, 2021 · 8 comments
Open

Ubuntu 20 udev rules not working #63

ITler opened this issue Mar 1, 2021 · 8 comments

Comments

@ITler
Copy link

ITler commented Mar 1, 2021

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.

@Hummer12007
Copy link
Owner

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

@ITler
Copy link
Author

ITler commented Mar 2, 2021

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
Copy link
Author

ITler commented Mar 2, 2021

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

@Hummer12007
Copy link
Owner

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

@ITler
Copy link
Author

ITler commented Mar 5, 2021

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.

@nelson-ricardo
Copy link

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"

@nickcat325
Copy link

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.

@Eliot-Roxbergh
Copy link

Eliot-Roxbergh commented Nov 23, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants