Can't control LEDs on BBB from terminal

Hello,

debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 1 > brightness
-bash: brightness: Permission denied
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ sudo echo 1 > brightness
-bash: brightness: Permission denied

Any suggestions ?

Thanks.

Hello,

debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 1 >
brightness
-bash: brightness: Permission denied
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ sudo echo 1 >
brightness
-bash: brightness: Permission denied

  As I recall, you can't use I/O redirection with sudo. The ">
brightness" accesses the file using your regular user account.

  What group "owns" those "files". Add your user account to that group.

  How old is the OS on the image you are using -- most images in the last
year or more are already configured to let the user account access the GPIO
et al devices.

This is on a BBBlack:

debian@beaglebone:~$ groups
debian adm kmem dialout cdrom floppy audio dip video plugdev users
systemd-journal bluetooth netdev i2c cloud9ide xenomai weston-launch tisdk
docker iio spi admin remoteproc eqep pwm gpio
debian@beaglebone:~$

{Hmmm, the spec for the LEDs surprised me}
debian@beaglebone:~$ ls -l /sys/class/leds
total 0
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 beaglebone:green:usr0 ->
../../devices/platform/leds/leds/beaglebone:green:usr0
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 beaglebone:green:usr1 ->
../../devices/platform/leds/leds/beaglebone:green:usr1
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 beaglebone:green:usr2 ->
../../devices/platform/leds/leds/beaglebone:green:usr2
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 beaglebone:green:usr3 ->
../../devices/platform/leds/leds/beaglebone:green:usr3
debian@beaglebone:~$

NOTE: group gpio!

debian@beaglebone:~$ cd /sys/class/leds/beaglebone\:green\:usr3
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ ls -l
total 0
-rw-rw-r-- 1 root gpio 4096 Aug 17 12:33 brightness
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 device -> ../../../leds
-r--r--r-- 1 root gpio 4096 Aug 17 12:33 max_brightness
drwxrwxr-x 2 root gpio 0 Aug 17 12:33 power
lrwxrwxrwx 1 root gpio 0 Aug 17 12:33 subsystem ->
../../../../../class/leds
-rw-rw-r-- 1 root gpio 4096 Aug 17 12:33 trigger
-rw-rw-r-- 1 root gpio 4096 Aug 17 12:33 uevent
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 1 >
brightness
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 0 >
brightness
debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ cd ~
debian@beaglebone:~$ echo 1 >
/sys/class/leds/beaglebone\:green\:usr3/brightness
debian@beaglebone:~$ echo 0 >
/sys/class/leds/beaglebone\:green\:usr3/brightness
debian@beaglebone:~$

  No "sudo" in sight.

Thanks Dennis,

In my case there is no gpio, but root 2 times.

debian@beaglebone:~$ ls -l /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr0 → …/…/devices/platform/leds/leds/beaglebone:green:usr0
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr1 → …/…/devices/platform/leds/leds/beaglebone:green:usr1
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr2 → …/…/devices/platform/leds/leds/beaglebone:green:usr2
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr3 → …/…/devices/platform/leds/leds/beaglebone:green:usr3
debian@beaglebone:~$

Your missing this udev rule:

https://github.com/beagleboard/customizations/blob/master/etc/udev/rules.d/88-leds-noroot.rules

sudo apt update ; sudo apt install bb-customizations

Regards,

Thanks Dennis,

In my case there is no *gpio, *but *root* 2 times.

  I'll repeat my previous question: How old is the OS image on that
device?

debian@beaglebone:~$ ls -l /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr0 ->
../../devices/platform/leds/leds/beaglebone:green:usr0

  That "Jan 1 2000" also alarms me, though I am quite sure no Beagle
images go back that far. At best I suspect you have no connection to an NTP
server -- since my system shows a time stamp of yesterday, just before noon
-- which was probably when I ran "sudo apt update" / "sudo apt upgrade -y"

Here is kernel:
4.14.108-ti-r119

But it doesn’t boot anymore !

After update and installing bb-customization I get this:
Starting kernel …

[ 0.000771] timer_probe: no matching timers found
[ 0.610313] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 0.850039] omap_voltage_late_init: Voltage driver support not added
[ 0.857068] PM: Cannot get wkup_m3_ipc handle
[ 1.163793] hdmi-audio-codec hdmi-audio-codec.0.auto: ASoC: no source widget found for Playback
[ 1.172667] hdmi-audio-codec hdmi-audio-codec.0.auto: ASoC: Failed to add route Playback → direct → TX
[ 1.187598] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.195919] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.108-ti-r119 #1
[ 1.202735] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 1.208902] [] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[ 1.216694] [] (show_stack) from [] (dump_stack+0x80/0x94)
[ 1.223958] [] (dump_stack) from [] (panic+0x100/0x284)
[ 1.230959] [] (panic) from [] (mount_block_root+0x1b8/0x2a4)
[ 1.238481] [] (mount_block_root) from [] (mount_root+0x140/0x15c)
[ 1.246436] [] (mount_root) from [] (prepare_namespace+0x160/0x1a8)
[ 1.254479] [] (prepare_namespace) from [] (kernel_init_freeable+0x25c/0x270)
[ 1.263401] [] (kernel_init_freeable) from [] (kernel_init+0x18/0x128)
[ 1.271716] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 1.279347] —[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.047863] [drm] Cannot find any crtc or sizes

No, bb-customization is just a bunch of udev rules, that wouldn't do that..

https://github.com/rcn-ee/repos/tree/master/bb-customizations/suite/stretch/debian

Regards,

Considering you also have a thread about not getting a custom u-Boot to
work, I no longer have any idea of what combination of stuff you may have
on the board.

  At this point I'd start with a fresh SD card (8GB or more) with a
recent GOOD OS image (yes, there are newer images in the testing directory,
but I'm trying to minimize unknowns)
https://debian.beagleboard.org/images/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz

  Run the script to resize the image for the full SD card

  Boot the SD card, and run "sudo apt update" / "sudo apt upgrade" (Since
April, the repository is up to Debian 10.5, so this may entail quite a few
packages -- hence the recommendation to use an 8GB card).

  When you've verified that this card is functioning properly, you might
convert it to a flasher image (last line in /boot/uEnv.txt); reboot, and
let it flash the eMMC with a good set-up. When done, remove the SD card (if
you leave it in and reboot, it will just repeat the flashing operation).
Reboot, and verify the eMMC is working as desired.

  When booting on eMMC, you can /then/ insert the SD card, mount it into
the file system, and modify the <SD>/boot/uEnv.txt to disable the flasher
mode). That will give you a working SD card for development.

  Don't write anything to the eMMC until you've debugged it from SD card.

Ok, with new version of Linux it works … without having to install bb-customizations.

bb-customizations ships in the default image..

Regards,

They were "installed" prior to the image being frozen.

debian@beaglebone:~$ apt list --installed
Listing... Done
adduser/stable,now 3.118 all [installed]
  <SNIP>
bb-bbai-firmware/unknown,now 1.20200404.1-0~buster+20200424 all [installed]
bb-cape-overlays/unknown,now 4.14.20200814.0-0~buster+20200814 armhf
[installed]

bb-customizations/unknown,now 1.20200806.0-0~buster+20200806 all
[installed]

Ok