1

I see there are quite a few posts about this already but none seem to work for me.

I am running a pihole server on my RPi 3 and I would like to turn off the external power and LAN LEDs (green and orange) as they can be quite bright at night. I am running a Raspberry Pi 3 Model B Rev 1.2

I know it is possible to do as I managed to achieve this once before but it was a few years ago and I can't remember the steps I took. Also not sure if anything changed in the later versions of Raspbian.

I have tried methods mentioned in this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=149126 as well as https://www.jeffgeerling.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi and Turning off LEDs on Raspberry Pi 3 and quite a few others but nothing seems to work for me.

One of the methods /boot/config.txt

# Disable Ethernet LEDs
dtparam=eth_led0=14
dtparam=eth_led1=14

# Disable the PWR LED
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

# Disable the Activity LED
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

Has anyone achieved this on a Pi 3 Model B and could share the method?

EDIT

$ cat /sys/class/leds/led0/trigger
[none] rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot heartbeat backlight gpio cpu cpu0 cpu1 cpu2 cpu3 default-on input panic actpwr mmc1 mmc0 rfkill-any rfkill-none rfkill0 rfkill1
3
  • 1
    I know it's not helping, but overlay LED settings do work on a Pi 4. Do you have anything in /sys/class/leds? – Dmitry Grigoryev Oct 15 '20 at 14:28
  • 1
    Are you using a 3 or 3B+? The documentation states "N.B. For Pi 3B, 3B+, 3A+ and 4B, use the act-led overlay" – Milliways Oct 15 '20 at 23:11
  • @DmitryGrigoryev the following is in /sys/class/leds default-on led0 led1 mmc0 @Milliways it is a 3B – GiarcTNA Oct 16 '20 at 12:47
3

You control the green activity led with /sys/class/leds/led0/trigger and the red power led with /sys/class/leds/led1/trigger. First look at its standard settings with:

rpi ~$ cat /sys/class/leds/led0/trigger
none rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot heartbeat backlight gpio cpu cpu0 cpu1 cpu2 cpu3 default-on input panic actpwr [mmc0]

rpi ~$ cat /sys/class/leds/led1/trigger
none rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot heartbeat backlight gpio cpu cpu0 cpu1 cpu2 cpu3 default-on [input] panic actpwr mmc0

The settings within square brackets are set on boot up: [mmc0] for the green activity led and [input] for the red power led on my Raspberry Pi 3B. Don't forget them if you want to reset to these trigger without booting.

To turn the leds permanent on just use trigger default-on, to turn them off use none with:

rpi ~$ sudo bash -c 'echo none > /sys/class/leds/led0/trigger'
rpi ~$ sudo bash -c 'echo none > /sys/class/leds/led1/trigger'
6
  • Thanks for the reply. It seems both LEDs are already set to none, I have updated my original post with the output of led0 – GiarcTNA Oct 16 '20 at 12:53
  • @GiarcTNA What Raspberry Pi version exactly do you use? RPi 3B or RPi 3B+? Have you tried to switch the LEDs on and off? – Ingo Oct 16 '20 at 18:04
  • It is the RPi 3B running the latest Raspbian. I don't seem to be able to switch them off. I have managed to do this before so I am not sure why it is not working now. – GiarcTNA Oct 18 '20 at 11:39
  • I saw in another post that someone wasn't able to do it with the latest Raspbian version (Buster). I suppose I can try another OS to see. raspberrypi.stackexchange.com/questions/70593/… – GiarcTNA Oct 18 '20 at 11:51
  • @GiarcTNA Maybe it is active low? Try to switch ON with trigger none. – Ingo Oct 18 '20 at 23:45
1

The existing two answers only handle the power LEDs and say nothing about the LAN LEDs. I tried this often linked tool: https://www.raspberrypi.org/forums/viewtopic.php?t=72070
…and also this one using /boot/config.txt: https://www.raspberrypi.org/forums/viewtopic.php?p=1445502&sid=f0624b638874faf337f71c23b969e326#p1445502
Neither worked for me. What did work was this tool (which for some reason only exists as a proof of concept in a pull request for a Linux distribution): https://github.com/LibreELEC/LibreELEC.tv/pull/1653
To be safe, I archived it on web.archive.org: http://web.archive.org/web/20210118022304/http://lrusak.libreelec.tv/public/lan951x-led-ctl

Usage: Make executable (e.g. with sudo chmod -R 777 lan951x-led-ctl), then:

sudo ./lan951x-led-ctl --fdx=0 --lnk=0 --spd=0

1 instead of 0 to enable LEDs, s to check status, order and completion doesn't matter. I don't know what these three abbreviations mean, I only have two LAN LEDs, but it also doesn't seem to hurt to use all three arguments. Calling the program without arguments outputs help.

This only applies in the moment, so it needs to be redone after every reboot, preferably with some kind of autostart method.

0

Rather than use the device tree I've had success using the "tmpfiles.d" hook provided by systemd.

For example, create a new file leds.conf at /etc/tmpfiles.d/:

w    /sys/class/leds/led0/trigger    - - - - timer
w    /sys/class/leds/led0/delay_off  - - - - 5000
w    /sys/class/leds/led0/delay_on   - - - - 1

That should give you a very short blink every 5 seconds on the green LED after a reboot. Adjust and expand to suit...

1
  • Unfortunately this didn't seem to work. Even using your settings unchanged it didn't blink the green LED – GiarcTNA Oct 28 '20 at 16:03
0

Since most keyboards (if you even have one connected) don't have an AltGr key, the following worked for me to successfully switch off the power LED by assigning it to light up when ALtGr is engaged:

echo kbd-altgrlock >/sys/class/leds/led1/trigger

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.