Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 595806

Summary: net-misc/networkmanager-1.4.0-r1[consolekit]: doesn't automatically activate connections marked with "Automatically connect to this network when it's available"
Product: Gentoo Linux Reporter: Herbert Wantesh <rauchwolke>
Component: Current packagesAssignee: Gentoo Linux Gnome Desktop Team <gnome>
Status: RESOLVED FIXED    
Severity: critical CC: david, fitzcarraldo1, gentoo, msava, recycle
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugzilla.gnome.org/show_bug.cgi?id=772640
Whiteboard:
Package list:
Runtime testing required: ---

Description Herbert Wantesh 2016-10-01 18:33:13 UTC
After upgrading networkmanager to 1.4.0-r1 it stopped to connect to networks that are marked as "Automatically connect to this network when it's available". Manually connecting to the network still works. A Workaround is to set the option "All users may connect to this network" which leads to working autoconnects again but autoconnect should work without this option enabled.

[ebuild   R    ] net-misc/networkmanager-1.4.0-r1::gentoo  USE="consolekit gnutls introspection json modemmanager ncurses ppp wext wifi -audit -bluetooth -connection-sharing -dhclient -nss -ofono -resolvconf (-selinux) -systemd -teamd {-test} -vala" ABI_X86="(64) -32 (-x32)" 0 KiB
Comment 1 Herbert Wantesh 2016-10-01 18:41:35 UTC
downgrading networkmanager to net-misc/networkmanager-1.0.12-r1 also works
Comment 2 Fitzcarraldo 2016-10-09 01:05:38 UTC
I can confirm this behaviour. I am using up-to-date Gentoo amd64 and experience the same problem as reported by the Herbert Wantesh since I upgraded to networkmanager-1.4.0-r1. His suggested work-around works in my case too, but it is not a solution. networkmanager-1.0.12-r1 works in my case too.

