netbird
netbird copied to clipboard
Alternative socket address via --daemon-addr or NB_DAEMON_ADDR not always respected
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.
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
- Change the socket address
- Set the NB_DAEMON_ADDR environment variable to the new socket and make sure the old one doesn't exist
- Execute netbird up (works)
- 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.
Hi @oddlama, the the routes command is not reading the env variables. This is a bug. We will fix it.