Has anybody tried to install Wireguard?

I would like to get it to work, but if it is not possible i will just stick to openvpn…

I don’t know if it’s been merged in to the Linux kernel yet.

Sam

I’ve not yet installed it on any system, given that it’s still experimental but a quick check shows that there’s a package in Debian sid (that’s out of date).

According to its Web page, if compiling from source WireGuard requires Linux ≥3.10, with the following configuration options:

  • CONFIG_NET for basic networking support
  • CONFIG_INET for basic IP support
  • CONFIG_NET_UDP_TUNNEL for sending and receiving UDP packets
  • CONFIG_CRYPTO_BLKCIPHER for doing scatter-gather I/O

all of which are enabled, but to build an out-of-tree module probably requires CONFIG_UNUSED_SYMBOLS, which isn’t currently enabled.

We build and distribute out of tree modules (in the form of WiFi drivers) to unused symbols are not stripped. We know that’s caused problems in other distributions :wink:

It probably needs mainling before it’s adapted by userland tools.

Sam

any progress on this ?

Not at this time, no. I think with the next Debian release everything will be there for this to work trivially.

Sam

I was trying to install Wireguard following the instructions here

It can’t compile the kernel module because, I think because I’m having problems with the kernel headers. I’ve installed them but now I can’t see any of the header files. This is for kernel 4.14.78-4-osmc.

Building initial module for 4.14.78-4-osmc
Error! Bad return status for module build on kernel: 4.14.78-4-osmc (armv7l)
Consult /var/lib/dkms/wireguard/0.0.20181218/build/make.log for more information.

Basically it can’t find the headers. I see other messages indicating that there’s a conflict with dkms. The dkms package is a dependency of Wireguard. But I wonder if that’s really the issue here.

OSMC is structured a little differently from Raspbian. For example, the headers package for the Pi2/3 is named rbp2-headers-$(uname -r).

Second, the header file location is different, so you’ll need to add a link from the location expected by DKMS, eg:

sudo ln -s /usr/src/rbp2-headers-$(uname -r) /lib/modules/$(uname -r)/build

Thanks. I had installed the correct headers package. I added the symlink you suggested but it didn’t help. It’s complaining about sys/socket.h being missing. I found the location of such a file using gcc -xc -E -v - and the relevant directory (/usr/include/arm-linux-gnueabihf) is listed.

In any case, I tried linking the directories under the directory above to /usr/include but it didn’t help. Here’s the make.log file:

DKMS make.log for wireguard-0.0.20181218 for kernel 4.14.78-4-osmc (armv7l)
Sun  6 Jan 16:45:50 UTC 2019
make: Entering directory '/usr/src/rbp2-headers-4.14.78-4-osmc'
  AR      /var/lib/dkms/wireguard/0.0.20181218/build/built-in.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20181218/build/main.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20181218/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20181218/build/device.o
  CC [M]  /var/lib/dkms/wireguard/0.0.20181218/build/peer.o
In file included from ./include/linux/netfilter.h:8:0,
                 from ./include/linux/netfilter/nf_conntrack_tuple_common.h:6,
                 from ./include/linux/netfilter/nf_conntrack_dccp.h:29,
                 from ./include/net/netns/conntrack.h:11,
                 from ./include/net/net_namespace.h:27,
                 from ./include/net/genetlink.h:7,
                 from /var/lib/dkms/wireguard/0.0.20181218/build/compat/compat.h:654,
                 from <command-line>:0:
./include/linux/if.h:28:54: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
                                                      ^
In file included from ./include/linux/netfilter.h:8:0,
                 from ./include/linux/netfilter/nf_conntrack_tuple_common.h:6,
                 from ./include/linux/netfilter/nf_conntrack_dccp.h:29,
                 from ./include/net/netns/conntrack.h:11,
                 from ./include/net/net_namespace.h:27,
                 from ./include/net/genetlink.h:7,
                 from /var/lib/dkms/wireguard/0.0.20181218/build/compat/compat.h:654,
                 from <command-line>:0:
./include/linux/if.h:28:54: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
                                                      ^
compilation terminated.
compilation terminated.
scripts/Makefile.build:328: recipe for target '/var/lib/dkms/wireguard/0.0.20181218/build/noise.o' failed
make[1]: *** [/var/lib/dkms/wireguard/0.0.20181218/build/noise.o] Error 1
make[1]: *** Waiting for unfinished jobs....
scripts/Makefile.build:328: recipe for target '/var/lib/dkms/wireguard/0.0.20181218/build/main.o' failed
make[1]: *** [/var/lib/dkms/wireguard/0.0.20181218/build/main.o] Error 1
In file included from ./include/linux/netfilter.h:8:0,
                 from ./include/linux/netfilter/nf_conntrack_tuple_common.h:6,
                 from ./include/linux/netfilter/nf_conntrack_dccp.h:29,
                 from ./include/net/netns/conntrack.h:11,
                 from ./include/net/net_namespace.h:27,
                 from ./include/net/genetlink.h:7,
                 from /var/lib/dkms/wireguard/0.0.20181218/build/compat/compat.h:654,
                 from <command-line>:0:
./include/linux/if.h:28:54: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
                                                      ^
