[GH-ISSUE #1079] systemd unit file improvements #1677

Open
opened 2026-08-05 00:43:31 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @sebastianschauenburg on GitHub (Aug 12, 2023).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/1079

Describe the problem
After a reboot, netbird fails to start using the systemd unit file netbird.service. Example of an error which is visible:

aug 11 12:48:14 hostname systemd[7480]: netbird.service: Failed to set up standard output: No such file or directory

I'm using a Ubuntu 23.04 system with netbird 0.22.3 (installed via apt).

To Reproduce

  1. Set up /var/log as RAM log with (for example) log2ram.
  2. Reboot the system
  3. View the error logs

Expected behavior
No errors and a working netbird interface

Additional context

/var/log/netbird is created at a certain point, but was not synced to the persistent /var/log (if available). So effectively, after a reboot, the /var/log/netbird directory does not exist. This in turn means it cannot be used for stdout and stderr.
I tried creating it with an ExecStartPre using mkdir inside the unit file, but attaching the stdout and stderr apparently happens before that point and as such, errors with:

aug 11 12:49:36 hostname systemd[8997]: netbird.service: Failed at step STDOUT spawning /usr/bin/mkdir: No such file or directory

Proposed solution
Add this to the unit file, which ensures client.log can be created / updated:

ExecStartPre=/usr/bin/mkdir /var/log/netbird

Remove the following lines, since that output should be captured inside of systemd (journalctl) anyway:

StandardOutput=file:/var/log/netbird/netbird.out
StandardError=file:/var/log/netbird/netbird.err
Originally created by @sebastianschauenburg on GitHub (Aug 12, 2023). Original GitHub issue: https://github.com/netbirdio/netbird/issues/1079 **Describe the problem** After a reboot, netbird fails to start using the systemd unit file ```netbird.service```. Example of an error which is visible: aug 11 12:48:14 hostname systemd[7480]: netbird.service: Failed to set up standard output: No such file or directory I'm using a Ubuntu 23.04 system with netbird 0.22.3 (installed via apt). **To Reproduce** 1. Set up /var/log as RAM log with (for example) [log2ram](https://github.com/azlux/log2ram). 2. Reboot the system 3. View the error logs **Expected behavior** No errors and a working netbird interface **Additional context** ```/var/log/netbird``` is created at a certain point, but was not synced to the persistent /var/log (if available). So effectively, after a reboot, the ```/var/log/netbird``` directory does not exist. This in turn means it cannot be used for stdout and stderr. I tried creating it with an ```ExecStartPre``` using ```mkdir``` inside the unit file, but attaching the stdout and stderr apparently happens before that point and as such, errors with: aug 11 12:49:36 hostname systemd[8997]: netbird.service: Failed at step STDOUT spawning /usr/bin/mkdir: No such file or directory **Proposed solution** __Add__ this to the unit file, which ensures ```client.log``` can be created / updated: ExecStartPre=/usr/bin/mkdir /var/log/netbird __Remove__ the following lines, since that output should be captured inside of systemd (journalctl) anyway: StandardOutput=file:/var/log/netbird/netbird.out StandardError=file:/var/log/netbird/netbird.err
saavagebueno added the feature-requestsystem-compatibility-issue labels 2026-08-05 00:43:31 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#1677