linuxserver / docker-wireguard

GNU General Public License v3.0
2.9k stars 359 forks source link

[BUG] Wireguard module is already active #288

Closed hiduser0 closed 1 year ago

hiduser0 commented 1 year ago

Is there an existing issue for this?

Current Behavior

If I want the wireguard Docker Container to start with docker compose up I'll got this log: wireguard | It seems the wireguard module is already active. Skipping kernel header install and module compilation. wireguard-ui | [#] ip link set mtu 1420 up dev wg0 wireguard-ui | Wireguard UI wireguard-ui | App Version : dev wireguard-ui | Git Commit : 6bbe230 wireguard-ui | Git Ref : N/A wireguard-ui | Build Time : 07-29-2023 14:35:37 wireguard-ui | Git Repo : https://github.com/ngoduykhanh/wireguard-ui wireguard-ui | Authentication : true wireguard-ui | Bind address : 0.0.0.0:5000 wireguard-ui | Email from : wireguard-ui | Email from name : WireGuard UI wireguard-ui | Custom wg.conf : wireguard-ui | Base path : / wireguard-ui | ⇨ http server started on [::]:5000 wireguard | Client mode selected. wireguard | [custom-init] No custom files found, skipping... wireguard | Disabling CoreDNS wireguard | Warning: /config/wg0.conf' is world accessible wireguard | wg-quick:wg0' already exists wireguard | s6-rc: warning: unable to start service svc-wireguard: command exited 1

Expected Behavior

The Wireguard Container starts

Steps To Reproduce

  1. I delete the Image from my server and download it again.
  2. I restart my server with a hard reset

Environment

- OS:Debian 11
- How docker service was installed:

CPU architecture

x86-64

Docker creation

docker pull ngoduykhanh/wireguard-ui:latest

Container logs

/opt/wireguard# docker compose up
[+] Running 2/0
 ✔ Container wireguard     Created                                                                                                                                             0.0s 
 ✔ Container wireguard-ui  Created                                                                                                                                             0.0s 
Attaching to wireguard, wireguard-ui
wireguard     | [migrations] started
wireguard     | [migrations] no migrations found
wireguard-ui  | Warning: `/etc/wireguard/wg0.conf' is world accessible
wireguard     | usermod: no changes
wireguard     | ───────────────────────────────────────
wireguard     | 
wireguard     |       ██╗     ███████╗██╗ ██████╗ 
wireguard     |       ██║     ██╔════╝██║██╔═══██╗
wireguard     |       ██║     ███████╗██║██║   ██║
wireguard     |       ██║     ╚════██║██║██║   ██║
wireguard     |       ███████╗███████║██║╚██████╔╝
wireguard     |       ╚══════╝╚══════╝╚═╝ ╚═════╝ 
wireguard     | 
wireguard     |    Brought to you by linuxserver.io
wireguard     | ───────────────────────────────────────
wireguard     | 
wireguard     | 
wireguard     | To support the app dev(s) visit:
wireguard     | 
wireguard     | WireGuard: https://www.wireguard.com/donations/
wireguard     | 
wireguard     | To support LSIO projects visit:
wireguard     | https://www.linuxserver.io/donate/
wireguard     | 
wireguard     | ───────────────────────────────────────
wireguard     | GID/UID
wireguard     | ───────────────────────────────────────
wireguard     | 
wireguard     | 
wireguard     | User UID:    911
wireguard     | User GID:    911
wireguard     | ───────────────────────────────────────
wireguard     | 
wireguard     | 
wireguard-ui  | [#] ip link add wg0 type wireguard
wireguard     | Uname info: Linux 670e4e78c4ec 5.10.0-23-amd64 #1 SMP Debian 5.10.179-2 (2023-07-14) x86_64 GNU/Linux
wireguard-ui  | [#] wg setconf wg0 /dev/fd/63
wireguard     | **** It seems the wireguard module is already active. Skipping kernel header install and module compilation. ****
wireguard-ui  | [#] ip link set mtu 1420 up dev wg0
wireguard-ui  | Wireguard UI
wireguard-ui  | App Version : dev
wireguard-ui  | Git Commit  : 6bbe230
wireguard-ui  | Git Ref     : N/A
wireguard-ui  | Build Time  : 07-29-2023 14:35:37
wireguard-ui  | Git Repo    : https://github.com/ngoduykhanh/wireguard-ui
wireguard-ui  | Authentication  : true
wireguard-ui  | Bind address    : 0.0.0.0:5000
wireguard-ui  | Email from  : 
wireguard-ui  | Email from name : WireGuard UI
wireguard-ui  | Custom wg.conf  : 
wireguard-ui  | Base path   : /
wireguard-ui  | ⇨ http server started on [::]:5000
wireguard     | **** Client mode selected. ****
wireguard     | [custom-init] No custom files found, skipping...
wireguard     | **** Disabling CoreDNS ****
wireguard     | Warning: `/config/wg0.conf' is world accessible
wireguard     | wg-quick: `wg0' already exists
wireguard     | s6-rc: warning: unable to start service svc-wireguard: command exited 1
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

github-actions[bot] commented 1 year ago

A human has marked this issue as invalid, this likely happened because the issue template was not used in the creation of the issue.

thespad commented 1 year ago

Does it work without attaching some random 3rd party container to the network?

hiduser0 commented 1 year ago

No it doesn’t work

thespad commented 1 year ago

Can you provide some logs or other evidence of the container not working on its own?

hiduser0 commented 1 year ago

What are you mean? If I look at the interfaces where is no wg0. What are you need?

aptalca commented 1 year ago

We have no idea what you're referring to by that statement/question because you haven't properly filled out the issue template.

Remove the other ui container. Post a compose yaml and a full log of the wireguard container, along with the contents of the wg0.conf

hiduser0 commented 1 year ago

docker compose.yaml: version: "3"

services:

WireGuard VPN service

wireguard: image: linuxserver/wireguard:latest container_name: wireguard cap_add:

cat config/wg0.conf

This file was generated using wireguard-ui (https://github.com/ngoduykhanh/wireguard-ui)

Please don't modify it manually, otherwise your change might get replaced.

Address updated at: 2023-07-29 15:14:32.413786638 +0000 UTC

Private Key updated at: 2023-07-29 14:15:17.988462597 +0000 UTC

[Interface] Address = 10.252.1.0/24 ListenPort = 51820 PrivateKey = qFDfxBOprivateFQ7LQwy94p/lzxyckeroiw0= MTU = 1450 PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE Table = auto

ID: cj2i17jikc9c70irr140

Name: maximilian

Email: max@domain.tld

Created at: 2023-07-29 14:22:22.12816805 +0000 UTC

Update at: 2023-07-29 14:22:22.12816805 +0000 UTC

[Peer] PublicKey = q80Z0SkowEsHc9pADT20m+9NPKGYoXvcNv8LR+cNczI= PresharedKey = mFaipDZJxn8zEhHhLtAD6AF4qMFl9fDiRUQC0HXjcZQ= AllowedIPs = 10.252.1.1/32

j0nnymoe commented 1 year ago

Our wireguard container is not designed nor tested to work with third party containers.

hiduser0 commented 1 year ago

I stopped the other containers

Tarow commented 1 year ago

Had the same error. Turns out the environment variable WGUI_MANAGE_START=true in the wireguard-ui container was the problem for me. Setting this to false prevents the ui container from starting wireguard, and the Linuxserver container comes up just fine then.

j0nnymoe commented 1 year ago

If this is discussion about a third party webui container, it's outside of what we support. If users are doing this, they need to contact that project for support.