node-red / node-red/node-red-nodes

Permission problem Sense Hat node

Open
#980 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Which node are you reporting an issue on?

node-red-node-pi-sense-hat

What are the steps to reproduce?
  • Install node-red-node-pi-sense-hat
  • Use the Sense Hat node (out) in a flow
  • Connect the node to inject with [4-6,*,purple]
  • Deploy the flow
What happens?
  • The Sense Hat node is [disconnected]
  • Log shows:
    pam_unix(sudo:auth): conversation failed
    pam_unix(sudo:auth): auth could not identify password for [nodered]
  • The Sense Hat LED array is blank

Seems like the node is trying to sudo a certain command and cannot without the user passwd. Since I can't find what the node is trying to access using sudo I can't specify that very command in /etc/sudoers as a NOPASSWD. The current workaround basically gives all access to all and any command to the dedicated user I created named nodered.

What do you expect to happen?
  • The Sense Hat node is [connected]
  • The Sense Hat LED array shows 3 vertical purple lines
Please tell us about your environment:
  • Node-RED version: 3.0
  • node.js version: 18
  • npm version: 9.5
  • Platform/OS: Raspberry Pi OS 64 bit latest
  • Browser: Chrome
(Sub-optimal) first workaround

I put this line in /etc/sudoers: nodered ALL=(ALL) NOPASSWD: ALL

Better (current) workaround (March 12)

sudo is not needed when calling the sensehat Python script.

sensehat Python script (Line 18)

Replaced by (no $SUDO):

$python_cmd -u $BASEDIR/sensehat.py $@

My Python installation is pretty much run-of-the-mill (as the configuration of the SenseHat module) and does not require sudo when running the script linked above.

Thanks for your help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with hardware/sensehat/sensehat, especially the linked line 18, and trace how the Sense Hat node launches sensehat.py. Reproduce the node-red-node-pi-sense-hat flow on Raspberry Pi OS and check the sudo authentication logs. Done means the node connects and displays the expected three vertical purple lines without requiring broad sudoers access.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, python, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.