[GH-ISSUE #1779] couldn't access device /dev/net/tun #3314

Open
opened 2026-08-05 00:51:47 -04:00 by saavagebueno · 6 comments
Owner

Originally created by @abdalians on GitHub (Mar 31, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/1779

Unable to bring up client in Kubernetes.

Created a k8s deployment following the instructions [here](https://docs.netbird.io/how-to/routing-peers-and-kubernetes)
pod comes up but the log file stated the errors below. Netbird cloud doesnt show the peer online.

To Reproduce

Steps to reproduce the behavior:

Follow these instructions https://docs.netbird.io/how-to/routing-peers-and-kubernetes

Expected behavior

The container should be able to create the interface and go online.

Are you using NetBird Cloud?

Yes

NetBird version

image: netbirdio/netbird:latest

2024-03-31T15:51:32Z INFO client/internal/config.go:125: generating new config /etc/netbird/config.json
2024-03-31T15:51:37Z ERRO management/client/grpc.go:64: failed creating connection to Management Service context deadline exceeded
2024-03-31T15:51:37Z ERRO client/internal/login.go:96: failed connecting to the Management service https://api.netbird.io:443 context deadline exceeded
2024-03-31T15:51:37Z WARN client/cmd/root.go:204: retrying Login to the Management service in 1.122904759s due to error context deadline exceeded
2024-03-31T15:51:41Z INFO client/internal/login.go:130: peer has been successfully registered on Management Service
2024-03-31T15:51:41Z INFO client/internal/connect.go:96: starting NetBird client version 0.26.0
2024-03-31T15:51:42Z WARN client/internal/wgproxy/factory_linux.go:15: failed to initialize ebpf proxy, fallback to user space proxy: field NbXdpProg: program nb_xdp_prog: map .rodata: map create: read- and write-only maps not supported (requires >= v5.2)
2024-03-31T15:51:42Z INFO iface/module_linux.go:76: couldn't access device /dev/net/tun, go error stat /dev/net/tun: no such file or directory, will attempt to load tun module, if running on container add flag --cap-add=NET_ADMIN
2024-03-31T15:51:42Z ERRO client/internal/engine.go:233: failed creating wireguard interface instance wt0: [couldn't check or load tun module]
2024-03-31T15:51:42Z ERRO client/internal/connect.go:235: error while starting Netbird Connection Engine: couldn't check or load tun module
2024-03-31T15:51:43Z WARN client/internal/wgproxy/factory_linux.go:15: failed to initialize ebpf proxy, fallback to user space proxy: field NbXdpProg: program nb_xdp_prog: map .rodata: map create: read- and write-only maps not supported (requires >= v5.2)
2024-03-31T15:51:43Z INFO iface/module_linux.go:76: couldn't access device /dev/net/tun, go error stat /dev/net/tun: no such file or directory, will attempt to load tun module, if running on container add flag --cap-add=NET_ADMIN
2024-03-31T15:51:43Z ERRO client/internal/engine.go:233: failed creating wireguard interface instance wt0: [couldn't check or load tun module]
2024-03-31T15:51:43Z ERRO client/internal/connect.go:235: error while starting Netbird Connection Engine: couldn't check or load tun module

Additional context

Add any other context about the problem here.

Originally created by @abdalians on GitHub (Mar 31, 2024). Original GitHub issue: https://github.com/netbirdio/netbird/issues/1779 Unable to bring up client in Kubernetes. Created a k8s deployment following the instructions [[here](url)](https://docs.netbird.io/how-to/routing-peers-and-kubernetes) pod comes up but the log file stated the errors below. Netbird cloud doesnt show the peer online. **To Reproduce** Steps to reproduce the behavior: Follow these instructions https://docs.netbird.io/how-to/routing-peers-and-kubernetes **Expected behavior** The container should be able to create the interface and go online. **Are you using NetBird Cloud?** Yes **NetBird version** image: netbirdio/netbird:latest ``` 2024-03-31T15:51:32Z INFO client/internal/config.go:125: generating new config /etc/netbird/config.json 2024-03-31T15:51:37Z ERRO management/client/grpc.go:64: failed creating connection to Management Service context deadline exceeded 2024-03-31T15:51:37Z ERRO client/internal/login.go:96: failed connecting to the Management service https://api.netbird.io:443 context deadline exceeded 2024-03-31T15:51:37Z WARN client/cmd/root.go:204: retrying Login to the Management service in 1.122904759s due to error context deadline exceeded 2024-03-31T15:51:41Z INFO client/internal/login.go:130: peer has been successfully registered on Management Service 2024-03-31T15:51:41Z INFO client/internal/connect.go:96: starting NetBird client version 0.26.0 2024-03-31T15:51:42Z WARN client/internal/wgproxy/factory_linux.go:15: failed to initialize ebpf proxy, fallback to user space proxy: field NbXdpProg: program nb_xdp_prog: map .rodata: map create: read- and write-only maps not supported (requires >= v5.2) 2024-03-31T15:51:42Z INFO iface/module_linux.go:76: couldn't access device /dev/net/tun, go error stat /dev/net/tun: no such file or directory, will attempt to load tun module, if running on container add flag --cap-add=NET_ADMIN 2024-03-31T15:51:42Z ERRO client/internal/engine.go:233: failed creating wireguard interface instance wt0: [couldn't check or load tun module] 2024-03-31T15:51:42Z ERRO client/internal/connect.go:235: error while starting Netbird Connection Engine: couldn't check or load tun module 2024-03-31T15:51:43Z WARN client/internal/wgproxy/factory_linux.go:15: failed to initialize ebpf proxy, fallback to user space proxy: field NbXdpProg: program nb_xdp_prog: map .rodata: map create: read- and write-only maps not supported (requires >= v5.2) 2024-03-31T15:51:43Z INFO iface/module_linux.go:76: couldn't access device /dev/net/tun, go error stat /dev/net/tun: no such file or directory, will attempt to load tun module, if running on container add flag --cap-add=NET_ADMIN 2024-03-31T15:51:43Z ERRO client/internal/engine.go:233: failed creating wireguard interface instance wt0: [couldn't check or load tun module] 2024-03-31T15:51:43Z ERRO client/internal/connect.go:235: error while starting Netbird Connection Engine: couldn't check or load tun module ``` **Additional context** Add any other context about the problem here.
saavagebueno added the clientwaiting-feedbackgetting-startedk8s labels 2026-08-05 00:51:47 -04:00
Author
Owner

@mlsmaycon commented on GitHub (Apr 10, 2024):

Hello @abdalians can you confirm that you've added the following capabilities to the template and that they are enabled in your cluster?


          securityContext:
            capabilities:
              add:
                - NET_ADMIN
                - SYS_RESOURCE
                - SYS_ADMIN
<!-- gh-comment-id:2048418551 --> @mlsmaycon commented on GitHub (Apr 10, 2024): Hello @abdalians can you confirm that you've added the following capabilities to the template and that they are enabled in your cluster? ```yaml securityContext: capabilities: add: - NET_ADMIN - SYS_RESOURCE - SYS_ADMIN ```
Author
Owner

@Yumega commented on GitHub (Jun 22, 2024):

Hello @abdalians can you confirm that you've added the following capabilities to the template and that they are enabled in your cluster?

          securityContext:
            capabilities:
              add:
                - NET_ADMIN
                - SYS_RESOURCE
                - SYS_ADMIN

I add these, the problem still exist, /dev/net/tun does not exist

<!-- gh-comment-id:2183857322 --> @Yumega commented on GitHub (Jun 22, 2024): > Hello @abdalians can you confirm that you've added the following capabilities to the template and that they are enabled in your cluster? > > ```yaml > securityContext: > capabilities: > add: > - NET_ADMIN > - SYS_RESOURCE > - SYS_ADMIN > ``` I add these, the problem still exist, /dev/net/tun does not exist
Author
Owner

@Yumega commented on GitHub (Jun 22, 2024):

docker need --privileged mode

<!-- gh-comment-id:2183866183 --> @Yumega commented on GitHub (Jun 22, 2024): docker need --privileged mode
Author
Owner

@mlsmaycon commented on GitHub (Apr 17, 2025):

@abdalians can you confirm if the issue still happening on the latest version? also, have you tried @Yumega solution?

<!-- gh-comment-id:2813153028 --> @mlsmaycon commented on GitHub (Apr 17, 2025): @abdalians can you confirm if the issue still happening on the latest version? also, have you tried @Yumega solution?
Author
Owner

@houckham commented on GitHub (Jul 3, 2025):

Yumega is correct. You need Docker privileged mode.

In Docker / Docker Compose, the privileged mode can be enabled for a service by setting the privileged option to true within the service's configuration in the docker-compose.yml file.

Running a container in privileged mode grants it elevated capabilities on the host system. This means the container gains access to all Linux kernel capabilities and bypasses many of the security restrictions imposed by default. It allows the container to interact with host devices and resources with nearly the same privileges as the root user on the host.

services:
  my_app:
    image: my_image:latest
    privileged: true
    # other configurations like ports, volumes, etc.
<!-- gh-comment-id:3034241881 --> @houckham commented on GitHub (Jul 3, 2025): Yumega is correct. You need Docker privileged mode. In Docker / Docker Compose, the privileged mode can be enabled for a service by setting the privileged option to true within the service's configuration in the docker-compose.yml file. Running a container in privileged mode grants it elevated capabilities on the host system. This means the container gains access to all Linux kernel capabilities and bypasses many of the security restrictions imposed by default. It allows the container to interact with host devices and resources with nearly the same privileges as the root user on the host. ``` services: my_app: image: my_image:latest privileged: true # other configurations like ports, volumes, etc. ```
Author
Owner

@ben-ba commented on GitHub (Jan 17, 2026):

with privileged you got:

Privileged containers (docker run --privileged) normally pose significant security risks because they provide unrestricted access to the Linux kernel. Without ECI, privileged containers can:

Run as true root with all capabilities
Bypass seccomp and AppArmor restrictions
Access all hardware devices
Modify global kernel settings

see: https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/#secured-privileged-containers

so for me it is enough to run the compose stack with the following:
same as in documentation

      cap_add:
          - NET_ADMIN
          - SYS_ADMIN
          - SYS_RESOURCE

and than to access the virtual NIC, for me only necessary for synology systems

      devices:
          - /dev/net/tun

only drawback atm from the logs, we can set this also, but not in host mode;
see: https://docs.docker.com/reference/compose-file/services/#sysctls
and: https://docs.docker.com/reference/cli/docker/container/run/#sysctl

netbird-agent | 2026-01-17T20:20:27Z ERRO client/internal/routemanager/systemops/systemops_linux.go:124: Error setting up sysctl: 1 error occurred:
netbird-agent | * write sysctl net.ipv4.conf.all.src_valid_mark: open /proc/sys/net/ipv4/conf/all/src_valid_mark: read-only file system

can somebody tell me/us which drawbacks this have, and which drawbacks are expected when we use netbird with a network bridge instead and set the flag?

<!-- gh-comment-id:3764333270 --> @ben-ba commented on GitHub (Jan 17, 2026): with privileged you got: > Privileged containers (docker run --privileged) normally pose significant security risks because they provide unrestricted access to the Linux kernel. Without ECI, privileged containers can: > > Run as true root with all capabilities > Bypass seccomp and AppArmor restrictions > Access all hardware devices > Modify global kernel settings see: https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/#secured-privileged-containers so for me it is enough to run the compose stack with the following: same as in documentation ``` cap_add: - NET_ADMIN - SYS_ADMIN - SYS_RESOURCE ``` and than to access the virtual NIC, for me only necessary for synology systems ``` devices: - /dev/net/tun ``` only drawback atm from the logs, we can set this also, but not in host mode; see: https://docs.docker.com/reference/compose-file/services/#sysctls and: https://docs.docker.com/reference/cli/docker/container/run/#sysctl > netbird-agent | 2026-01-17T20:20:27Z ERRO client/internal/routemanager/systemops/systemops_linux.go:124: Error setting up sysctl: 1 error occurred: > netbird-agent | * write sysctl net.ipv4.conf.all.src_valid_mark: open /proc/sys/net/ipv4/conf/all/src_valid_mark: read-only file system can somebody tell me/us which drawbacks this have, and which drawbacks are expected when we use netbird with a network bridge instead and set the flag?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#3314