Ubuntu 22.04 Wireguard Docker Container Error

How do you install wireguard on a Vim4 running Ubuntu 22.04? Believe I’m running the Oct. 2022 image.

Setup a container using this docker compose:

Error log:

Uname info: Linux a685a99d6237 5.4.180 #1.2 SMP PREEMPT Tue Oct 18 03:45:14 EDT 2022 aarch64 aarch64 aarch64 GNU/Linux
Error: Unknown device type.
**** The wireguard module is not active, will attempt kernel header install and module compilation. If you believe that your kernel should have wireguard support already, make sure that it is activated via modprobe! ****
**** Attempting kernel header install ****
Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [114 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
Reading package lists...
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease is not valid yet (invalid for another 13h 9min 27s). Updates for this repository will not be applied.
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease is not valid yet (invalid for another 13h 9min 7s). Updates for this repository will not be applied.

Hello @NullOrEmpty

It seems that the wireguard module is missing, we will add it in next release.

So, once that’s added, I’ll need to completely re-image the vim4?

No no need, you just need to upgrade the system with sudo apt upgrade once released.

System upgrade doesn’t help:

root@vim4 ~# systemctl status wg-quick@wg0.service
× wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-12-28 22:42:38 +07; 1min 21s ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
    Process: 1095 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=1/FAILURE)
   Main PID: 1095 (code=exited, status=1/FAILURE)
        CPU: 51ms

Dec 28 22:42:38 vim4 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Dec 28 22:42:38 vim4 wg-quick[1095]: [#] ip link add wg0 type wireguard
Dec 28 22:42:38 vim4 wg-quick[1124]: Error: Unknown device type.
Dec 28 22:42:38 vim4 wg-quick[1126]: Unable to access interface: Protocol not supported
Dec 28 22:42:38 vim4 wg-quick[1095]: [#] ip link delete dev wg0
Dec 28 22:42:38 vim4 wg-quick[1134]: Cannot find device "wg0"
Dec 28 22:42:38 vim4 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
Dec 28 22:42:38 vim4 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Dec 28 22:42:38 vim4 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
root@vim4 ~ [3]# apt update
Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Hit:5 https://download.docker.com/linux/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
root@vim4 ~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@vim4 ~# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Any ideas?

We will release new image today or tomorrow, please try again then.

Thank you very much for the information.
What is the recommended way to update:

  1. apt update && apt upgrade
  2. apt dist-upgrade
  3. do-fenix-full-upgrade
    or something different?

Tell me, will there be release notes for the new update?

Please click:

https://docs.khadas.com/products/sbc/common/configurations/upgrade-system

In a little while, you can update :wink:

Please check here:

Something went wrong:

root@vim4 ~ [100]# apt search wireguard
Sorting... Done
Full Text Search... Done
golang-golang.zx2c4-wireguard-dev/jammy,jammy 0.0.20220117-2 all
  Userspace implementation of WireGuard in Go (library)

ifupdown-ng/jammy 0.11.4~rc1-1build1 arm64
  Network Interface Management tool similar to ifupdown{,2}

wireguard/jammy,jammy,now 1.0.20210914-1ubuntu2 all [installed,automatic]
  fast, modern, secure kernel VPN tunnel (metapackage)

wireguard-dkms/jammy,jammy,now 1.0.20210606-1 all [installed]
  fast, modern, secure kernel VPN tunnel (DKMS version)

wireguard-go/jammy 0.0.20220117-2 arm64
  Userspace implementation of WireGuard in Go (program)

wireguard-tools/jammy,now 1.0.20210914-1ubuntu2 arm64 [installed]
  fast, modern, secure kernel VPN tunnel (userland utilities)

root@vim4 ~# systemctl status wg-quick@wg0.service
× wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/wg-quick@.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-12-29 20:50:28 UTC; 6min ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
   Main PID: 1525 (code=exited, status=1/FAILURE)
        CPU: 41ms

Dec 29 20:50:28 vim4 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Dec 29 20:50:28 vim4 wg-quick[1525]: [#] ip link add wg0 type wireguard
Dec 29 20:50:28 vim4 wg-quick[1533]: Error: Unknown device type.
Dec 29 20:50:28 vim4 wg-quick[1535]: Unable to access interface: Protocol not supported
Dec 29 20:50:28 vim4 wg-quick[1525]: [#] ip link delete dev wg0
Dec 29 20:50:28 vim4 wg-quick[1536]: Cannot find device "wg0"
Dec 29 20:50:28 vim4 systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
Dec 29 20:50:28 vim4 systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Dec 29 20:50:28 vim4 systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
root@vim4 ~ [3]# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Is the wireguard module definitely present in the kernel?

Have you upgrade the system? Please provide the result of /etc/fenix-release.

I checked on my side, wireguard load successfully.

$ sudo modprobe wireguard
$ lsmod | grep wireguard
wireguard              73728  0
libchacha20poly1305    16384  1 wireguard
libcurve25519_generic    40960  1 wireguard
libblake2s             16384  1 wireguard

Please remember to load wireguard first.

sudo modprobe wireguard

Here is the result on my side.

khadas@Khadas:~$ ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.31.33  netmask 255.255.254.0  broadcast 192.168.31.255
        inet6 fd08:dc97:9469:41f6:8c31:ef53:8b01:cd5  prefixlen 64  scopeid 0x0<global>
        inet6 fda2:a164:f7fb:4b66:8c31:ef53:8b01:cd5  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::2f09:b4e8:945b:35ed  prefixlen 64  scopeid 0x20<link>
        inet6 fd08:dc97:9469:41f6:fef8:5319:819f:a501  prefixlen 64  scopeid 0x0<global>
        inet6 fda2:a164:f7fb:4b66:ebb:8b56:1154:1e61  prefixlen 64  scopeid 0x0<global>
        ether c8:63:14:72:5f:15  txqueuelen 1000  (Ethernet)
        RX packets 30085  bytes 4697950 (4.6 MB)
        RX errors 0  dropped 137  overruns 0  frame 0
        TX packets 611  bytes 88255 (88.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 56  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 30  bytes 4113 (4.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 4113 (4.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1420
        inet 10.0.0.1  netmask 255.255.255.0  destination 10.0.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 10:2c:6b:10:d5:0a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 12:2c:6b:10:d5:0a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Hi @numbqq I have the same issue running the latest Ubuntu image from Oowow.

cat /etc/*-release:

BOARD=Edge-V
VENDOR=Rockchip
VERSION=1.1.1
ARCH=arm64
INITRD_ARCH=arm64
INSTALL_TYPE=SD-USB
IMAGE_VERSION=1.1.1-220725
################ GIT VERSION ################
UBOOT_GIT_VERSION=f2170bb
LINUX_GIT_VERSION=d652aa2
FENIX_GIT_VERSION=v1.1.1
#############################################
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"

uname -a:

Linux Khadas 5.18.0 #1.1.1 SMP PREEMPT Mon Jul 25 22:27:42 CST 2022 aarch64 aarch64 aarch64 GNU/Linux

Shouldn’t the moduie be already installed?