Public bug reported:

When running wg-quick, I always get the below with my wireless LAN and
sometimes with my wired LAN:

[#] ip link add dev tun0 type wireguard
[#] wg setconf tun0 /dev/fd/63
[#] ip -4 address add 10.66.218.109/32 dev tun0
[#] ip -6 address add fc00:bbbb:bbbb:bb01::3:da6c/128 dev tun0
[#] ip link set mtu 1420 up dev tun0
[#] resolvconf -a tun0 -m 0 -x
[#] wg set tun0 fwmark 51820
[#] ip -6 rule add not fwmark 51820 table 51820
[#] ip -6 rule add table main suppress_prefixlength 0
[#] ip -6 route add ::/0 dev tun0 table 51820
Error: Nexthop device is not up.
[#] resolvconf -d tun0 -f
[#] ip -6 rule delete table 51820
[#] ip -6 rule delete table main suppress_prefixlength 0
[#] ip link delete dev tun0

This sometimes affects ipv4 and sometimes ipv6. The result is always
that the interface is deleted.

Fix: There is a simple fix and it is to introduce a small delay before
addition of route in the /usr/bin/wg-quick:

add_route() {
        local proto=-4
        [[ $1 == *:* ]] && proto=-6
        [[ $TABLE != off ]] || return 0
    
    sleep 1 # add this
    
        if [[ -n $TABLE && $TABLE != auto ]]; then
                cmd ip $proto route add "$1" dev "$INTERFACE" table "$TABLE"
        elif [[ $1 == */0 ]]; then
                add_default "$1"
        else
                [[ -n $(ip $proto route show dev "$INTERFACE" match "$1" 
2>/dev/null) ]] || cmd ip $proto route add "$1" dev "$INTERFACE"
        fi
}


Or as a patch:

#!/bin/bash

test -f /usr/bin/wg-quick.orig || patch -b /usr/bin/wg-quick <<'EOF'
171c171,173
< 
---
>     
>     sleep 1
>     
EOF


$ lsb_release -rd
Description:    Ubuntu 26.04 LTS
Release:        26.04
$ apt-cache policy wireguard
wireguard:
  Installed: 1.0.20250521-1ubuntu1
  Candidate: 1.0.20250521-1ubuntu1
  Version table:
 *** 1.0.20250521-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages
        100 /var/lib/dpkg/status

** Affects: wireguard (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160644

Title:
  wg-quick: Error: Nexthop device is not up.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wireguard/+bug/2160644/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to