masipcat / wireguard-go-docker

Wireguard docker image
https://hub.docker.com/r/masipcat/wireguard-go
GNU General Public License v3.0
195 stars 41 forks source link

cannot find device wg0 | RNETLINK answers: Operation not permitted #19

Open nicedevil007 opened 4 years ago

nicedevil007 commented 4 years ago

heya,

I recently tried to setup your docker container and wasn't able to get it up and running.

Warning: `/etc/wireguard/wg0.conf' is world accessible,
[#] ip link add wg0 type wireguard,
RTNETLINK answers: Operation not permitted,
[!] Missing WireGuard kernel module. Falling back to slow userspace implementation.,
[#] wireguard-go wg0,
WARNING WARNING WARNING WARNING WARNING WARNING WARNING,
W                                                     G,
W   You are running this software on a Linux kernel,  G,
W   which is probably unnecessary and misguided. This G,
W   is because the Linux kernel has built-in first    G,
W   class support for WireGuard, and this support is  G,
W   much more refined than this slower userspace      G,
W   implementation. For more information on           G,
W   installing the kernel module, please visit:       G,
W           https://www.wireguard.com/install         G,
W                                                     G,
WARNING WARNING WARNING WARNING WARNING WARNING WARNING,
INFO: (wg0) 2020/07/29 07:18:00 Starting wireguard-go version 0.0.20200320,
ERROR: (wg0) 2020/07/29 07:18:00 Failed to create TUN device: operation not permitted,
Unable to access interface: Operation not permitted,
[#] ip link delete dev wg0,
Cannot find device "wg0",

my kernel is:

root@DietPi:~# uname -a
Linux DietPi 5.4.51-v7l+ #1328 SMP Mon Jul 27 16:57:05 BST 2020 armv7l GNU/Linux

and the kernel headers are installed.

Then I followed your guide to create the config file and the 2 keys. Placed all 3 of them in a docker volume and created my stack file.

version: '3.7'

volumes:
  config:

services:
  app:
    image: masipcat/wireguard-go:latest
    cap_add:
     - NET_ADMIN
    sysctls:
     - net.ipv4.ip_forward=1
    volumes:
     - /dev/net/tun:/dev/net/tun
     - config:/etc/wireguard
    environment:
     - WG_COLOR_MODE=always
     - LOG_LEVEL=info
    ports:
     - 51820:51820/udp
    # Uncomment the following line when 'AllowedIPs' is '0.0.0.0/0'
    # privileged: true
    restart: always

What is going wrong here?

josh1703658784 commented 3 years ago

Hi @nicedevil007 - did you happen to resolve this issue?