binhex / arch-delugevpn

Docker build script for Arch Linux base with Deluge, Privoxy and OpenVPN
GNU General Public License v3.0
696 stars 112 forks source link

Wireguard on WSL2 - stderr output: could not detect a useable init system #284

Closed xdka closed 3 years ago

xdka commented 3 years ago

Hello everyone,

I'm currently trying to run this container with WireGuard from a Windows 10 machine (Ubuntu 20.04 WSL2). To give some context, I'm trying to connect to my own VPS but unfortunately I'm totally stuck after the container start. I thought it was related to systemd missing from WSL2 and so I enabled it on my Ubuntu 20.04 instance but it didn't help.

I'm getting the following error : could not detect a useable init system. You can see below both my docker-compose.yml file and the output of the docker logs command.

docker-compose.yml

`version: '3' services: delugevpn: container_name: delugevpn image: binhex/arch-delugevpn:latest restart: unless-stopped privileged: true

            sysctls: 
                    - net.ipv4.conf.all.src_valid_mark=1
            ports:
                    - 0.0.0.0:8112:8112
                    - 58846:58846
                    - 0.0.0.0:8118:8118
            environment:
                    - VPN_ENABLED=yes
                    - VPN_PROV=custom
                    - VPN_CLIENT=wireguard
                    - ENABLE_PRIVOXY=yes
                    - LAN_NETWORK=192.168.0.0/24 
                    - NAME_SERVERS=1.1.1.1,1.0.0.1
                    - DELUGE_DAEMON_LOG_LEVEL=info
                    - DELUGE_WEB_LOG_LEVEL=info
                    - DEBUG=false
                    - UMASK=000
                    - PUID=1000
                    - PGID=1000
                    - TZ=Europe/Paris 
            volumes:
                    - /mnt/c/Users/eskim/docker/arch-delugevpn/data:/data username
                    - /mnt/c/Users/eskim/docker/arch-delugevpn/config:/config
                    - /etc/localtime:/etc/localtime:ro`

docker logs output

2021-08-11 23:50:01,880 DEBG 'start-script' stdout output:
[info] Attempting to bring WireGuard interface 'up'...

2021-08-11 23:50:01,890 DEBG 'start-script' stderr output:
Warning: `/config/wireguard/wg0.conf' is world accessible

2021-08-11 23:50:01,898 DEBG 'start-script' stderr output:
[#] ip link add wg0 type wireguard

2021-08-11 23:50:01,899 DEBG 'start-script' stderr output:
[#] wg setconf wg0 /dev/fd/63

2021-08-11 23:50:01,976 DEBG 'start-script' stderr output:
[#] ip -4 address add 10.7.0.2/24 dev wg0

2021-08-11 23:50:01,980 DEBG 'start-script' stderr output:
[#] ip link set mtu 1420 up dev wg0

2021-08-11 23:50:02,027 DEBG 'start-script' stderr output:
[#] resolvconf -a wg0 -m 0 -x

2021-08-11 23:50:02,033 DEBG 'start-script' stderr output:
could not detect a useable init system

2021-08-11 23:50:02,053 DEBG 'start-script' stderr output:
[#] wg set wg0 fwmark 51820

2021-08-11 23:50:02,054 DEBG 'start-script' stderr output:
[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820

2021-08-11 23:50:02,054 DEBG 'start-script' stderr output:
[#] ip -4 rule add not fwmark 51820 table 51820

2021-08-11 23:50:02,055 DEBG 'start-script' stderr output:
[#] ip -4 rule add table main suppress_prefixlength 0

2021-08-11 23:50:02,057 DEBG 'start-script' stderr output:
[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1

2021-08-11 23:50:02,057 DEBG 'start-script' stderr output:
[#] iptables-restore -n

2021-08-11 23:50:02,267 DEBG 'start-script' stderr output:
iptables-restore v1.8.7 (legacy): unknown option "--save-mark"
Error occurred at line: 5
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

2021-08-11 23:50:02,267 DEBG 'start-script' stderr output:
[#] resolvconf -d wg0 -f

2021-08-11 23:50:02,271 DEBG 'start-script' stderr output:
could not detect a useable init system

2021-08-11 23:50:02,287 DEBG 'start-script' stderr output:
[#] ip -4 rule delete table 51820

2021-08-11 23:50:02,290 DEBG 'start-script' stderr output:
[#] ip -4 rule delete table main suppress_prefixlength 0

2021-08-11 23:50:02,293 DEBG 'start-script' stderr output:
[#] ip link delete dev wg0

2021-08-11 23:50:02,637 DEBG 'start-script' stdout output:
[warn] WireGuard interface failed to come 'up', exit code is '1'

Anyone have already faced this issue and found a fix ?

Thanks you very much !

NNTin commented 2 years ago

How did you manage to resolve your issue?

NNTin commented 2 years ago

I managed to resolve the issue by recompiling the Linux Kernel with CONFIG_NETFILTER_XT_MATCH_CONNMARK flag enabled. I posted a lengthier answer here: https://unix.stackexchange.com/questions/700620/run-wireguard-as-a-client-on-win10-with-wsl2/