wireguard-install icon indicating copy to clipboard operation
wireguard-install copied to clipboard

Upgrade system prior to wg installation

Open x0r2d2 opened this issue 4 years ago • 5 comments

Upgrade system and install kernel headers prior to wireguard installation. On Ubuntu 18.04 without system upgrade, wireguard was unable to start with below error:

ip link add dev wg0 type wireguard
Error: Unknown device type.
modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory 

Make log:
DKMS make.log for wireguard-1.0.20200611 for kernel 4.15.0-101-generic (x86_64)
Thu Aug 27 14:55:47 CST 2020
make: Entering directory '/usr/src/linux-headers-4.15.0-101-generic'
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/main.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/device.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/peer.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/timers.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/queueing.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/send.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/receive.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20200611/build/socket.o
/var/lib/dkms/wireguard/1.0.20200611/build/socket.c: In function 'send6':
/var/lib/dkms/wireguard/1.0.20200611/build/socket.c:139:20: error: 'const struct ipv6_stub' has no member named 'ipv6_dst_lookup_flow'; did you mean $
   dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sock), sock, &fl,
                    ^~~~~~~~~~~~~~~~~~~~
                    ipv6_dst_lookup
scripts/Makefile.build:330: recipe for target '/var/lib/dkms/wireguard/1.0.20200611/build/socket.o' failed
make[1]: *** [/var/lib/dkms/wireguard/1.0.20200611/build/socket.o] Error 1
Makefile:1577: recipe for target '_module_/var/lib/dkms/wireguard/1.0.20200611/build' failed
make: *** [_module_/var/lib/dkms/wireguard/1.0.20200611/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.15.0-101-generic'

x0r2d2 avatar Aug 27 '20 07:08 x0r2d2

After system upgrade, I have reinstalled wireguard

apt-get install --reinstall wireguard-dkms

and after system reboot, wireguard service started successfully.

x0r2d2 avatar Aug 27 '20 07:08 x0r2d2

I added the required packages to CentOS in the past e7d4bee59fb9e5a94b61867fb6ca1daf0f1f7958, but it makes sense to take the other distros in consideration too.

Thanks for reporting @hybtoy. Would you like to open a PR?

randshell avatar Aug 27 '20 13:08 randshell

@randomshell I have already opened a PR. :)

x0r2d2 avatar Aug 27 '20 13:08 x0r2d2

I'm sorry, I lost track of issues and PRs.

Can we limit the upgrade to the kernel and the kernel-headers, possibly kernel-devel too? These are the required dependencies.

When I tested it on Centos, there was a version mismatch between the installed kernel and the latest kernel-headers from the repository https://github.com/angristan/wireguard-install/issues/95#issuecomment-653696198. This means the package linux-headers-$(uname -r) didn't exist. If anyone else can confirm, I think it would be better to replace it with the generic linux-headers package.

It does exist for Debian like distros. It will install linux-header depending on the kernel version of the system.

x0r2d2 avatar Aug 27 '20 14:08 x0r2d2

This is incredibly fucking invasive (apt-get upgrade -y) and I hope this PR is never merged.

LoganDark avatar Apr 01 '22 23:04 LoganDark