I recently (Twitter) ordered and received a Pinebook Pro and wanted to share how I got Wireguard working. Wireguard is a VPN that uses modern cryptography while still being easy to configure for various environments. Unfortunately, even though the kernel module has been merged upstream Manjaro Linux still requires a custom module to be built. Because the kernel sources aren’t included with the distribution as of now, installing the wireguard-dkms package will fail. This post shows how I got the userspace wireguard-go program to work in lieu of the kernel module.
Before I continue, if you’re using the default Debian install that came with the device, you should be able to follow this tutorial which uses Cloudflare’s boringtun Rust implementation. I couldn’t get this tutorial to work so here is an alternative that uses the official Wireguard Go language reference implementation.
Installing the compiler
The Go compiler should be available in all distributions so install it before continuing. On Manjaro Linux you can do so by typing `sudo pamac install go`.
Cloning the repository
You’ll need to clone to source code from the Wireguard repo: `git clone https://git.zx2c4.com/wireguard-go`.
Building the tool
Once cloning has completed, enter the directory and issue `make`. After it completes, you should have ./wireguard-go executable in the same directory.
Launching the tool
Open two terminal windows. In the first, issue
sudo LOG_LEVEL=debug ./wireguard-go -f wg0. This will launch the userspace implementation and create an interface called wg0 which you can see by typing `ip a`.
Configuring and bringing up the Wireguard interface
Bringing up the interface is almost as simple as presented in the docs but because we’re running Manjaro Linux we’ll need to make sure it works well with NetworkManager. The first step is mark the interface along with any similarly named interfaces as unmanaged. Create the following file and restart NetworkManager.
/etc/NetworkManager/conf.d/wireguard-unmanaged.conf [keyfile] unmanaged-devices=interface-name:wg* # systemctl restart NetworkManager
In a new terminal window, issue the following commands, taking into account your configuration. Before continuing you’ll also need to have a valid /etc/wireguard/wg0.conf that uses `wg` syntax not wg-quick syntax. Check the manpage for wg to confirm. Note that CLIENT_IP_ADDRESS and PEER_IP_ADDRESS_OR_RANGE refers to the address Wireguard interface address space.
# ip address add dev wg0 CLIENT_IP_ADDRESS peer PEER_IP_ADDRESS_OR_RANGE # wg setconf wg0 /etc/wireguard/wg0.conf # ip link set mtu 1420 up dev wg0 # ip route add PEER_IP_ADDRESS_OR_RANGE dev wg0
Finally, as per Thaller’s post on the GNOME blogs, if you don’t issue the last command we’ll need to let NetworkManager know about the new route. List your current connections with
nmcli conn show and copy the UUID for your current connection below. Replace GATEWAY and WIREGUARD_ENDPOINT with the actual IP addressses.
nmcli connection modify UUID +ipv4.routes "WIREGUARD_ENDPOINT/32 GATEWAY"
This should be sufficient to set up the VPN. You’ll see the handshake initiated and completed in the other terminal window.
Let me know if this worked for you. DNS resolution is still problematic because NetworkManager doesn’t adjust resolvconf to accomodate the new route. If you manage to get that working correctly, please let me know on Twitter.