netbird: move state file to reduce storage wear

Add `NB_DNS_STATE_FILE="/var/lib/netbird/state.json"` to the init
environment. This moves the state from the directory
`/root/.config/netbird` to the file `/var/lib/netbird/state.json` to
avoid storage wear. Note: the file is not preserved across reboots.

The state file contains information such as locally disabled routes and
other data primarily useful for desktop clients. In OpenWrt setups,
these changes are normally handled by the NetBird `management` server.
This matches the behavior prior to `netbird` v0.52.x, I have not
received any reports that this file caused problems before, so it is
unlikely to cause issues now.

The previous state file `/root/.config/netbird/state.json` can be removed.

Signed-off-by: Wesley Gimenes <wehagy@proton.me>
This commit is contained in:
Wesley Gimenes
2026-02-17 04:04:06 -03:00
committed by Wesley Gimenes
parent 5a495b2240
commit 696c2b6096
2 changed files with 2 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=netbird
PKG_VERSION:=0.60.8
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/netbirdio/netbird/tar.gz/v$(PKG_VERSION)?

View File

@@ -12,6 +12,7 @@ start_service() {
procd_set_param env NB_STATE_DIR="/root/.config/netbird"
procd_append_param env NB_DISABLE_SSH_CONFIG="1"
procd_append_param env NB_DNS_STATE_FILE="/var/lib/netbird/state.json"
procd_set_param pidfile /var/run/netbird.pid
procd_close_instance