Skip to content
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

Stopped working with Ubuntu 22.04 #62

Open
bmn001 opened this issue Apr 29, 2022 · 18 comments
Open

Stopped working with Ubuntu 22.04 #62

bmn001 opened this issue Apr 29, 2022 · 18 comments

Comments

@bmn001
Copy link

bmn001 commented Apr 29, 2022

This was working great with Ubuntu 21.04. After upgrading to 22.04, not so much.

Attempting to connect will fail instantly.

Syslog shows a bunch of this-

Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5816] device (TestVPN): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'external')
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5820] device (TestVPN): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5825] device (TestVPN): Activation: starting connection 'TestVPN' (ab322800-5c4a-43d4-afc4-ec17f863b26c)
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5826] device (TestVPN): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5827] device (TestVPN): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5829] device (TestVPN): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Apr 29 14:00:18 xps13 NetworkManager[919]: <info>  [1651266018.5835] device (TestVPN): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')

And this

Apr 29 14:00:18 xps13 nm-wireguard-se[26362]: g_variant_new_string: assertion 'g_utf8_validate (string, -1, NULL)' failed
Apr 29 14:00:18 xps13 nm-wireguard-se[26362]: g_variant_builder_add_value: assertion '!GVSB(builder)->expected_type || g_variant_is_of_type (value, GVSB(builder)->expected_type)' failed
Apr 29 14:00:18 xps13 NetworkManager[919]: <warn>  [1651266018.6279] vpn[0x55f4bc24c0a0,9ebb3b96-f86b-4c48-8c45-527e1895a6e8,"TestVPN",if:11,dev:3:(TestVPN)]: config: no VPN gateway address received
Apr 29 14:00:18 xps13 NetworkManager[919]: <warn>  [1651266018.6280] vpn[0x55f4bc24c0a0,9ebb3b96-f86b-4c48-8c45-527e1895a6e8,"TestVPN",if:11,dev:3:(TestVPN)]: did not receive valid IP config information

Other devices are still able to connect (android, ios, etc) just this latest Ubuntu update has me scratching my head.

If it helps, this is NetworkManager is 1.36.4.

@Random-Chain
Copy link

Same issue on Pop!_OS 22.04.
Is this related to #24 ?

@Forage
Copy link

Forage commented May 2, 2022

Looks like a duplicate of #59

@BierDav
Copy link

BierDav commented Jun 19, 2022

Are there any plans to fix this, would be great to be able to use it with the newest network manager. If someone can tell me what the core problem ist, i may be able to create pull request.

@mayhemkrew
Copy link

mayhemkrew commented Sep 8, 2022

Has anybody confirmed that downgrading network manager to a previous version get's this plugin working? If so, what are the commands you used to downgrade the package? Really wish this would of worked during the upgrade and I still wonder why this isn't a feature built into Ubuntu like OVPN is.

@Forage
Copy link

Forage commented Sep 9, 2022

Has anybody confirmed that downgrading network manager to a previous version get's this plugin working? If so, what are the commands you used to downgrade the package? Really wish this would of worked during the upgrade and I still wonder why this isn't a feature built into Ubuntu like OPVN is.

If you had looked at the links this ticket refers to you would have had all your answers.

@foxy6520
Copy link

foxy6520 commented Oct 3, 2022

I am currently experiencing the same issue here, Ubuntu 22.04

@mayhemkrew
Copy link

mayhemkrew commented Oct 3, 2022

I am currently experiencing the same issue here, Ubuntu 22.04

@foxy6520
I ended up getting it working with a clean install of 22.04 and following this guide to install the Wireguard Indicator.

https://github.com/atareao/wireguard-indicator

@Forage
Copy link

Forage commented Oct 3, 2022

I believe proper WireGuard integration into settings and shell is in place for GNOME 43. The wait is for Ubuntu 22.10 in the hope that those parts have not been left out.

@SigmFreud
Copy link

Does anyone know when the code will be updated to support in Gnome 42 and 43?

I believe proper WireGuard integration into settings and shell is in place for GNOME 43. The wait is for Ubuntu 22.10...

Ubuntu 22.10 hasn't WireGuard integration.

@Forage
Copy link

Forage commented Oct 22, 2022

Ubuntu 22.10 hasn't WireGuard integration.

Yes, it does have it partially. The connections show up nicely in the Shell menu. It's only in the settings that you can't alter or add new connections yet. Since you don't do that every day anyway can do it the cli way.

