Skip to content

systemd unit file improvements #1079

Open
@sebastianschauenburg

Description

@sebastianschauenburg

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions