Here's how you can disable the 'active'-LED and the power-LED on a rasbperry pi (and probably on other boards too):

Manual - Permanent

See https://stackoverflow.com/questions/19863723/turn-off-leds-of-raspberry-pi

Manual


Initially you have to find the correct name of the desired LED.

Run: echo 0 | sudo tee /sys/class/leds/led1/brightness > /dev/null

  • where you can try different led1s
  • With kernel 5.18 i have /sys/class/leds/PWR/ and /sys/class/leds/ACT

On a RPI 4 led1 is the power-LED and led0 is the 'active' LED.

systemd service

This systemd-service disables the active and power LED on a raspberry pi.
Create a service file at: /etc/systemd/system/disable-led.service with the following content:

[Unit]
Description=Disables the power-LED and active-LED
After=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=sh -c "echo 0 | sudo tee /sys/class/leds/PWR/brightness > /dev/null && echo 0 | sudo tee /sys/class/leds/ACT/brightness > /dev/null"
ExecStop=sh -c "echo 1 | sudo tee /sys/class/leds/PWR/brightness > /dev/null && echo 1 | sudo tee /sys/class/leds/ACT/brightness > /dev/null"

[Install]
WantedBy=multi-user.target
  • you can also remove && echo 0 | sudo tee /sys/class/leds/ACT/brightness > /dev/null to disable only the power-LED (or vice versa)
  • enable it at startup sudo systemctl enable disable-led.service
  • to start immediately: sudo systemctl start disable-led.service
  • to enable the LEDs again: sudo systemctl stop disable-led.service

Drawbacks of disabling the LEDs is that you don't know if the device is powered on and if it's under heavy load.

I needed it as they run in my bedroom and the lights were distracting (and to check if they are running i can ping then or do a nmap -sP 192.X.X.X/24 if they have a dynamic IP)