@SigmFreud
Copy link

The connections show up nicely in the Shell menu...

Yes, I'm writing in the terminal:

sudo systemctl start [email protected]
and
sudo systemctl stop [email protected]

In order not to forget about the working client, I use the extension WireGuard-VPN-extension This extension only shows the status. It cannot turn on/off the client. But does this extension WireGuard Indicator can turn on/off the client?

It is not yet available for Gnome 43

@Forage
Copy link

Forage commented Oct 22, 2022

You can start/stop WG connections though the Shell menu by default in Ubuntu 22.10 now, no need for extensions any more.

image

@SigmFreud
Copy link

You can start/stop WG connections though the Shell menu by default in Ubuntu 22.10 now, no need for extensions any more.

How did you set up the connection?

After configuring and installing, I am trying to set up a new VPN connection here:
1

I get an error: "Error: unable to load vpn connection editor"
2

@Forage
Copy link

Forage commented Oct 22, 2022

Like I said, through the cli:
nmcli connection import type wireguard file wg0.conf

@SigmFreud
Copy link

nmcli connection import type wireguard file wg0.conf

I didn't know it was possible! Now it works without a plugin!
Thanks! I wish you a bright mood and the same generous support from others.

@yanzilisan183
Copy link

yanzilisan183 commented Apr 7, 2023

nm-wireguard-service:

#include <glib-unix.h>
+ #include <netdb.h>
#include "utils.h"

...

static gboolean
set_config(NMVpnServicePlugin *plugin, NMConnection *connection)
{
...
-		g_variant_builder_add(&dns_builder, "{ss}", NMV_WG_TAG_DNS, val);
+		g_variant_builder_add(&dns_builder, "{sv}", NMV_WG_TAG_DNS, val);  // Fix g_variant_new_string: assertion 'g_utf8_validate (string, -1, NULL)' failed
...
	setting = get_setting(s_vpn, NM_WG_KEY_ENDPOINT);
	if(setting){
-		// TODO
+		char *p;
+		int q = 0;
+		int l = strlen(setting);
+		for(int i=0; i<l; i++){
+			if(setting[i]==':'){
+				q++;
+			}
+		}
+		if(q>1){
+			// Look like IPv6
+			val = ip6_to_gvariant(setting);
+			if(val){
+				g_variant_builder_add(&builder, "{sv}", NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY, val);
+			}
+		}else{
+			// IPv4 or domain name.
+			p = strstr(setting, ":");
+			if(p){
+				// Delete :port.
+				p[0]='\0'; 
+			}
+			val = ip4_to_gvariant(setting);
+			if(val){
+				// Is IP address. 
+				// NM_VPN_PLUGIN_IP4_CONFIG_GATEWAY == NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY == NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY
+				g_variant_builder_add(&builder, "{sv}", NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY, val);
+			}else{
+				// Is hostname or domain name.
+				struct hostent *host;
+				char buff[17];
+				if ((host = gethostbyname2(setting, AF_INET)) != NULL){
+					inet_ntop(AF_INET, (struct in_addr *)host->h_addr_list[0], buff, sizeof(buff));
+					val = ip4_to_gvariant(buff);
+					if(val){
+						g_variant_builder_add(&builder, "{sv}", NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY, val);
+					}
+				}else if((host = gethostbyname2(setting, AF_INET6)) != NULL){
+					inet_ntop(AF_INET6, (struct in_addr *)host->h_addr_list[0], buff, sizeof(buff));
+					val = ip6_to_gvariant(buff);
+					if(val){
+						g_variant_builder_add(&builder, "{sv}", NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY, val);
+					}
+				}
+			}
+		}
	}
...
}

make
sudo mv /usr/lib/NetworkManager/nm-wireguard-service /usr/lib/NetworkManager/nm-wireguard-service.bak
sudo cp src/nm-wireguard-service /usr/lib/NetworkManager/
问题出在NetworkManager期望得到VPN网关信息,但是nm-wireguard-service并没能提供。上面的代码将向NetworkManager提供VPN网关信息。
水平有限,希望你可以看懂 :)

@sorcer1122
Copy link

@yanzilisan183 can you please elaborate on how to use your code and compile nm-wireguard-service?

EBII added a commit to EBII/network-manager-wireguard that referenced this issue Nov 4, 2023
@don-dolarson
Copy link

@yanzilisan183 sweet. Works great in Debian 12.2 LXQt network-manager 1.42.4-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants