From ca5d578416ba562c37388b05a496892e289d4d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=8D=A1=E5=A1=94=E5=85=8B?= <39011904+Goldloli@users.noreply.github.com> Date: Tue, 24 Nov 2026 04:09:26 +0800 Subject: [PATCH] fix(amneziawg): persist the kernel module load across reboots (#7194) x-ui install-awg-kernel loaded the module with modprobe and recorded it nowhere, so after a reboot the panel reported the module as not installed and turned Kernel mode off, although DKMS had rebuilt it. The panel cannot load it itself: x-ui.service sets ProtectKernelModules=yes. The installer now writes /etc/modules-load.d/amneziawg.conf, after the module has loaded, so a module that cannot load leaves no boot entry. Refs #7186 --- scripts/install-amneziawg-kernel.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/install-amneziawg-kernel.sh b/scripts/install-amneziawg-kernel.sh index 30ae7a6ac..a959a16ea 100644 --- a/scripts/install-amneziawg-kernel.sh +++ b/scripts/install-amneziawg-kernel.sh @@ -65,6 +65,12 @@ log "Loading the module" modprobe amneziawg lsmod | grep -q '^amneziawg' || die "module did not load" +# The panel is sandboxed with ProtectKernelModules=yes, so the boot-time load +# has to come from modules-load.d; modprobe alone only lasts until reboot (#7186). +log "Loading the module at boot" +mkdir -p /etc/modules-load.d +printf 'amneziawg\n' > /etc/modules-load.d/amneziawg.conf + log "Building amneziawg-tools" cd "$SRC_DIR/amneziawg-tools/src" make @@ -73,5 +79,6 @@ make install log "Done" printf ' module: %s\n' "$(dkms status -m amneziawg)" printf ' tools: %s\n' "$(awg --version)" +printf ' boot: /etc/modules-load.d/amneziawg.conf\n' printf '\nEnable "Kernel mode" on the AmneziaWG inbound in the panel to use it.\n' printf 'DKMS rebuilds the module on kernel upgrades; Secure Boot hosts must sign it.\n'