[SOLVED] Wireguard in LXC (Debian 10)

PaulePils

Member
Jan 11, 2021
4
1
8
39
Hello,

I am new to the pve world and until now I had no problems or could find a solution somewhere.

After several tutorials and other forum post I still can't get wireguard to work. I try to run it in a LXC with Debian 10. My problem is with the kernel headers. The weird part is that it worked when I started this setup several months ago. I haven't used the vpn in a while but after some months and updates it stopped working when I really needed it...

Output of the host
Code:
uname -a
Linux atwserver 5.4.78-2-pve #1 SMP PVE 5.4.78-2 (Thu, 03 Dec 2020 14:26:17 +0100) x86_64 GNU/Linux
In the LXC
Code:
uname -a
Linux phWG 5.4.78-2-pve #1 SMP PVE 5.4.78-2 (Thu, 03 Dec 2020 14:26:17 +0100) x86_64 GNU/Linux

Host:
Code:
dkms status 
wireguard, 1.0.20201112, 5.4.78-2-pve, x86_64: installed

LXC:
Code:
dkms status 
wireguard, 1.0.20201221, 4.19.0-13-amd64, x86_64: installed
There seems to be a problem with the dkms. Obviously the kernel in the LXC is wrong but i can't change it.

dkms autoinstall shows following output in the LXC
Code:
Error! Your kernel headers for kernel 5.4.78-2-pve cannot be found.
Please install the linux-headers-5.4.78-2-pve package,
or use the --kernelsourcedir option to tell DKMS where it's located

Code:
modprobe wireguard
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/5.4.78-2-pve/modules.dep.bin'
modprobe: FATAL: Module wireguard not found in directory /lib/modules/5.4.78-2-pve

Has anybody an idea how to fix this?

Greetings
 
You need to install the module on the host, not in the lxc. Example: https://nixvsevil.com/posts/wireguard-in-proxmox-lxc/
This did the trick!!! Thank you!

Also, I found the root of my problem:
I wanted the installation of wireguard to be easy so I used the PiVPN script. During re-install I saw that the script configured the wrong kernel in the LXC. With the manual install it worked like a charm.

I will mark this thread as closed.
 
  • Like
Reactions: jack111232
This did the trick!!! Thank you!

Also, I found the root of my problem:
I wanted the installation of wireguard to be easy so I used the PiVPN script. During re-install I saw that the script configured the wrong kernel in the LXC. With the manual install it worked like a charm.

I will mark this thread as closed.
Hello, I have same issue here and the provided link is not working.
Would you mind please post how did you solve your issue?

Thanks!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!