Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interactive server command listen failed #18

Closed
ihidchaos opened this issue Oct 23, 2023 · 2 comments · Fixed by #19
Closed

interactive server command listen failed #18

ihidchaos opened this issue Oct 23, 2023 · 2 comments · Fixed by #19
Assignees
Labels
bug Something isn't working

Comments

@ihidchaos
Copy link

ihidchaos commented Oct 23, 2023

After installing chip-tool and connecting avahi-observe and bluez, I can successfully commissioning and controlling the matter device, but I can't run chip-tool as a background service.

The command I used was sudo chip-tool interactive server and I encountered the following error, the key error is listen failed with error 1.

However, the chip-tool I built using CHIP source code does not encounter any errors and starts normally, so I'm wondering if this is due to the snap program needing extra permissions or parameters?

For example, is it possible to not have permission to write to InteractiveCommands.cpp causing a runtime failure? If so, I wonder if I need to add similar code inside snapcraft.yaml#L90?

The source code for this command is located in InteractiveCommands.cpp, the purpose of which is to start a websocket service and accept connections and command requests.

interactive_server.txt

@MonicaisHer MonicaisHer self-assigned this Oct 23, 2023
@farshidtz
Copy link
Member

Thanks for reporting the issue.

For example, is it possible to not have permission to write to InteractiveCommands.cpp causing a runtime failure? If so, I wonder if I need to add similar code inside snapcraft.yaml#L90?

The application already has access to write under /tmp. This is a per-snap temporary directory.
The reason for mapping that path in the reference code is to make Chip Tool's storage and configuration persisted.

From the logs, it looks like the server is trying to listen on a port:

[1698030275.823345][5293:5293] CHIP:IN: UDP::Init bind&listen port=5550
[1698030275.823454][5293:5293] CHIP:IN: UDP::Init bound to port=5550
[1698030275.823476][5293:5293] CHIP:IN: UDP::Init bind&listen port=5550
[1698030275.823564][5293:5293] CHIP:IN: UDP::Init bound to port=5550
[1698030275.823585][5293:5293] CHIP:IN: TransportMgr initialized
[1698030275.823867][5293:5317] CHIP:DL: CHIP task running
listen failed with error 1

@MonicaisHer
Copy link
Contributor

The error happened because the chip-tool snap didn't have permission to connect to a specific network port (UDP port 5550).

To fix this, we can give the chip-tool snap the right permission to connect to the network port by adding a network-bind interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants