# NetworkManager fails to connect to wifi with user account

## petr2008

With user "me" I am getting error instead of dialog asking for wifi device password (as a root it works):

Failed to add/activate connection

(1) Failed to get request UID

tail .xsession-errors

```
(nm-applet:8202): nm-applet-WARNING **: 13:07:34.004: Failed to add/activate connection: (1) Failed to get request UID.

(nm-applet:8202): libnm-CRITICAL **: 13:07:34.017: ((/var/tmp/portage/net-misc/networkmanager-1.16.0/work/NetworkManager-1.16.0/libnm-core/nm-setting-connection.c:207)): assertion '<dropped>' failed

```

In /etc/polkit-1/rules.d/ I have:

10-admin.rules:

```
polkit.addAdminRule(function(action, subject) {

    return ["unix-group:wheel"];

});
```

11-wifi.rules:

```
polkit.addRule(function(action, subject) {

    if (action.id == "org.freedesktop.NetworkManager.*" &&

        subject.user == "me") {

        return polkit.Result.YES;

    }

```

ps -ef | grep kit | grep agent

```
me       8213  8067  0 13:06 ?        00:00:00 /usr/libexec/polkit-gnome-authentication-agent-1
```

What can be wrong?

[Moderator edit: added [code] tags to preserve output layout. -Hu]

----------

## petr2008

I went through https://wiki.gentoo.org/wiki/NetworkManager#nm-applet_and_X_session_startup

again, modified rules a bit. Rebuild with "networkmanager" use flag. But results are still the same.

As root I can play with windows but I am not able to connect. 

Using:

sudo rc-service wpa_supplicant stop

sudo rc-service NetworkManager stop

sudo wpa_supplicant -B -c /etc/wpa_supplicant/pvtc.conf -i wlp2s0

sudo dhclient wlp2s0

I am connected to my wifi. 

Spending few hours with networkmanager, should I get a rid of it?

----------

## petr2008

I found that the error:

Failed to add/activate connection

(1) Failed to get request UID 

is caused by the fact that uid of user "me"

is (intentionally) very large. 

When tested with user with reasonable uid 

this error does not occur.

I tried to make changes into /etc/login.defs:

```
# Min/max values for automatic uid selection in useradd(8)

#

UID_MIN          1000 

UID_MAX         4000000000 #60000

# System accounts

SYS_UID_MIN        101

SYS_UID_MAX        999

# Extra per user uids

SUB_UID_MIN      4000000000 # 100000

SUB_UID_MAX      6001000000 # 600100000

SUB_UID_COUNT          65536

```

But it did not help user "me"

----------

## petr2008

Looking through logs I found possibly related errors: 

```
vok@pvn ~ $ grep -i "uid" .xsession-errors

dbus-daemon[13701]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=3546285467 pid=13749 comm="xfwm4 --display :0.0 --sm-client-id 28cc035d1-0494" label="kernel")

(nm-applet:13782): nm-applet-WARNING **: 19:35:04.438: GDBus.Error:org.freedesktop.NetworkManager.AgentManager.PermissionDenied: Unable to determine request sender and UID.

```

```
pvn /var/log # grep -i "uid" kern.log

...

Aug 20 19:35:01 pvn kernel: [   12.233812] tmpfs: Bad value '-748681829' for mount option 'uid'

..

```

```
pvn /var/log # grep -i "7486" auth.log

...

Aug 15 14:28:03 pvn gnome-keyring-daemon[14502]: couldn't access control socket: /var/run/user/-748681829/keyring/control: No such file or directory

Aug 15 17:16:34 pvn su[20576]: pam_unix(su:auth): authentication failure; logname= uid=-748681829 euid=0 tty=/dev/pts/0 ruser=vok rhost=  user=root

Aug 15 17:32:26 pvn gnome-keyring-daemon[8633]: couldn't access control socket: /var/run/user/-748681829/keyring/control: No such file or directory

Aug 15 17:35:00 pvn gnome-keyring-daemon[8628]: couldn't access control socket: /var/run/user/-748681829/keyring/control: No such file or directory

...

```

```
pvn /var/log # grep -i "7486" kern.log

...

Aug 20 10:38:35 pvn kernel: [    7.968295] tmpfs: Bad value '-748681829' for mount option 'uid'

...

```

Any hint to get around?

----------

