我今天运行了更新和升级,但无法启动 WireGuard:
$ sudo wg-quick up wg0
[#] ip link add wg0 type wireguard
Error: Unknown device type.
Unable to access interface: Protocol not supported
清除并重新安装 WireGuard 会导致:
Setting up wireguard-dkms (1.0.20200429-2~18.04) ...
Loading new wireguard-1.0.20200429 DKMS files...
Building for 5.3.0-53-generic
Building initial module for 5.3.0-53-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/wireguard-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.3.0-53-generic (x86_64)
Consult /var/lib/dkms/wireguard/1.0.20200429/build/make.log for more information.
Setting up wireguard-tools (1.0.20200513-1~18.04) ...
wg-quick.target is a disabled or a static unit, not starting it.
Setting up wireguard (1.0.20200513-1~18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
ProblemType: Package
DKMSBuildLog:
DKMS make.log for wireguard-1.0.20200429 for kernel 5.3.0-53-generic (x86_64)
Wed May 20 09:54:57 PDT 2020
make: Entering directory '/usr/src/linux-headers-5.3.0-53-generic'
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/main.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/noise.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/device.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/peer.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/timers.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/queueing.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/receive.o
CC [M] /var/lib/dkms/wireguard/1.0.20200429/build/send.o
In file included from <command-line>:0:0:
/var/lib/dkms/wireguard/1.0.20200429/build/compat/compat.h:1024:20: error: redefinition of ‘skb_reset_redirect’
static inline void skb_reset_redirect(struct sk_buff *skb)
^~~~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/wireguard/1.0.20200429/build/compat/compat.h:870:0,
from <command-line>:0:
./include/linux/skbuff.h:4476:20: note: previous definition of ‘skb_reset_redirect’ was here
static inline void skb_reset_redirect(struct sk_buff *skb)
^~~~~~~~~~~~~~~~~~
In file included from <command-line>:0:0:
/var/lib/dkms/wireguard/1.0.20200429/build/compat/compat.h:1024:20: error: redefinition of ‘skb_reset_redirect’
static inline void skb_reset_redirect(struct sk_buff *skb)
最初,我使用 ppa:wireguard/wireguard 安装它 - 现在使用此内核的安装是否不同?
答案1
此后,wireguard-dkms 已更新。版本 1.0.20200506-1~18.04 修复了此问题。现在,它可以与内核 5.3.0-53 一起使用,但它不再适用于 5.3-051 版本...
答案2
我在内核版本 4.4.0-184-generic 中遇到了同样的问题。重新安装 wireguard-dkms 包对我有用:
$ sudo apt-get --reinstall install wireguard-dkms
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
Need to get 0 B/257 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 293587 files and directories currently installed.)
Preparing to unpack .../wireguard-dkms_1.0.20200611-0ppa1~16.04_all.deb ...
------------------------------
Deleting module version: 1.0.20200611
completely from the DKMS tree.
------------------------------
Done.
Unpacking wireguard-dkms (1.0.20200611-0ppa1~16.04) over (1.0.20200611-0ppa1~16.04) ...
Setting up wireguard-dkms (1.0.20200611-0ppa1~16.04) ...
Loading new wireguard-1.0.20200611 DKMS files...
Building only for 4.4.0-184-generic
Building initial module for 4.4.0-184-generic
Done.
wireguard:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.4.0-184-generic/kernel/net/
depmod....
DKMS: install completed.
~ $
答案3
5.3.0-1020-azure 遇到了同样的问题。对于无法升级/降级内核(例如托管的 CI 运行器,如 GitHub Actions)的用户,安装一些旧版本是可行的:
sudo apt install dkms
curl -L -o wireguard-tools.deb https://launchpad.net/~wireguard/+archive/ubuntu/wireguard/+build/19291633/+files/wireguard-tools_1.0.20200510-1~18.04_amd64.deb
curl -L -o wireguard-dkms.deb https://launchpad.net/~wireguard/+archive/ubuntu/wireguard/+build/19258545/+files/wireguard-dkms_1.0.20200429-2~18.04_all.deb
sudo dpkg -i wireguard-tools.deb
sudo dpkg -i wireguard-dkms.deb
sudo modprobe wireguard