[GH-ISSUE #5711] Debian post-install script doesn't respect custom service name #11883

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

Originally created by @WoZ on GitHub (Mar 26, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5711

Describe the problem

Netbird CLI client allows redefining the service name: netbird service install --service netbird-custom.

After execution of this command /etc/systemd/system/netbird-custom.service is created.

But when the package becomes updated post-install script executes the following:

upgrade() {
    printf "\033[32m Post Install of an upgrade\033[0m\n"
    if [ "${use_systemctl}" = "True" ]; then
      printf "\033[32m Stopping the service\033[0m\n"
      systemctl stop netbird 2> /dev/null || true
    fi
    if [ -e /lib/systemd/system/netbird.service ]; then
      rm -f /lib/systemd/system/netbird.service
      systemctl daemon-reload
    fi
    # will trow an error until everyone upgrade
    /usr/bin/netbird service uninstall 2> /dev/null || true
    /usr/bin/netbird service install
    /usr/bin/netbird service start
}

As a result, the service netbird isn't present, and the uninstallation of the custom service doesn't happen. Netbird registers a new fresh /etc/systemd/system/netbird.service and launches it.

As a result, we get 2 running instances and 2 active services.

To Reproduce

Steps to reproduce the behavior:

  1. Make sure you have no netbird installed.
  2. Run sudo apt install netbird=0.66.4
  3. Stop the service after installation with sudo netbird service stop
  4. Uninstall systemd unit: sudo netbird service uninstall
  5. Install systemd unit with the new name: sudo netbird service install --service netbird-custom
  6. Start the service: sudo netbird service start --service netbird-custom
  7. Make sure there is the proper name of the service and only 1 process is running
$ ls -la /etc/systemd/system | grep netbird
-rw-r--r--  1 root root  606 Mar 26 16:26 netbird-custom.service

$ ps aux | grep netbird
root     3869703  2.5  0.7 1276804 57216 ?       Ssl  16:31   0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log
work     3869731  0.0  0.0   6544  2304 pts/3    S+   16:31   0:00 grep --color=auto netbird
  1. Upgrade package: sudo apt install netbird=0.67.1
  2. Check processes and systemd units again:
$ ls -la /etc/systemd/system | grep netbird
-rw-r--r--  1 root root  606 Mar 26 16:31 netbird-custom.service
-rw-r--r--  1 root root  578 Mar 26 16:32 netbird.service

$ ps aux | grep netbird
root     3869919  0.3  0.7 1277212 63104 ?       Ssl  16:32   0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log
root     3869993  0.3  0.7 1277212 62976 ?       Ssl  16:33   0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log

Expected behavior

Netbird must respect the unit name or remove --service flag to disallow systemd unit names redefining.

Are you using NetBird Cloud?

No matter

NetBird version

All versions

Is any other VPN software installed?

No

Debug output

N/A

Screenshots

N/A

Additional context

Add any other context about the problem here.

Originally created by @WoZ on GitHub (Mar 26, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5711 **Describe the problem** Netbird CLI client allows redefining the service name: `netbird service install --service netbird-custom`. After execution of this command `/etc/systemd/system/netbird-custom.service` is created. But when the package becomes updated post-install script executes the following: ``` upgrade() { printf "\033[32m Post Install of an upgrade\033[0m\n" if [ "${use_systemctl}" = "True" ]; then printf "\033[32m Stopping the service\033[0m\n" systemctl stop netbird 2> /dev/null || true fi if [ -e /lib/systemd/system/netbird.service ]; then rm -f /lib/systemd/system/netbird.service systemctl daemon-reload fi # will trow an error until everyone upgrade /usr/bin/netbird service uninstall 2> /dev/null || true /usr/bin/netbird service install /usr/bin/netbird service start } ``` As a result, the service `netbird` isn't present, and the uninstallation of the custom service doesn't happen. Netbird registers a new fresh `/etc/systemd/system/netbird.service` and launches it. As a result, we get 2 running instances and 2 active services. **To Reproduce** Steps to reproduce the behavior: 1. Make sure you have no netbird installed. 2. Run `sudo apt install netbird=0.66.4` 3. Stop the service after installation with `sudo netbird service stop` 4. Uninstall systemd unit: `sudo netbird service uninstall` 5. Install systemd unit with the new name: `sudo netbird service install --service netbird-custom` 6. Start the service: `sudo netbird service start --service netbird-custom` 7. Make sure there is the proper name of the service and only 1 process is running ``` $ ls -la /etc/systemd/system | grep netbird -rw-r--r-- 1 root root 606 Mar 26 16:26 netbird-custom.service $ ps aux | grep netbird root 3869703 2.5 0.7 1276804 57216 ? Ssl 16:31 0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log work 3869731 0.0 0.0 6544 2304 pts/3 S+ 16:31 0:00 grep --color=auto netbird ``` 8. Upgrade package: `sudo apt install netbird=0.67.1` 9. Check processes and systemd units again: ``` $ ls -la /etc/systemd/system | grep netbird -rw-r--r-- 1 root root 606 Mar 26 16:31 netbird-custom.service -rw-r--r-- 1 root root 578 Mar 26 16:32 netbird.service $ ps aux | grep netbird root 3869919 0.3 0.7 1277212 63104 ? Ssl 16:32 0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log root 3869993 0.3 0.7 1277212 62976 ? Ssl 16:33 0:00 /usr/bin/netbird service run --log-level info --daemon-addr unix:///var/run/netbird.sock --log-file /var/log/netbird/client.log ``` **Expected behavior** Netbird must respect the unit name or remove `--service` flag to disallow systemd unit names redefining. **Are you using NetBird Cloud?** No matter **NetBird version** All versions **Is any other VPN software installed?** No **Debug output** N/A **Screenshots** N/A **Additional context** Add any other context about the problem here.
saavagebueno added the triage-needed label 2026-08-05 01:31:28 -04:00
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#11883