0

I have two RPis one 3B Model 1.2 one 4B. I set up both as subnet routers for Tailscale and wanted to turn off both the Power/Activity and Ethernet LEDs (all the LEDs). I put PiOS 64 Lite (Bullseye) on both units.

On the 4B it was straightforward, I followed the directions here for amending config.txt in boot (although he got line #2 wrong, it should be dtparam=pwr_led_trigger=none). They all turn off at or shortly after boot.

https://smarthomescene.com/guides/how-to-disable-leds-on-raspberry-pi-3b-4b/ and https://www.manuel-bauer.net/blog/turn-off-the-leds-on-a-raspberry-pi

On the 3B it was much more challenging. This post is about disabling LEDs on the 3B. I ended up with a hybrid of commands in:

(a) config.txt for the Power/Activity LEDs using the post above; and (b) in rc.local based on Andrews Cordolino Sobral's post here:

Turn off external LEDs on Raspberry Pi 3 and here https://gist.github.com/andrewssobral/840c5be9aff3347d358a43bb5deb1a9e

There are other versions but these are (I believe the originals).

I say hybrid because for (a), the last two sets of commands in config.txt did not work

# Turn off Power LED
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

Turn off Activity LED

dtparam=act_led_trigger=none dtparam=act_led_activelow=off

Turn off Ethernet ACT LED

dtparam=eth_led0=14

Turn off Ethernet LNK LED

dtparam=eth_led1=14

and for (b) the first four lines did not work on my Pi 3B:

sudo sh -c 'echo none > /sys/class/leds/led0/trigger'
sudo sh -c 'echo none > /sys/class/leds/led1/trigger'
sudo sh -c 'echo 0 > /sys/class/leds/led0/brightness'
sudo sh -c 'echo 0 > /sys/class/leds/led1/brightness'
sudo sh -c 'sudo /home/pi/Projects/lan951x-led-ctl/lan951x-led-ctl --fdx=0 --lnk=0 --

For example:

/etc$ sudo sh -c 'echo none > /sys/class/leds/led0/trigger'
sh: 1: cannot create /sys/class/leds/led0/trigger: **Directory nonexistent**

I am very new to all this, so it was a challenge for me to git clone and make lan951x-led-ctl, it kept throwing permission errors but that's another story.

I wanted to understand why (b) did not work for the Power/Activity LEDs, it appears it is due to teh led0 and led1 dirs not existing on my unit.

Around the internet there are many references to the /sys/class/leds/led0 and led1 directories.

My Pi 4B has these directories (but I do not reference them, directly at least, to issue commands to turn off the the LEDs).

My Pi 3B has a /sys/class/leds directory but it does NOT have any led0 or led1 subdirectory. Others have a similar query (trumpet205 here e.g. https://forums.raspberrypi.com/viewtopic.php?t=149126).

Rather it has these four subdirectories, all as shortcuts only:

/ACT (as a shortcut) /default-on (as a shortcut) /mmc0 (as a shortcut) /PWR (as a shortcut)

Now, INSIDE /ACT and /POWER shortcuts are actually trigger and brightness files. Assuming led0=ACT and led1=PWR, replacing the dir path with ACT and PWR and issuing the sudo turns ON the lights:

sudo sh -c 'echo input > /sys/class/leds/ACT/trigger'
sudo sh -c 'echo input > /sys/class/leds/PWR/trigger'
sudo sh -c 'echo 1 > /sys/class/leds/ACT/brightness'
sudo sh -c 'echo 1 > /sys/class/leds/PWR/brightness'

Reverting to none and 0 turns them off, as expected. Progress.

sudo sh -c 'echo none > /sys/class/leds/ACT/trigger'
sudo sh -c 'echo none > /sys/class/leds/PWR/trigger'
sudo sh -c 'echo 0 > /sys/class/leds/ACT/brightness'
sudo sh -c 'echo 0 > /sys/class/leds/PWR/brightness'

So my query is simply this, why, with identical PiOS 64 installs and ostensibly part of the 3B, 3B+, 4B and 400 family who I have seen all referenced to /sys/class/leds/led0 and led1, why does my 3B model 1.2 NOT have these directories?

I have searched on "/sys/class/leds/ACT/trigger" and "/sys/class/leds/PWR/trigger" and they do show up here https://raspi.debian.net/faq/ (without explanation). While I came across a couple of folks who are also missing these dirs, there was no explanation why (or whether they should have them).

Is it by design i.e. I should just use the ACT and PWR as I have above or am I missing them?

If nothing else, hopefully this query will help someone wondering the same things I did.

EDIT1: If ACT and PWR were introduced in Bullseye to replace led0 and led1, and I put Bullseye (PiOS 64 Lite) on both the 3B and 4B, I am scratching my head as to why the 3B got these newer ACT and PWR dirs, but the 4B got the old led0 and led1 ones. Anyway, it is a quick fix to change the dir path in rc.local.

jksmurf
  • 3
  • 3

1 Answers1

0

It is unclear from your rather rambling question exactly what you are asking.

/sys/devices/platform/leds/leds/PWR was introduced in Bullseye, before that it was /sys/devices/platform/leds/leds/led1

I use the following to turn PWR LED on or off. If you want to do this permanently use dtparam.

#!/bin/bash
# script to turn PWR LED ON/OFF
# PWRLED or PWRLED OFF turns LED off
# PWRLED anything turns LED ON
# 2023-05-06

ONOFF="$1" if [ "${ONOFF}" = "" ]; then ONOFF="0" else if [ "${ONOFF}" = "OFF" ]; then ONOFF="0" else ONOFF="255" fi fi

if [ -e /sys/devices/platform/leds/leds/PWR ]; then echo $ONOFF | sudo tee /sys/devices/platform/leds/leds/PWR/brightness > /dev/null else # for older OS without leds/PWR echo $ONOFF | sudo tee /sys/devices/platform/leds/leds/led1/brightness > /dev/null fi

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • They said provide as much information as possible.

    TLDR, the question was should I have /sys/class/leds/led0 and /sys/class/leds/led1 directories on a Pi3 Model B Rev 1.2, is it a known difference that it should be /sys/class/leds/ACT and /sys/class/leds/PWR or is there some error in my system? I can make it work with the led0→ACT and led1→PWR amendments. You answered that in your first two lines, thanks.

    – jksmurf Jul 17 '23 at 03:27
  • You stated "I have two RPis one 3B Model 1.2 one 4B … all of them. PiOS 64 Lite (Bullseye)" which was the cause of my confusion. – Milliways Jul 17 '23 at 04:13