Can't control LEDs on BBB from terminal

96 views
Skip to first unread message

Pavel Yermolenko

unread,
Aug 20, 2020, 10:28:20 AM8/20/20
to BeagleBoard
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.

Dennis Lee Bieber

unread,
Aug 20, 2020, 11:56:26 AM8/20/20
to Beagleboard
On Thu, 20 Aug 2020 07:28:20 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko
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.

>Any suggestions ?
>
>Thanks.


--
Dennis L Bieber

Pavel Yermolenko

unread,
Aug 21, 2020, 9:05:47 AM8/21/20
to BeagleBoard
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:~$ 


Robert Nelson

unread,
Aug 21, 2020, 9:55:55 AM8/21/20
to Beagle Board
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,

--
Robert Nelson
https://rcn-ee.com/

Dennis Lee Bieber

unread,
Aug 21, 2020, 10:24:59 AM8/21/20
to Beagleboard
On Fri, 21 Aug 2020 06:05:46 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko
<py.ohayo-FOWRGO...@public.gmane.org> wrote:

>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"


--
Dennis L Bieber

Pavel Yermolenko

unread,
Aug 21, 2020, 10:41:19 AM8/21/20
to BeagleBoard
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] [<c0113180>] (unwind_backtrace) from [<c010d690>] (show_stack+0x20/0x24)
[    1.216694] [<c010d690>] (show_stack) from [<c0ce54f4>] (dump_stack+0x80/0x94)
[    1.223958] [<c0ce54f4>] (dump_stack) from [<c013f7f0>] (panic+0x100/0x284)
[    1.230959] [<c013f7f0>] (panic) from [<c14015d4>] (mount_block_root+0x1b8/0x2a4)
[    1.238481] [<c14015d4>] (mount_block_root) from [<c1401800>] (mount_root+0x140/0x15c)
[    1.246436] [<c1401800>] (mount_root) from [<c140197c>] (prepare_namespace+0x160/0x1a8)
[    1.254479] [<c140197c>] (prepare_namespace) from [<c140113c>] (kernel_init_freeable+0x25c/0x270)
[    1.263401] [<c140113c>] (kernel_init_freeable) from [<c0cfb4cc>] (kernel_init+0x18/0x128)
[    1.271716] [<c0cfb4cc>] (kernel_init) from [<c0108e28>] (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



On Friday, August 21, 2020 at 4:24:59 PM UTC+2, Dennis Bieber wrote:
On Fri, 21 Aug 2020 06:05:46 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko

Robert Nelson

unread,
Aug 21, 2020, 11:04:08 AM8/21/20
to Beagle Board
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

Dennis Lee Bieber

unread,
Aug 21, 2020, 11:35:32 AM8/21/20
to Beagleboard
On Fri, 21 Aug 2020 07:41:18 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko
<py.ohayo-FOWRGO...@public.gmane.org> wrote:

>Here is kernel:
>4.14.108-ti-r119
>
>But it doesn't boot anymore !
>
>After update and installing bb-customization I get this:

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.


--
Dennis L Bieber

Pavel Yermolenko

unread,
Aug 23, 2020, 9:04:29 AM8/23/20
to BeagleBoard
Ok, with new version of Linux it works ... without having to install bb-customizations.


On Friday, August 21, 2020 at 5:35:32 PM UTC+2, Dennis Bieber wrote:
On Fri, 21 Aug 2020 07:41:18 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko

Robert Nelson

unread,
Aug 23, 2020, 12:11:34 PM8/23/20
to Beagle Board
On Sun, Aug 23, 2020 at 8:04 AM Pavel Yermolenko <py.o...@sunrise.ch> wrote:
>
> Ok, with new version of Linux it works ... without having to install bb-customizations.
>

bb-customizations ships in the default image..

Dennis Lee Bieber

unread,
Aug 23, 2020, 12:20:03 PM8/23/20
to Beagleboard
On Sun, 23 Aug 2020 06:04:29 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Pavel Yermolenko
<py.ohayo-FOWRGO...@public.gmane.org> wrote:

>Ok, with new version of Linux it works ... without having to install
>bb-customizations.
>
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]
********************************************************************

bb-node-red-installer/unknown,now 1.1.3-0rcnee0~buster+20200806 armhf
[installed]
<SNIP>



--
Dennis L Bieber

Pavel Yermolenko

unread,
Aug 24, 2020, 7:20:56 AM8/24/20
to BeagleBoard
Ok
Reply all
Reply to author
Forward
0 new messages