OpenRazer on Gentoo Linux
Control Razer RGB devices using native kernel drivers and razer-cli.
Tested with:
- Razer Mamba Elite
- Razer Ornata V2
- Gentoo Linux (OpenRC)
Install Required Packages
Install OpenRazer and CLI
emerge --ask sys-apps/openrazer sys-apps/razer-cli
Load Kernel Modules
Load required modules
sudo modprobe razerkbd
sudo modprobe razermouse
Verify modules
lsmod | egrep 'razerkbd|razermouse'
To load automatically at boot
echo razerkbd >> /etc/modules-load.d/openrazer.conf
echo razermouse >> /etc/modules-load.d/openrazer.conf
Start D-Bus (Required)
Enable and start D-Bus
bash rc-service dbus start rc-update add dbus default
Fix Permission Errors (udev Rule)
If you see errors like
Permission denied: .../device_serial
Permission denied: .../device_mode
Create the following rule:
Copy and Paste
cat > /etc/udev/rules.d/99-openrazer-sysfs-perms.rules <<'EOF'
# OpenRazer: allow users in plugdev to access sysfs driver attributes
# Fixes Permission denied for device_type/device_serial/dpi/device_mode etc.
ACTION=="add|change", SUBSYSTEM=="hid", ATTRS{idVendor}=="1532", \
RUN+="/bin/sh -c '\
base=/sys$env{DEVPATH}; \
chgrp -R plugdev \"$base\" 2>/dev/null; \
chmod g+rw \"$base\" 2>/dev/null; \
find \"$base\" -maxdepth 1 -type f -exec chmod 0660 {} + 2>/dev/null; \
# Keep serial files readable only (optional)
[ -e \"$base/device_serial\" ] && chmod 0640 \"$base/device_serial\" 2>/dev/null; \
# device_mode MUST be writable
[ -e \"$base/device_mode\" ] && chmod 0660 \"$base/device_mode\" 2>/dev/null; \
'"
# Ensure hidraw nodes are accessible too
ACTION=="add|change", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1532", MODE:="0660", GROUP:="plugdev"
EOF
Ensure hidraw devices are accessible
ACTION=="add|change", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1532", \
MODE:="0660", GROUP:="plugdev"
- Reload rules:
Reload udev rules
bash udevadm control --reload-rules udevadm trigger
- Ensure your user is in the plugdev group:
Add user to plugdev
bash usermod -aG plugdev $USER
- Re-login afterwards.
Start OpenRazer Daemon
Debug Mode (Foreground)
bash openrazer-daemon -F
Background Mode
openrazer-daemon
Verify Devices
bash razer-cli -ls
Found 2 Razer device(s)
Razer Mamba Elite
Razer Ornata V2
RGB Control
- Set Static Yellow (RGB 255 255 0)
- Mouse (device 0)
Set Static Yellow (RGB 255 255 0) - Mouse is device: 0
for z in logo scroll_wheel left right; do razer-cli -d 0 -z "$z" -e static -c 255 255 0 done
Keyboard (device 1)
bash razer-cli -d 1 -z generic -e static -c 255 255 0
Set Magenta (RGB 255 0 255)
bash razer-cli -d 1 -z generic -e static -c 255 0 255
Color Format Options
- razer-cli supports:
Sync and Save Settings
bash razer-cli --sync
Restore previous settings
razer-cli --restore
Add modules to autoload at boot
cat << "EOF" > /etc/modules-load.d/openrazer.conf
razerkbd
razermouse
EOF
Troubleshooting
Devices Not Found
bash lsusb | grep -i razer lsmod | grep razer
Ensure:
- Kernel modules loaded
- D-Bus running
- User in plugdev
- Permissions Error
Check ownership
bash ls -l /sys/devices/.../device_type
root plugdev
If not shown as above, reload udev rules
udevadm control --reload-rules
udevadm trigger
Useful Commands
List Full Device Capabilities
bash razer-cli -l
Set Brightness
bash razer-cli -d 0 -z logo -e brightness -b 100
Enable Spectrum Effect
bash razer-cli -d 1 -z generic -e spectrum
razer-cli help commands
razer-cli -h
usage: razer-cli [-h] [-man [MANUAL ...]] [-v] [-d DEVICE [DEVICE ...]]
[-a] [-e EFFECT [EFFECT ...]] [-c COLOR [COLOR ...]]
[-z ZONES [ZONES ...]] [-b BRIGHTNESS [BRIGHTNESS ...]]
[--dpi DPI] [--poll POLL]
[--battery BATTERY [BATTERY ...]] [-l] [-ll] [-ls]
[--sync] [--restore] [--version]
optional arguments:
-h, --help show this help message and exit
-man [MANUAL ...], --manual [MANUAL ...]
Print help details for given feature(s)
-v, --verbose increase output verbosity
-d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...]
only affect these devices, same name as output of
-l
-a, --automatic try to find colors and set them to all devices
without user arguments, uses X or pywal colors
-e EFFECT [EFFECT ...], --effect EFFECT [EFFECT ...]
set effect
-c COLOR [COLOR ...], --color COLOR [COLOR ...]
choose color (default: X color1), use one argument
for hex, or three for base10 rgb
-z ZONES [ZONES ...], --zone ZONES [ZONES ...]
choose zone for color(s)
-b BRIGHTNESS [BRIGHTNESS ...], --brightness BRIGHTNESS [BRIGHTNESS ...]
set brightness of device
--dpi DPI set DPI of device (use print as a value to show
it)
--poll POLL set polling rate of device (use print as a value
to show it)
--battery BATTERY [BATTERY ...]
set low threshold and/or idle delay (use print as
a value to show it)
-l, --list_devices list available devices, settings, and their
supported capabilities/effects
-ll, --list_devices_long
list available devices settings, and list their
supported capabilities/effects
-ls, --list_devices_short
list available devices and their settings
--sync sync lighting effects to all supported Razer
products
--restore Load last used settings
--version Print version number
- OpenRazer is now fully configured on Gentoo.