Serial port authorization problem in beaglebone black board

Hi,I have a I have a beaglebone black board and I want to control one serialport, there have 6 serialports(/dev/ttyS0-/ dev/ttyS5). The node-RED flow is simple as follows:


But after deployment, there has an error message:” Permission denied, cannot open /dev/ttyS2". i run this

chmod a+rw /dev/ttyS2

so serialport can be connected because There is a small green dot below the”serial out” icon.
image
But after reboot, it can not be opened and I need to use “chmod a+rw /dev/ttyS2” again. I know serialport should be authorized before using.I want to serialports could be connected automatically after the BBB is powered on. should I login Node-red as root mode or edit the settings.js ? I am a new user of beaglebone black board and Node-RED. How to do? I hope someone can help me solve this problem, Here I express my gratitude in advance to those who can help me.

Hi!
You need to add the user that node-red is running as to the group that has access to the serial port.

you can do that with the command

sudo usermod -a -G tty pi

It may not be the group tty on your linux.. you need to check that obviously

Hardware is beaglebone instead of Pi. So,I think the command "sudo usermod -a -G tty pi" is invalid. The Node-red service is automatically started after power on, so I am not sure about the login user of Node-red. I use this command and got some informations:

debian@beaglebone:~$ ls -l /dev/ttyS*
crw------- 1 debian tty     4, 64 Feb 12  2021 /dev/ttyS0
crw-rw---- 1 root   dialout 4, 65 Feb 12 10:56 /dev/ttyS1
crw-rw---- 1 root   dialout 4, 66 Feb 12 10:56 /dev/ttyS2
crw-rw---- 1 root   dialout 4, 67 Feb 12 10:56 /dev/ttyS3
crw-rw---- 1 root   dialout 4, 68 Feb 12 10:56 /dev/ttyS4
crw-rw---- 1 root   dialout 4, 69 Feb 12 10:56 /dev/ttyS5

should I login Node-red as root mode or edit the settings.js ?which one ID is Node-red default user and group?

I think Node-RED runs as user/group node-red/node-red
so yes maybe try adding node-red to the dialout group

sudo usermod -a -G dialout node-red

you may need to restart node-red (or reboot) afterwards to ensure that the session picks it up

@RobertCNelson - do you think this should be enabled by default ?

@dceejay ,Hi,dceejay,The command "sudo usermod -a -G dialout node-red" is valid and I can open every serialport now.thank you very much.

@dceejay , i agree that should have been the default, all fixed now!

Setting up bb-node-red-installer (1.2.9-0rcnee2~buster+20210212) ...
Creating/updating node-red user account...
groupadd: group 'gpio' already exists
Updating node-red user to group gpio
Updating node-red user to group dialout
bb-node-red-installer:Installed
debian@bbb-pwr01-ser09:~$ cat /etc/group | grep dialout
dialout:x:20:debian,node-red

Regards,

1 Like

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