Alternative socket address via --daemon-addr or NB_DAEMON_ADDR not always respected #904

Closed
opened 2025-11-20 05:19:37 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @oddlama on GitHub (May 18, 2024).

Describe the problem

When running the netbird ui on an alternative socket (netbird-ui --daemon-addr=unix:///var/run/netbird-home/sock), clicking on "Network Routes" fails because it still tries to connect to the default socket on /var/run/netbird/sock.

image

Weirdly, a similar issue is occurring on the CLI tool and environment variables:

export NB_DAEMON_ADDR=${NB_DAEMON_ADDR-'unix:///var/run/netbird-home/sock'}
export NB_SERVICE=${NB_SERVICE-'netbird-home'}
exec netbird  "$@"

Executing this wrapper (let's call it netbird-home) will work just fine when using e.g. netbird-home up, and the daemon address is correctly used. But executing netbird-home routes list tries to connect to /var/run/netbird/sock and results in:

Error: failed to connect to daemon error: context deadline exceeded
If the daemon is not running please run: 
netbird service install 
netbird service start

Executing netbird-home routes --daemon-addr=unix:///var/run/netbird-home/sock list instead works, so somehow the environment variable seems to not be respected for routes.

To Reproduce

  1. Change the socket address
  2. Set the NB_DAEMON_ADDR environment variable to the new socket and make sure the old one doesn't exist
  3. Execute netbird up (works)
  4. Execute netbird routes list (doesn't work)

Expected behavior

The correct socket should always be used.

Are you using NetBird Cloud?

Self-hosted

NetBird version

0.27.4

NetBird status -d output:

If applicable, add the `netbird status -d' command output.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Originally created by @oddlama on GitHub (May 18, 2024). **Describe the problem** When running the netbird ui on an alternative socket (`netbird-ui --daemon-addr=unix:///var/run/netbird-home/sock`), clicking on "Network Routes" fails because it still tries to connect to the default socket on `/var/run/netbird/sock`. ![image](https://github.com/netbirdio/netbird/assets/31919558/376d8fc2-7b63-43a1-b62d-06e6cee50730) Weirdly, a similar issue is occurring on the CLI tool and environment variables: ```bash export NB_DAEMON_ADDR=${NB_DAEMON_ADDR-'unix:///var/run/netbird-home/sock'} export NB_SERVICE=${NB_SERVICE-'netbird-home'} exec netbird "$@" ``` Executing this wrapper (let's call it `netbird-home`) will work just fine when using e.g. `netbird-home up`, and the daemon address is correctly used. But executing `netbird-home routes list` tries to connect to `/var/run/netbird/sock` and results in: ``` Error: failed to connect to daemon error: context deadline exceeded If the daemon is not running please run: netbird service install netbird service start ``` Executing `netbird-home routes --daemon-addr=unix:///var/run/netbird-home/sock list` instead works, so somehow the environment variable seems to not be respected for routes. **To Reproduce** 1. Change the socket address 2. Set the NB_DAEMON_ADDR environment variable to the new socket and make sure the old one doesn't exist 3. Execute netbird up (works) 4. Execute netbird routes list (doesn't work) **Expected behavior** The correct socket should always be used. **Are you using NetBird Cloud?** Self-hosted **NetBird version** `0.27.4` **NetBird status -d output:** If applicable, add the `netbird status -d' command output. **Screenshots** If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here.
saavagebueno added the bugclientclient-ui labels 2025-11-20 05:19:37 -05:00
Author
Owner

@pascal-fischer commented on GitHub (May 21, 2024):

Hi @oddlama, the the routes command is not reading the env variables. This is a bug. We will fix it.

@pascal-fischer commented on GitHub (May 21, 2024): Hi @oddlama, the the routes command is not reading the env variables. This is a bug. We will fix it.
Author
Owner

@nazarewk commented on GitHub (Apr 23, 2025):

I'm pretty sure we can close this with https://github.com/netbirdio/netbird/pull/2026

@nazarewk commented on GitHub (Apr 23, 2025): I'm pretty sure we can close this with https://github.com/netbirdio/netbird/pull/2026
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#904