From 1ac04cec37e81b0b29d9e135ede10848af9be323 Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Thu, 24 Dec 2020 09:16:30 -0500 Subject: [PATCH] Fix - Debian 10 Debian 10 seems to require the kernel module for Wireguard to be reconfigured. There are no headers in the repositories for the kernel that Debian ships with. The fix was to upgrade the kernel, install the header files for the new kernel, reconfigure the dkms module, load the module. --- docs/install.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/docs/install.md b/docs/install.md index 2fe2acc..0a7914a 100644 --- a/docs/install.md +++ b/docs/install.md @@ -3,8 +3,7 @@ These instructions are tested working on:\ :heavy_check_mark: Ubuntu 20.04\ :heavy_check_mark: Ubuntu 18.04\ :x: Ubuntu 16.04 (fails when starting the http server `uvicorn main:app --host=0.0.0.0`)\ -:x: Debian 10\ -  (fails when starting the wg0 interface`[#] ip link add wg0 type wireguard\nRTNETLINK answers: Operation not supported\nUnable to access interface: Protocol not supported\n[#] ip link delete dev wg0\nCannot find device "wg0"\n'`)\ +:heavy_check_mark: Debian 10\ :x: Debian 9   (fails at `pip install -r requirements.txt` error: `Could not find a version that satisfies the requirement fastapi (from -r requirements.txt (line 2)) (from versions: `) @@ -102,10 +101,68 @@ You should now see the following #INFO: Application startup complete. #INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) ``` - -## 6. Default routing not working? +## 6. Troubleshooting tips +### Default routing not working? Try these. PostUp `iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE` PostDown `iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE` + +### Debain 10 wg0 won't start +When you try to start wg0 from the web interface, you may see on your terminal session: +`RNETLINK answers: Operation not supported. Unable to access interface: Protocol not supported` + +This can sometimes be fixed with ```sudo apt upgrade``` + +To fix this, we need to reconfigure the Kernel module. In some cases, the following commands will fix your issue: +``` +dpkg-reconfigure wireguard-dkms +modprobe wireguard +``` + +You may get an error on the first command +``` +Module build for kernel 4.19.0-10-cloud-amd64 was skipped since the +kernel headers for this kernel does not seem to be installed. +``` + +We'll need to install the Kernel headers. + +Find out which Kernel we are already on +``` +uname -r +``` + +Search if your Kernel headers are in the repositories. +``` +apt search linux-headers-$(uname -r) +``` + + If so then install them: + ``` +apt install linux-headers-$(uname -r) + +``` + +If not, we'll need to upgrade your Kernel. My Kernel was 4.19.0.10 so I did a search for 4.19.0 and found 4.19.0.11. This will be a minnor release so nothing to be too worried about. +``` +apt search linux-headers-* +``` + +Install the new Kernel and Reboot +``` +apt install linux-image-4.19.0-11-cloud-amd64 +reboot +``` + +Install the headers for your Kernel +``` +apt install linux-headers-4.19.0-11-cloud-amd64 +``` + +Reconfigure your dkms module and load it. +``` +dpkg-reconfigure wireguard-dkms +modprobe wireguard +```