$ eix -I net-misc/networkmanager
[I] net-misc/networkmanager
     Available versions:  1.0.12-r1 ~1.2.4 ~1.4.0 1.4.0-r1 ~1.4.2 {audit bluetooth connection-sharing consolekit +dhclient dhcpcd gnutls +introspection json +modemmanager ncurses +nss ofono +ppp resolvconf selinux systemd teamd test vala +wext +wifi zeroconf ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" KERNEL="linux"}
     Installed versions:  1.4.0-r1(16:36:22 01/10/16)(bluetooth consolekit dhclient introspection modemmanager ncurses nss ppp wext wifi -audit -connection-sharing -gnutls -json -ofono -resolvconf -selinux -systemd -teamd -test -vala ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" KERNEL="linux")
     Homepage:            https://wiki.gnome.org/Projects/NetworkManager
     Description:         A set of co-operative tools that make networking simple and straightforward
Comment 3 Pacho Ramos gentoo-dev 2016-10-09 07:22:05 UTC
How does networkmanager-1.4.2 work for you?
Comment 4 Herbert Wantesh 2016-10-09 07:46:33 UTC
(In reply to Pacho Ramos from comment #3)
> How does networkmanager-1.4.2 work for you?

same behavior as 1.4.0-r1
Comment 5 Herbert Wantesh 2016-10-09 07:47:30 UTC
btw. i could reproduce this behavior on multiple gentoo installations
Comment 6 Pacho Ramos gentoo-dev 2016-10-09 07:56:38 UTC
I would report this directly to upstream then -> bugzilla.gnome.org
Comment 7 Mircea Sava 2016-10-11 17:02:13 UTC
Same behavior here with up-to-date Plasma on amd64
Comment 8 Timelord 2016-10-11 22:44:56 UTC
I can also confirm this behaviour on amd64 with up-to-date Plasma.
Comment 9 Herbert Wantesh 2016-10-12 19:06:06 UTC
I filed a bug report at https://bugzilla.gnome.org/show_bug.cgi?id=772640.

And the solution is to use this patch - https://bugzilla.gnome.org/attachment.cgi?id=337514&action=diff.
Comment 10 Herbert Wantesh 2016-10-13 07:47:56 UTC
seems something is missing, as i have to restart networkmanager after every reboot to get it working
Comment 11 Herbert Wantesh 2016-10-13 07:55:45 UTC
it seems consolekit wasn't up for whatever reason, after starting it, nm works even after a reboot. so the patch is correct
Comment 12 Fitzcarraldo 2016-10-13 17:14:34 UTC
Unfortunately the patch does not appear to work in my case; 'All users may connect to this network' must still be ticked in the Gentoo amd64 installation on my Clevo W230SS laptop. This is what I have currently:

# rc-update show -v | grep consolekit
           consolekit |      default

# rc-status | grep consolekit
 consolekit                                                        [  started  ]

# ls /etc/portage/patches/net-misc/networkmanager-1.4.0-r1
0002-session-monitor-fix-parsing-of-ConsoleKit-database.patch

# eix -I networkmanager
[I] kde-frameworks/networkmanager-qt
     Available versions:  (5) 5.23.0(5/5.23) 5.26.0(5/5.26) 5.26.0-r1(5/5.26)
       {debug teamd test}
     Installed versions:  5.26.0-r1(5)(18:17:30 08/10/16)(-debug -teamd -test)
     Homepage:            https://www.kde.org/
     Description:         NetworkManager bindings for Qt

[I] net-misc/networkmanager
     Available versions:  1.0.12-r1 ~1.2.4 ~1.4.0 1.4.0-r1 ~1.4.2 {audit bluetooth connection-sharing consolekit +dhclient dhcpcd gnutls +introspection json +modemmanager ncurses +nss ofono +ppp resolvconf selinux systemd teamd test vala +wext +wifi zeroconf ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" KERNEL="linux"}
     Installed versions:  1.4.0-r1(17:12:03 13/10/16)(bluetooth consolekit dhclient introspection modemmanager ncurses nss ppp wext wifi -audit -connection-sharing -gnutls -json -ofono -resolvconf -selinux -systemd -teamd -test -vala ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" KERNEL="linux")
     Homepage:            https://wiki.gnome.org/Projects/NetworkManager
     Description:         A set of co-operative tools that make networking simple and straightforward

Found 2 matches

# cat /etc/NetworkManager/system-connections/eth0
[connection]
id=eth0
uuid=<annonimised by me>
type=ethernet
permissions=user:fitzcarraldo:;
secondaries=

[ethernet]
mac-address=<annonimised by me>
mac-address-blacklist=

[ipv4]
dns-search=
may-fail=false
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore
Comment 13 Herbert Wantesh 2016-10-13 17:29:31 UTC
try to restart networkmanager while already logged. does it automatically connect afterwards?
Comment 14 Herbert Wantesh 2016-10-13 17:34:12 UTC
and please post the complete output of rc-status.
Comment 15 Fitzcarraldo 2016-10-13 21:07:05 UTC
In response to Comment 13 and Comment 14

1. Immediately after rebooting and logging in to Plasma 5:

clevow230ss fitzcarraldo # rc-status
Runlevel: default
 dbus                                        [  started  ]
 NetworkManager                              [ inactive  ]
 netmount                                    [ scheduled ]
 syslog-ng                                   [  started  ]
 cupsd                                       [  started  ]
 samba                                       [ scheduled ]
 consolekit                                  [  started  ]
 cronie                                      [  started  ]
 clamd                                       [  started  ]
 bluetooth                                   [  started  ]
 xdm                                         [  started  ]
 cups-browsed                                [  started  ]
 sshd                                        [  started  ]
 local                                       [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 modules-load                                [  started  ]
 xdm-setup                                   [  started  ]
 avahi-daemon                                [  started  ]
Dynamic Runlevel: manual
clevow230ss fitzcarraldo #

2. Now restart NetworkManager from Konsole:

clevow230ss fitzcarraldo # /etc/init.d/NetworkManager restart
 * Stopping NetworkManager ...                      [ ok ]
 * Starting NetworkManager ...                      [ ok ]
Connecting.......            0sclevow230ss fitzcarraldo #

Restarting NetworkManager whilst logged in to KDE results in the connection named 'eth0' becoming active, and the plasma-nm icon on the Panel now indicates that the connection has become active.

3. After Step 2 has been performed:

clevow230ss fitzcarraldo # rc-status
Runlevel: default
 dbus                                        [  started  ]
 NetworkManager                              [  started  ]
 netmount                                    [  stopped  ]
 syslog-ng                                   [  started  ]
 cupsd                                       [  started  ]
 samba                                       [  stopped  ]
 consolekit                                  [  started  ]
 cronie                                      [  started  ]
 clamd                                       [  started  ]
 bluetooth                                   [  started  ]
 xdm                                         [  started  ]
 cups-browsed                                [  started  ]
 sshd                                        [  started  ]
 local                                       [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 modules-load                                [  started  ]
 xdm-setup                                   [  started  ]
 avahi-daemon                                [  started  ]
Dynamic Runlevel: manual
 ntp-client                                  [  started  ]
clevow230ss fitzcarraldo #
Comment 16 Herbert Wantesh 2016-10-14 07:23:02 UTC
at seems that networkmanager is started before consolekit and therefore NetworkManager knows nothing about consolekit, the restarte of it let it see consolekit and therefore it works afterwards. Did you add Networkmanager to any runlevel? if yes try to remove it from that runlevel and reboot.
Comment 17 Herbert Wantesh 2016-10-14 07:34:04 UTC
maybe someone should add consolekit as "need" to the Networkmanager init script when the consolekit 
useflag is set, to avoid Networkmanager getting started before consolekit like:

/etc/init.d/NetworkManager:

depend() {
        need dbus consolekit
        provide net
}
Comment 18 Gilles Dartiguelongue (RETIRED) gentoo-dev 2016-10-15 10:02:52 UTC
Need to check with upstream as consolekit exposes a dbus service and networkmanager should be able to find it whenever it starts.
Comment 19 Herbert Wantesh 2016-10-15 17:05:40 UTC
(In reply to Gilles Dartiguelongue from comment #18)
> Need to check with upstream as consolekit exposes a dbus service and
> networkmanager should be able to find it whenever it starts.

i think that's the problem. if consolekit isn't found at startup it won't use it.

You can reproduce it:

#remove consolekit from the default runlevel
rc-update del consolekit default

#add Networkmanager to the default runlevel
rc-update add NetworkManager default

#reboot pc
reboot

#after bootup with xdm/sddm no login by now, consolekit is now up but not started from the initscript
/etc/init.d/consolekit status
 * status: stopped

ps aux|grep console  
root      3856  0.0  0.0 408520  5920 ?        Sl   18:52   0:00 /usr/sbin/console-kit-daemon --no-daemon

so consolekit is started by xdm/sddm but not as initscript dependency, xdm only has a use dep:
grep "use.*consolekit" /etc/init.d/*
/etc/init.d/xdm:        use consolekit dbus xfs

and after the login of the user the networkconnection marked with
"Automatically connect to this network when it's available" but not with "All users may connect to this network" isn't automatically borught up. although restarting networkamanger (/etc/init.d/netowrkmanger restart) brings up the connections directly after the restart of nm automatically.

the workaround i proposed before isn't correct as removing networkamanger from the default runlevel is no good idea and could still lead to race conditions, instead the consolekit should be a needed dep in the networkmanagers init script when networkanager was compiled with the consolekit useflag

depend() {
        need dbus consolekit
        provide net
}
Comment 20 Herbert Wantesh 2016-10-15 17:08:57 UTC
> and after the login of the user the networkconnection marked with
> "Automatically connect to this network when it's available" but not with
> "All users may connect to this network" isn't automatically borught up.
> although restarting networkamanger (/etc/init.d/netowrkmanger restart)
> brings up the connections directly after the restart of nm automatically.
> 
btw. the networkconnection only comes up automatically after the manual restart, when the patch "[PATCH 2/2] session-monitor: fix parsing of ConsoleKit database" is applied
Comment 21 Fitzcarraldo 2016-10-20 22:32:59 UTC
(In reply to Herbert Wantesh from comment #17)
> maybe someone should add consolekit as "need" to the Networkmanager init
> script when the consolekit 
> useflag is set, to avoid Networkmanager getting started before consolekit
> like:
> 
> /etc/init.d/NetworkManager:
> 
> depend() {
>         need dbus consolekit
>         provide net
> }

That does indeed work for me:

clevow230ss fitzcarraldo # rc-update show -v | grep NetworkManager
       NetworkManager |      default                           

clevow230ss fitzcarraldo # head -n 12 /etc/init.d/NetworkManager
#!/sbin/openrc-run
# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
# Distributed under the terms of the GNU General Purpose License v2
# $Id$

description="NetworkManager daemon. The service is marked as started only \
when a network connection is established."

depend() {
        need dbus consolekit
        provide net
}

clevow230ss fitzcarraldo # rc-status
Runlevel: default
 dbus                                                        [  started  ]
 syslog-ng                                                   [  started  ]
 consolekit                                                  [  started  ]
 NetworkManager                                              [  started  ]
 netmount                                                    [  started  ]
 cupsd                                                       [  started  ]
 samba                                                       [  started  ]
 cronie                                                      [  started  ]
 clamd                                                       [  started  ]
 bluetooth                                                   [  started  ]
 xdm                                                         [  started  ]
 cups-browsed                                                [  started  ]
 sshd                                                        [  started  ]
 local                                                       [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 modules-load                                                [  started  ]
 xdm-setup                                                   [  started  ]
 avahi-daemon                                                [  started  ]
Dynamic Runlevel: manual
 ntp-client                                                  [  started  ]
Comment 22 Herbert Wantesh 2016-10-29 13:34:19 UTC
any updates? why isn't this merged by now?
Comment 23 Stefano 2016-12-02 21:57:45 UTC
I have the same issue. The consolekit workaround does not work for me.
Comment 24 Herbert Wantesh 2016-12-03 10:09:12 UTC
you need the workaround and the mentioned patch
Comment 25 Anton Bolshakov 2016-12-14 05:07:25 UTC
Please increase the priority of this bug as it affects stable desktop users.
Comment 26 Pacho Ramos gentoo-dev 2017-01-15 15:57:35 UTC
should be ok in 1.4.4
Comment 27 Anton Bolshakov 2017-01-16 02:42:04 UTC
(In reply to Pacho Ramos from comment #26)
> should be ok in 1.4.4

I have quickly tested this version and confirm that the bug is fixed.

Please mark it for a quick stabilization in your list. This is one of main functionality of any network manager which should work by default
Comment 28 Fitzcarraldo 2017-01-17 00:16:15 UTC
In my case networkmanager-1.4.4 only automatically activates connections marked with "Automatically connect to this network when it's available" if the init script also has 'need consolekit' as follows:

depend() {
        need dbus consolekit
        provide net
}

So 1.4.4 alone does not fix the problem in my case.
Comment 29 Pacho Ramos gentoo-dev 2017-01-21 11:40:46 UTC
(In reply to Fitzcarraldo from comment #28)
> In my case networkmanager-1.4.4 only automatically activates connections
> marked with "Automatically connect to this network when it's available" if
> the init script also has 'need consolekit' as follows:
> 
> depend() {
>         need dbus consolekit
>         provide net
> }
> 
> So 1.4.4 alone does not fix the problem in my case.

Can you try with "use dbus consolekit" instead of "need"? Otherwise we would need to force people to choose between either systemd or consolekit (now the ebuild is supposedly allowing setups without both... but I am not sure how is that working really)
Comment 30 Herbert Wantesh 2017-01-21 12:19:04 UTC
(In reply to Pacho Ramos from comment #29)
> (In reply to Fitzcarraldo from comment #28)
> > In my case networkmanager-1.4.4 only automatically activates connections
> > marked with "Automatically connect to this network when it's available" if
> > the init script also has 'need consolekit' as follows:
> > 
> > depend() {
> >         need dbus consolekit
> >         provide net
> > }
> > 
> > So 1.4.4 alone does not fix the problem in my case.
> 
> Can you try with "use dbus consolekit" instead of "need"? Otherwise we would
> need to force people to choose between either systemd or consolekit (now the
> ebuild is supposedly allowing setups without both... but I am not sure how
> is that working really)

"use dbus consolekit" seems to work for me. but as the bug is a race condition as networkmanager is sometimes started before consolekit and it doesn't recognice it, if it isn't up before networkmanager is started, i will test "use dbus consolekit" and report back if it really works reliable
Comment 31 Fitzcarraldo 2017-01-21 14:36:52 UTC
(In reply to Pacho Ramos from comment #29)
> (In reply to Fitzcarraldo from comment #28)
> > In my case networkmanager-1.4.4 only automatically activates connections
> > marked with "Automatically connect to this network when it's available" if
> > the init script also has 'need consolekit' as follows:
> > 
> > depend() {
> >         need dbus consolekit
> >         provide net
> > }
> > 
> > So 1.4.4 alone does not fix the problem in my case.
> 
> Can you try with "use dbus consolekit" instead of "need"? Otherwise we would
> need to force people to choose between either systemd or consolekit (now the
> ebuild is supposedly allowing setups without both... but I am not sure how
> is that working really)

I have changed "need dbus consolekit" to "use dbus consolekit" and rebooted six times so far, and the NetworkManager service has always started after the dbus and consolekit services, so it is looking promising, but I need to try rebooting a lot more before I can be confident the problem has been resolved (in my case at least).

May I recommend that "RESOLVED FIXED" is reverted to "IN_PROGRESS", as a fix is still unresolved?
Comment 32 Pacho Ramos gentoo-dev 2017-01-21 15:34:37 UTC
[master ea79859] net-misc/networkmanager: Try to use consolekit service if built with that support to prevent race conditions (#595806)
 2 files changed, 400 insertions(+)
 create mode 100644 net-misc/networkmanager/files/init.d.NetworkManager-r1
 create mode 100644 net-misc/networkmanager/networkmanager-1.4.4-r1.ebuild
Comment 33 Fitzcarraldo 2017-01-23 23:47:52 UTC
(In reply to Pacho Ramos from comment #32)
> [master ea79859] net-misc/networkmanager: Try to use consolekit service if
> built with that support to prevent race conditions (#595806)
>  2 files changed, 400 insertions(+)
>  create mode 100644 net-misc/networkmanager/files/init.d.NetworkManager-r1
>  create mode 100644 net-misc/networkmanager/networkmanager-1.4.4-r1.ebuild

I merged 1.4.4-r1 and have rebooted many times since then, and the change looks to have solved the problem. The NetworkManager service always starts after the dbus and consolekit services have started (NetworkManager is always the next service to start after consolekit in my installation). So I believe the bug has been squashed. Thanks.
Comment 34 Herbert Wantesh 2017-01-24 17:49:22 UTC
for me too