-
-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(wireguard): load Wireguard module if needed #1741
Conversation
qdm12
commented
Jul 10, 2023
- First check if the wireguard family exists
- If not, try loading the wireguard kernel module
- If it succeeds, re-check the wireguard family exists
I just testet it (with multiple reboots) and I can report that it works perfectly. Don't forget to add the following to the Wiki and/or example docker-compose.yml: cap_add:
- SYS_MODULE
volumes:
- /lib/modules:/lib/modules:ro |
Awesome thanks!
I would rather keep the default docker-compose.yml as it is, since the error you see is a bit niche, and newer kernels are likely to have wireguard built-in, or systems configured to load wireguard at boot. Speaking of which, wouldn't it be possible (I guess too late for me haha) to just configure a unit service to modprobe wireguard before launching docker on boot ? That feels maybe a bit more appropriate (and worth mentioning in the wiki) 🤔 Back to the internal module probing, I would like to handle different errors and log info messages depending on the error; what error message is logged (debug level) when:
So I can handle the error and log a more useful info message such as 'bind mount missing', 'sys_module capability missing' in case the module prob fails. |
Yes, in hindsight a service unit to load the module would have been less work. I don't get any different error messages with
|
That's odd, I pushed another commit d1a86a2 adding more debug logs. At the very least, it should log
and then either
Please try again (repull the image) - no need to try all of them if you don't get the debug logs mentioned |
Now there are error messages.
|
- First check if the wireguard family exists - If not, try loading the wireguard kernel module - If it succeeds, re-check the wireguard family exists
d1a86a2
to
e6a10a9
Compare
Thanks! I added custom error messages mentioning the missing bind mount or missing capability depending on the error message obtained; these will be logged at debug level still since there are some systems out there without wireguard at all, and I don't want to spam them with useless information. Our discussion is more or less sumarized here: https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/wireguard.md#load-wireguard-kernel-module It will be up to the user to either use the Gluetun modprobe custom code, or use |