Skip to content

NetBird systemd service fails after package update due to missing log directory #3866

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

Open
kimasplund opened this issue May 23, 2025 · 0 comments · May be fixed by #3909
Open

NetBird systemd service fails after package update due to missing log directory #3866

kimasplund opened this issue May 23, 2025 · 0 comments · May be fixed by #3909

Comments

@kimasplund
Copy link

NetBird systemd service fails after package update due to missing log directory

Description

After updating NetBird through the package manager, the systemd service fails to start with exit code 209/STDOUT. The root cause is that the uninstaller removes the /var/log/netbird/ directory during package updates, but the installer/updater does not recreate it.

Environment

  • OS: Ubuntu 25.04 (Linux 6.14.6-061406-generic)
  • NetBird version: 0.44.0
  • Installation method: Package manager (systemd service)

Steps to Reproduce

  1. Have NetBird installed and running
  2. Update NetBird package (e.g., via apt upgrade)
  3. Check service status: sudo systemctl status netbird
  4. Service fails with exit code 209/STDOUT

Expected Behavior

The NetBird service should start successfully after package updates without manual intervention.

Actual Behavior

The service fails to start because the log directory /var/log/netbird/ is missing.

Error Logs

May 23 09:16:50 Kim-UB25-TP systemd[1]: Started netbird.service - A WireGuard-based mesh network that connects your devices into a single private network..
May 23 09:16:50 Kim-UB25-TP (netbird)[28159]: netbird.service: Failed to set up standard output: No such file or directory
May 23 09:16:50 Kim-UB25-TP (netbird)[28159]: netbird.service: Failed at step STDOUT spawning /usr/bin/netbird: No such file or directory
May 23 09:16:50 Kim-UB25-TP systemd[1]: netbird.service: Main process exited, code=exited, status=209/STDOUT
May 23 09:16:50 Kim-UB25-TP systemd[1]: netbird.service: Failed with result 'exit-code'.

Workaround

Manually create the log directory after updates:

sudo mkdir -p /var/log/netbird
sudo chown root:root /var/log/netbird
sudo chmod 755 /var/log/netbird
sudo systemctl restart netbird

Proposed Solution

The package post-install script should ensure the log directory exists:

  1. Check if /var/log/netbird/ exists
  2. If not, create it with appropriate permissions
  3. This should be done in both the installer and updater scripts

Additional Context

The systemd service configuration expects to write logs to /var/log/netbird/client.log as specified in the ExecStart command:

ExecStart=/usr/bin/netbird service run --config /etc/netbird/config.json --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log

This appears to be a packaging issue where the uninstall process (during updates) removes the log directory but the install process doesn't recreate it.

kimasplund added a commit to kimasplund/netbird that referenced this issue Jun 2, 2025
Resolves netbirdio#3866 where NetBird service fails to start after package updates
due to missing /var/log/netbird directory.

Changes:
- Add ensure_required_directories() function to post_install.sh that creates
  all required directories (/var/log, /var/run, /var/lib, /var/cache)
- Create systemd tmpfiles.d configuration for proper directory management
- Update goreleaser config to include tmpfiles in deb/rpm packages
- Ensure directories are created during both fresh installs and upgrades

This fix ensures NetBird can start successfully after package updates by
guaranteeing all required directories exist with proper permissions.
@kimasplund kimasplund linked a pull request Jun 2, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant