WireGuard service wg-quick@wg0 is failed, and diagnosis (falsely?) indicates that port 8095 is not open

My YunoHost server

Hardware: VPS bought online
YunoHost version: 4.3.6.3 (stable)
I have access to my server : Through SSH | through the webadmin |
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Greetings!

I have installed WireGuard on my VPS. I ran diagnosis to see if everything is running okay before attempting to use it. It indicates two issues:

  1. Port 8095 is not reachable from outside. However when I check using ā€˜sudo yunohost firewall listā€™ it lists this port as one of the open ports.

  2. Service wg-quick@wg0 is failed.

I attempted restarting wg as instructed by typing yunohost service restart wg-quick@wg0 . If fails to start. The log states the following:

Jun 19 21:02:54 wg-quick[801]: wg-quick: `/etc/wireguard/wg0.confā€™ does not exist

Upon inspection I see there is no wg0.conf at that location. However, my WireGuard web UI is running without any issues (from what I see). I am able to log in and navigate through its interface.

What should I do to resolve these issues?

  1. Should I ignore the warning about port 8095 not being open? [EDIT : I see that this issue has been reported about a year ago and the advise was that you can safely ignore this : Port 8095 is not reachable from outside. Ā· Issue #32 Ā· YunoHost-Apps/wireguard_ynh Ā· GitHub . Should I assume this is still the case?

  2. Should I create wg0.conf manually to be able to start WireGuard?

Please see below for the complete log:


journalctl: 
  - -- Logs begin at Sun 2022-06-19 21:02:52 CDT, end at Sun 2022-06-19 22:38:18 CDT. --
  - Jun 19 21:02:54 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 19 21:02:54 wg-quick[801]: wg-quick: `/etc/wireguard/wg0.conf' does not exist
  - Jun 19 21:02:54 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 19 21:02:54 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 19 21:02:54 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 19 22:37:59 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 19 22:37:59 wg-quick[3535]: wg-quick: `/etc/wireguard/wg0.conf' does not exist
  - Jun 19 22:37:59 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 19 22:37:59 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 19 22:37:59 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.

Hello, and welcome !

Thank you so much for taking the time to investigate. Indeed you can still ignore that warning.

No, for the file to be generated, you need to tweak the config to your liking, generate clients, and finally click on Apply Config. (cf. the README)

Let me know if you have issues with the service afterwards.

2 Likes

Thank you so much! I am sorry Iā€™ve missed the basic instructions. Will give it a try now and report back soon :slight_smile:

Hello @tituspijean :slight_smile:

I followed the steps. Created the client on my desktop as well.

I still get the yunohost diagnosis saying that :Service wg-quick@wg0 is failed :("

When I try to run yunohost service restart wg-quick@wg0 I get these messages:


journalctl: 
  - -- Logs begin at Mon 2022-06-20 05:03:34 CDT, end at Mon 2022-06-20 19:30:35 CDT. --
  - Jun 20 18:58:44 wg-quick[15675]: [#] ip link delete dev wg0
  - Jun 20 18:58:44 wg-quick[15675]: Cannot find device "wg0"
  - Jun 20 18:58:44 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 18:58:44 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 18:58:44 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 20 18:59:19 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 20 18:59:19 wg-quick[15701]: [#] ip link add wg0 type wireguard
  - Jun 20 18:59:19 wg-quick[15701]: RTNETLINK answers: Operation not supported
  - Jun 20 18:59:19 wg-quick[15701]: Unable to access interface: Protocol not supported
  - Jun 20 18:59:19 wg-quick[15701]: [#] ip link delete dev wg0
  - Jun 20 18:59:19 wg-quick[15701]: Cannot find device "wg0"
  - Jun 20 18:59:19 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 18:59:19 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 18:59:19 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 20 19:26:40 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 20 19:26:41 wg-quick[16280]: [#] ip link add wg0 type wireguard
  - Jun 20 19:26:41 wg-quick[16280]: RTNETLINK answers: Operation not supported
  - Jun 20 19:26:41 wg-quick[16280]: Unable to access interface: Protocol not supported
  - Jun 20 19:26:41 wg-quick[16280]: [#] ip link delete dev wg0
  - Jun 20 19:26:41 wg-quick[16280]: Cannot find device "wg0"
  - Jun 20 19:26:41 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 19:26:41 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 19:26:41 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 20 19:28:07 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 20 19:28:07 wg-quick[16564]: [#] ip link add wg0 type wireguard
  - Jun 20 19:28:07 wg-quick[16564]: RTNETLINK answers: Operation not supported
  - Jun 20 19:28:07 wg-quick[16564]: Unable to access interface: Protocol not supported
  - Jun 20 19:28:07 wg-quick[16564]: [#] ip link delete dev wg0
  - Jun 20 19:28:07 wg-quick[16564]: Cannot find device "wg0"
  - Jun 20 19:28:07 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 19:28:07 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 19:28:07 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 20 19:28:34 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 20 19:28:34 wg-quick[16614]: [#] ip link add wg0 type wireguard
  - Jun 20 19:28:34 wg-quick[16614]: RTNETLINK answers: Operation not supported
  - Jun 20 19:28:34 wg-quick[16614]: Unable to access interface: Protocol not supported
  - Jun 20 19:28:34 wg-quick[16614]: [#] ip link delete dev wg0
  - Jun 20 19:28:34 wg-quick[16614]: Cannot find device "wg0"
  - Jun 20 19:28:34 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 19:28:34 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 19:28:34 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
  - Jun 20 19:30:24 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
  - Jun 20 19:30:24 wg-quick[16654]: [#] ip link add wg0 type wireguard
  - Jun 20 19:30:24 wg-quick[16654]: RTNETLINK answers: Operation not supported
  - Jun 20 19:30:24 wg-quick[16654]: Unable to access interface: Protocol not supported
  - Jun 20 19:30:24 wg-quick[16654]: [#] ip link delete dev wg0
  - Jun 20 19:30:24 wg-quick[16654]: Cannot find device "wg0"
  - Jun 20 19:30:24 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
  - Jun 20 19:30:24 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
  - Jun 20 19:30:24 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.

Try rebooting the server. It may be needed to enable WireGuard in the kernel.

1 Like

I rebooted the server. I still get errors. Is this because I have misconfigured something on the server?:

Could not start the service 'wg-quick@wg0'
Recent service logs:-- Logs begin at Mon 2022-06-20 23:59:38 CDT, end at Tue 2022-06-21 00:02:58 CDT. -- Jun 20 23:59:40 systemd[1]: Starting WireGuard via wg-quick(8) for wg0... Jun 20 23:59:40 wg-quick[588]: [#] ip link add wg0 type wireguard Jun 20 23:59:40 wg-quick[588]: RTNETLINK answers: Operation not supported Jun 20 23:59:40 wg-quick[588]: Unable to access interface: Protocol not supported Jun 20 23:59:40 wg-quick[588]: [#] ip link delete dev wg0 Jun 20 23:59:40 wg-quick[588]: Cannot find device "wg0" Jun 20 23:59:40 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE Jun 20 23:59:40 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'. Jun 20 23:59:40 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0. Jun 21 00:02:58 systemd[1]: Starting WireGuard via wg-quick(8) for wg0... Jun 21 00:02:58 wg-quick[2027]: [#] ip link add wg0 type wireguard Jun 21 00:02:58 wg-quick[2027]: RTNETLINK answers: Operation not supported Jun 21 00:02:58 wg-quick[2027]: Unable to access interface: Protocol not supported Jun 21 00:02:58 wg-quick[2027]: [#] ip link delete dev wg0 Jun 21 00:02:58 wg-quick[2027]: Cannot find device "wg0" Jun 21 00:02:58 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE Jun 21 00:02:58 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'. Jun 21 00:02:58 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.

**While processing the action the server said:**

Could not execute the command 'systemctl start wg-quick@wg0'

Can you type sudo dkms status in the command line and report its output?

1 Like

Sure, the output is:

wireguard, 1.0.20210219, 4.19.0-20-amd64, x86_64: installed

The automatic diagnosis alerted me today that ā€œThe system has 199 MiB (20%) RAM available (out of 986 MiB). Be carefulā€. The only change Iā€™ve made to the server recently was installing WireGuard. So I uninstalled it for the time being, and rebooted the server.

Memory consumption has returned to normal (reasonable?) levels. I donā€™t have prior experience with WireGuard. So I donā€™t know if it consumes that much of memory.

I am aborting my attempt to run WireGuard for the time being. I will get back to it at a later point. Thanks very much @tituspijean for looking into it this far.

It should indeed not consume that much memory. My guess it was another service, but who knows. If that happens again, use the command sudo htop to see whatā€™s consuming resources on your system. (sudo apt install htop if it complains about missing the command).

1 Like

Many thanks! This is really helpful. I will get back to it and investigate soon.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.