Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspbian: new kernel - wireguard not working #13

Open
codegrau opened this issue Feb 21, 2019 · 17 comments
Open

Raspbian: new kernel - wireguard not working #13

codegrau opened this issue Feb 21, 2019 · 17 comments

Comments

@codegrau
Copy link

Hi there. Raspian updated to new kernel (and kernel headers) but wireguard won't start anymore

raspberrypi-kernel/stable,now 1.20190215-1 armhf [installed]
raspberrypi-kernel-headers/stable,now 1.20190215-1 armhf [installed]
# sudo modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.14.98-v7+
# sudo apt-get install raspberrypi-kernel-headers
Reading package lists... Done
Building dependency tree
Reading state information... Done
raspberrypi-kernel-headers is already the newest version (1.20190215-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@adrianmihalko
Copy link
Owner

Please try to install kernel sources manually and then reinstall Wireguard.

0, Install required packages for rpi-source

sudo apt-get install bc libncurses5-dev

1, Install kernel headers via rpi-source

https://github.com/notro/rpi-source

@codegrau
Copy link
Author

Somehow this is solved now. Thanks!

@dcal068
Copy link

dcal068 commented Feb 28, 2019

Which kernel versions has to be installed? I installed rpi-source, what I have to follow now?

@adrianmihalko
Copy link
Owner

adrianmihalko commented Feb 28, 2019

Normally follow the guide on the main page. If you can't install Wireguard, because of kernel-headers are not found for your current kernel version, install kernel-source for your kernel version with rpi-source.

After that, try to install Wireguard again:

pi@raspberrypi:~ $ echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee --append /etc/apt/sources.list.d/unstable.list
pi@raspberrypi:~ $ sudo apt-get install dirmngr 
pi@raspberrypi:~ $ sudo apt-key adv --keyserver   keyserver.ubuntu.com --recv-keys 8B48AD6246925553 
pi@raspberrypi:~ $ printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --append /etc/apt/preferences.d/limit-unstable
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install wireguard 
pi@raspberrypi:~ $ sudo reboot

(if you typed these commands before, probably you just want to run apt-get install wireguard)

If it still not working (or you have Rpi 1, Zero etc.), compile wireguard from source:

https://github.com/adrianmihalko/raspberrypiwireguard/wiki/Install-WireGuard-on-Raspberry-Pi-1,-2-(not-v1.2),-Zero,-Zero-W

@WebMacke
Copy link

WebMacke commented Apr 3, 2019

I think I have the same kernel version like @codegrau now with 4.14.

I have a new clean setup with raspbian stretch light on a rpi 1.
I encountered the problem with manual compiling

2, Clone WireGuard repository and compile it

pi@raspberrypi:~` $ git clone https://git.zx2c4.com/WireGuard
pi@raspberrypi:~ $ cd WireGuard/src
pi@raspberrypi:~/WireGuard/src $ make

This error occured:

make[1]: *** /lib/modules/4.14.79+/build: file or directory not found. Finish.
Makefile:37: the rule for target module failed
make: *** [module] error 2

I solved it with the hint from @adrianmihalko

Please try to install kernel sources manually and then reinstall Wireguard.

0, Install required packages for rpi-source

sudo apt-get install bc libncurses5-dev

1, Install kernel headers via rpi-source

https://github.com/notro/rpi-source

@mbranchick
Copy link

Im having a similar issue. I ran rpi-source, but Im still getting the following, any ideas?

pi@raspberrypi:~ $ modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.19.36-v7+

pi@raspberrypi:~ $ sudo apt-get install raspberrypi-kernel-headersReading package lists... Done
Building dependency tree
Reading state information... Done
raspberrypi-kernel-headers is already the newest version (1.20190401-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

@budius
Copy link

budius commented May 1, 2019

hi @mbranchick I was having same issues, I was also on 4.19, and core problem was that I used rpi-update, which weirdly udates to untested/unstable versions.

This rouce explains: https://www.raspberrypi.org/documentation/linux/kernel/updating.md
So I reverted back to 4.14 with:

sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

and then with sudo apt-get install raspberrypi-kernel-headers everything matched and the kernel mdule compilation went fine.

@leearmstrong
Copy link

Weirdly I get this too and for some reason following those steps gives me 4.19.42 now.

Unpacking raspberrypi-kernel (1.20190517-1) over (1.20190517-1) ...

Have they updated to 4.19 now!?

@andlil
Copy link

andlil commented Jun 1, 2019

Easiest way to get around the missing module is to remove/reinstall wireguard-dkms

@DenizenB
Copy link

DenizenB commented Aug 9, 2019

Here's a one-liner that fixes this; dpkg-reconfigure wireguard-dkms. Make it a habit to run this after every kernel upgrade and you'll be fine.

@mlauhalu
Copy link

Please try to install kernel sources manually and then reinstall Wireguard.

0, Install required packages for rpi-source

sudo apt-get install bc libncurses5-dev

1, Install kernel headers via rpi-source

https://github.com/notro/rpi-source

I'm receiving error when running sudo modprobe wireguard, and I am assuming that it is due to the kernel issue:

modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.19.93-v7+

I didn't quite understand what is meant by "Install kernel headers via rpi-source". Could somebody elaborate on what the steps are for this?

@Rohlik
Copy link

Rohlik commented May 28, 2020

@frasskungin Here you find installation instructions - https://github.com/notro/rpi-source/wiki

@ns408
Copy link

ns408 commented May 29, 2020

sudo tee -a /etc/rc.local <<EOF
if ! (modprobe wireguard 2> /dev/null); then
  dpkg-reconfigure wireguard-dkms || true
  modprobe wireguard || exit 1
fi
EOF

@Raybo128
Copy link

Raybo128 commented May 30, 2020

Found that removing and reinstalling wireguard-dkms got me working again. The dpkg-reconfigure command did not work for me.

sudo apt remove wireguard-dkms wireguard-tools
sudo reboot
sudo apt install wireguard-dkms wireguard wireguard-tools
sudo reboot

Afterward my wg0 interface returned and wireguard server was back up.

@dallasgroot
Copy link

@Raybo128 Thanks! somehow this worked for me!

@thisaccountname
Copy link

thisaccountname commented Jun 22, 2020

I tried most of the above. Ended up needing to run:

sudo -s
source /usr/src/wireguard-*/dkms.conf
dkms add wireguard/$PACKAGE_VERSION
dkms build wireguard/$PACKAGE_VERSION
dkms install wireguard/$PACKAGE_VERSION
reboot

in my case, I then needed to run the below:

sudo systemctl restart wg-quick@wg0 && pihole restartdns

@mtnnn
Copy link

mtnnn commented Jul 25, 2020

This command fixed it in my case:

apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests