[Solved] Turn off Raspberry LEDs

My YunoHost server

Hardware: Raspberry Pi 4 Model B
YunoHost version: 4.1.7.1 (stable)
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hello,

I am trying to turn off the LEDs of my Raspberry.
It seems that the way to do it differs depending on the OS.

For Raspbian for example, it seems to be the following:

echo 1 >/sys/class/leds/led0/brightness #Turn on
echo 0 >/sys/class/leds/led0/brightness #Turn off

Based on that, I tried this:

echo 0 | sudo tee /sys/class/leds/phy0-led/brightness

It sends me back a “0” but nothing changes.

What I would like to do is, if possible, to turn off the following LEDs:

  • red (power)
  • green (ethernet)
  • orange (ethernet)

Is there any solution?
Thank you!
Thibaut

This is clearly related to your device, YunoHost has no say in this matter. You would have better luck in Raspberry Pi’s documentation and forums. :confused:

However, I have just tried the following on both my RPi3 and RPi4 and it works on the power leds (green and red).

echo 0 > /sys/class/leds/led0/brightness
echo 0 > /sys/class/leds/led1/brightness

:warning: note that you had missed a space between > and /

1 Like

Thank you, it worked :slight_smile:

2 Likes

Additional note in order to make the change permanent:

On Raspberry 4B

sudo nano /etc/rc.local

Add:
echo 0 > /sys/class/leds/led0/brightness
echo 0 > /sys/class/leds/led1/brightness

So it looks like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
echo 0 > /sys/class/leds/led0/brightness #Turn off Green LED
echo 0 > /sys/class/leds/led1/brightness #Turn off Red LED
exit 0

On other versions of the Raspberry

Some solutions here but I didn’t try.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.