Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Egbert Verhage <egbert@eggiecode.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Anonymous Anonymous <admin@hda.me>,
	WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Advising in packages to load new module or reboot
Date: Wed, 09 Aug 2017 13:16:45 +0200	[thread overview]
Message-ID: <1502277405.1043.2.camel@eggiecode.org> (raw)
In-Reply-To: <20170808231612.GA24254@zx2c4.com>

Hey Jason,

Ow, that it is a common problem.
I think your patch is a nice updated.

So I got some time left and build a patch (pull request) on github
here: https://github.com/EggieCode/wireguard-ppa/pull/24

Let me known what you think.

Greetz,
Egbert

On Wed, 2017-08-09 at 01:16 +0200, Jason A. Donenfeld wrote:
> Hey guys,
> 
> I've noticed that around 60% of emails and IRC messages I get about
> WireGuard issues are due to:
> 
> 1) forgetting to `rmmod wireguard && modprobe wireguard` after
> updating
> 2) installing new kernel headers, removing old kernel headers,
> updating
>    wireguard, and then having the module built for the newer kernel
> and
>    forgetting to reboot
> 3) not having any headers installed
> 
> I don't really know the best generic solution for (3), since
> different
> distros and distro-derivatives (armbian,raspian,archlinuxarm,etc)
> seem
> to express these dependencies in different ways, or not at all. But I
> do
> have an idea to pretty easily address (1) and (2). I've just added
> the
> below to the Gentoo ebuild:
> 
> + if [[ $(uname -r) != "${KV_FULL}" ]]; then
> +         ewarn
> +         ewarn "You have just built WireGuard for kernel ${KV_FULL},
> yet the currently running"
> +         ewarn "kernel is $(uname -r). If you intend to use this
> WireGuard module on the currently"
> +         ewarn "running machine, you will first need to reboot it
> into the kernel ${KV_FULL}, for"
> +         ewarn "which this module was built."
> +         ewarn
> + elif [[ -f /sys/module/wireguard/version ]] && \
> +      old="$(< /sys/module/wireguard/version)" && \
> +      new="$(modinfo -F version
> "${ROOT}/lib/modules/${KV_FULL}/net/wireguard.ko" 2>/dev/null)" && \
> +      [[ $old != "$new" ]]; then
> +         ewarn
> +         ewarn "You appear to have just upgraded WireGuard from
> version v$old to v$new."
> +         ewarn "However, the old version is still running on your
> system. In order to use the"
> +         ewarn "new version, you will need to remove the old module
> and load the new one. As"
> +         ewarn "root, you can accomplish this with the following
> commands:"
> +         ewarn
> +         ewarn "    # rmmod wireguard"
> +         ewarn "    # modprobe wireguard"
> +         ewarn
> +         ewarn "Do note that doing this will remove current
> WireGuard interfaces, so you may want"
> +         ewarn "to gracefully remove them yourself prior."
> +         ewarn
> + fi
> 
> There's a bit of Gentoo-specific stuff in there, but the general idea
> is
> that I first check to see if the module is being built for the
> current
> kernel or a different one, and then I check whether an older module
> is
> loaded than the one just built. It might be slightly trickier to
> accomplish this with DKMS, but I think still it's possible.
> 
> Any thoughts on this pattern?
> 
> Jason

  parent reply	other threads:[~2017-08-09 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 23:16 Jason A. Donenfeld
2017-08-08 23:27 ` Jonathon Fernyhough
2017-08-08 23:30   ` Jason A. Donenfeld
2017-08-08 23:37     ` Bzzzz
2017-08-08 23:46     ` Jonathon Fernyhough
2017-08-09 11:16 ` Egbert Verhage [this message]
2017-08-09 17:05   ` Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502277405.1043.2.camel@eggiecode.org \
    --to=egbert@eggiecode.org \
    --cc=Jason@zx2c4.com \
    --cc=admin@hda.me \
    --cc=dkg@fifthhorseman.net \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).