compilation terminated.
scripts/Makefile.build:328: recipe for target '/var/lib/dkms/wireguard/0.0.20181218/build/device.o' failed
make[1]: *** [/var/lib/dkms/wireguard/0.0.20181218/build/device.o] Error 1
In file included from ./include/linux/netfilter.h:8:0,
                 from ./include/linux/netfilter/nf_conntrack_tuple_common.h:6,
                 from ./include/linux/netfilter/nf_conntrack_dccp.h:29,
                 from ./include/net/netns/conntrack.h:11,
                 from ./include/net/net_namespace.h:27,
                 from ./include/net/genetlink.h:7,
                 from /var/lib/dkms/wireguard/0.0.20181218/build/compat/compat.h:654,
                 from <command-line>:0:
./include/linux/if.h:28:54: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
                                                      ^
compilation terminated.
scripts/Makefile.build:328: recipe for target '/var/lib/dkms/wireguard/0.0.20181218/build/peer.o' failed
make[1]: *** [/var/lib/dkms/wireguard/0.0.20181218/build/peer.o] Error 1
Makefile:1527: recipe for target '_module_/var/lib/dkms/wireguard/0.0.20181218/build' failed
make: *** [_module_/var/lib/dkms/wireguard/0.0.20181218/build] Error 2
make: Leaving directory '/usr/src/rbp2-headers-4.14.78-4-osmc'

Any thoughts?

Are you using the OSMC build environment? AFAIK, this probably won’t work with DKMS, so auto-builds of modules aren’t going to be possible. Sam will be better able to advise.

I have been trying to build this directly on the latest OSMC release (after update and dist-upgrade). I’m prepared to have a go at a build environment, although I’m not sure how this is going to help me since Wireguard seems to want to build a kernel module specific to the target environment. So I might leave this for now (unless Sam jumps in.

Thanks again for your help.

I don’t know if Wireguard works with DKMS.
It still seems quite fresh; so I’d be surprised if there are yet significant efforts to support backports

Hi Sam, The wireguard package depends on wireguard-dkms which in turn depends on dkms itself. The wireguard package looks like it’s just the dependencies and changelog. The code for the kernel module is in wireguard-dkms.

I’m running wireguard on an Ubuntu 14.04 server at home, although that’s through the PPA, and I don’t remember whether it compiled a kernel module or just installed something pre-compiled.

If I create a build environment, does that mean I can try to create a deb and upload it somewhere?

You already have a build environment now.
A Deb would be to package a finished module; which you don’t have yet.

Try run find to see if you do have sys/socket.h
I seem to remember perpetual header problems for ARM architecture with make-kpkg but make deb-pkg still isn’t suitable yet.

Sam

Yeah there is one sys/socket.h as follows:

$ find / -name socket.h | grep sys/socket.h
/usr/include/arm-linux-gnueabihf/sys/socket.h

There are other directories of header files there. So I created symlinks to /usr/include but it didn’t help.

I ran a make -n in the module build directory and I can see that -nostdinc is in the compiler options. There’s only one directory it puts on its search path using -isystem and then adds a bunch of relative dirs using -I:

 -nostdinc
 -isystem /usr/lib/gcc/arm-linux-gnueabihf/6/include
 -I./arch/arm/include
 -I./arch/arm/include/generated
 -I./include
 -I./arch/arm/include/uapi
 -I./arch/arm/include/generated/uapi
 -I./include/uapi
 -I./include/generated/uapi

I was thinking that there’s something to this, however I compared this to a working Raspbian build of Wireguard I have, and it’s the exact same compiler options. The sys/socket.h header file is in the same place too.

So now I’m at a loss.

Maybe make is wrapped / layered.
Try export your CFLAGS

The error you’re seeing is very similar to the one in this post: Mantistek WA150 - #7 by skdauser, which I can reproduce.

The Mantistek WA150 code does not produce the error on Raspbian Jessie or Debian stretch (amd64) (I’ll look at Raspbian stretch when I have a bit more time).

So far, it looks like there might be a problem with the OSMC headers package.

Update: The problem does not occur with Raspbian stretch.

I worked out that the include directories are relative to the directory in which make is running (duh!). So on my Raspbian, that’s /lib/modules/4.14.79-v7+/build.

In my Raspbian build environment, I traced the sequence of includes from the error in the make.log and there’s a difference. The difference is that in Raspbian nf_conntrack_tuple_common.h comes from ./include/uapi/linux/netfilter/nf_conntrack_tuple_common.h instead of ./include/linux/netfilter/nf_conntrack_tuple_common.h as shown in the error message from the OSMC build environment.

When Raspbian gets to ./include/linux/netfilter.h it then includes ./include/uapi/linux/if.h instead of OSMC’s ./include/linux/if.h. The Raspbian file ./include/uapi/linux/if.h includes <linux/socket.h> rather than <sys/socket.h>.

A quick google tells me that the uapi directory is for the user-space API headers. Is this useful information?

Edited 2019-01-10: Made it clearer which is Raspbian vs OSMC.

1 Like

I had a look at the osmc build script on github but I’m not that familiar with kernel build processes. Is the problem somehow related to the code that disassembles the kernel headers package here?

Shouldn’t be.
IIRC, make-kpkg doesn’t handle UAPI for arm in the same way it does for other platforms.