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

Bug 607352

Summary: net-misc/networkmanager: Add elogind support
Product: Gentoo Linux Reporter: Martijn Schmidt <martijn.schmidt>
Component: Current packagesAssignee: Gentoo Linux Gnome Desktop Team <gnome>
Status: RESOLVED FIXED    
Severity: normal CC: bruce, floppym, martijn.schmidt, sven.eden
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 599470    
Attachments: Patch for networkmanager-1.4.4-r1 ebuild
Patch networkmanager to accept elogind
Patch networkmanager-qt to allow networkmanager[elogind]
Update init script to use elogind
Updated patch to support elogind support
networkmanager-1.8.0.ebuild.diff

Description Martijn Schmidt 2017-01-27 00:53:00 UTC
net-misc/networkmanager uses either consolekit or systemd-logind for session tracking.

Could we please add support for libelogind by adding a new USE flag "elogind" which would patch the source to depend on sys-auth/elogind and allows one to forego both systemd and consolekit?

Admittely, I am not anywhere near an expert but if my search engine skills serve me right then nm-session-monitor.c would be the primary target for patching: https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/nm-session-monitor.c?id=fa15543179aa8ca8e082267121e7df4a131bf642

Moreover, GuixSD has already started some work on similar patches according to their mailing list - which might come in useful: https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00916.html
Comment 1 Sven Eden 2017-02-14 08:21:39 UTC
I am working on it.

But I've seen, that kde-frameworks/networkmanager-qt has to be changed to allow elogind, too, as it depends on either
  >=net-misc/networkmanager-1.4.0-r1[consolekit,teamd=] or
  >=net-misc/networkmanager-1.4.0-r1[systemd,teamd=]

It simply needs a line
  >=net-misc/networkmanager-1.4.0-r1[elogind,teamd=]
as a third alternative.
Comment 2 Sven Eden 2017-02-21 12:55:57 UTC
I have come up with the following changes to allow my Plasma system to use networkmanager with elogind.

Please note, that I am *normally* using a dhcpcd-only system. I have therefore changed the ebuild so that USE="-dhclient" results in using dhcpcd.
(Actually if you disable dhclient, the networkmanager configure script will use it anyway although it isn't there, unless told to use dhcpcd.)
Comment 3 Sven Eden 2017-02-21 12:58:04 UTC
Created attachment 464500 [details, diff]
Patch for networkmanager-1.4.4-r1 ebuild

This patch adds USE="elogind" to have networkmanager to use elogind instead of systemd-login.

Further USE="-dhclient" will result in dhcpcd to be used.
Comment 4 Sven Eden 2017-02-21 13:00:30 UTC
Created attachment 464502 [details, diff]
Patch networkmanager to accept elogind

This patch adds --with-session-tracking=elogind support and patches
  src/nm-sleep-monitor.c
and
  src/nm-session-monitor.c
to make use of elogind.
Comment 5 Sven Eden 2017-02-21 13:01:23 UTC
Created attachment 464504 [details, diff]
Patch networkmanager-qt to allow networkmanager[elogind]

Plasma users need this, or networkmanager-qt insists on either systemd or consolekit.
Comment 6 Mike Gilbert gentoo-dev 2017-02-21 15:04:53 UTC
Please send any relevant patches upstream.
Comment 7 Sven Eden 2017-02-21 15:23:29 UTC
(In reply to Mike Gilbert from comment #6)
> Please send any relevant patches upstream.

Sure! Once they are tested.

Currently NetworkManager works fine with dhcpcd using elogind-225.9999 on my laptop. If it still works fine (So no weird log messages) tonight at home, where it has to deal with wifi, I'll send it upstream tomorrow.
Comment 8 Sven Eden 2017-02-24 08:57:08 UTC
Created attachment 464966 [details, diff]
Update init script to use elogind

I can't believe I forgot to upload that.

The init script already has a
  use consolekit
clause, and when elogind is present, a
  use elogind
clause should help.
Comment 9 Sven Eden 2017-02-24 09:22:39 UTC
Currently I have installed:

- net-misc/networkmanager-1.4.4-r13::seden
- net-misc/dhcpcd-6.11.5
- sys-auth/elogind-225.9999::seden

With this setting all networking work just fine, configured from Plasma using networkmanager-qt.

I have registered with bugzilla.gnome.org and will propose my patch upstream.
Comment 10 Sven Eden 2017-02-24 09:34:31 UTC
Submitted as bug 779167 (https://bugzilla.gnome.org/show_bug.cgi?id=779167)
Comment 11 Sven Eden 2017-02-25 11:42:47 UTC
Elogind support in NetworkManager has been merged:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=e40d47fe7ccd725ecf6231e0f1193a029ea05e47
Comment 12 Sven Eden 2017-02-25 11:45:31 UTC
Created attachment 465102 [details, diff]
Updated patch to support elogind support

This is an updated patch, that adds changes by Thomas Haller <thaller@redhat.com> made to the initial patch.
This is essentially what has been merged into upstream.
Comment 13 Martijn Schmidt 2017-02-25 13:45:48 UTC
I have tested both builds - net-misc/networkmanager-1.4.4-r13 with Sven's original patches and net-misc/networkmanager-1.4.4-r14 with the patches that Thomas committed upstream. Works like a charm, and I have uninstalled ConsoleKit in its entirety. Typically use WiFi, but it also worked hotplugging my TB3-to-TB2 + Apple Thunderbolt 1GbE NIC on the Dell XPS 13 9360.

So, fingers crossed for the next upstream release and hopefully we can then add the elogind USE flag to the in-tree ebuild!
Comment 14 Andreas Sturmlechner gentoo-dev 2017-05-27 10:52:05 UTC
Created attachment 474512 [details, diff]
networkmanager-1.8.0.ebuild.diff

networkmanager-1.8.0 has upstream elogind support, let's make it available then.
Comment 15 Andreas Sturmlechner gentoo-dev 2017-05-27 15:11:32 UTC
Thanks, net-misc/netorkmanager-1.8.0 added USE=elogind in git commit 17287aa7d5aa639964c529c6ed08f9bcee2e172d
Comment 16 Mart Raudsepp gentoo-dev 2019-03-23 10:23:47 UTC
Why do we have ?? ( consolekit elogind systemd ) (instead of ^^) when the suspend-resume stuff always falls back to at least consolekit in the usex chaining? Upstream has a final fallback to upower instead though
Comment 17 Mike Gilbert gentoo-dev 2019-03-23 12:46:19 UTC
(In reply to Mart Raudsepp from comment #16)

upower was killed by Pacho in bc2837c7ea2af4ebec0629370da94686c2cdf1f7.

There's no option to disable suspend/resume support entirely. The consolekit option requires no external build-time dependencies, so it makes a reasonable default when no other provider is selected. The dbus calls will just fail at runtime.
Comment 18 Mike Gilbert gentoo-dev 2019-03-23 12:48:53 UTC
In other words, it is entirely practical to use networkmanager without consolekit, elogind, and systemd. Please don't add an unnecessary REQUIRED_USE constraint.
Comment 19 Larry the Git Cow gentoo-dev 2019-03-23 12:58:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3d917e57fa37daea47fa0f1e3e4f5027510479d

commit a3d917e57fa37daea47fa0f1e3e4f5027510479d
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-03-23 12:58:06 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-03-23 12:58:06 +0000

    net-misc/networkmanager: explain consolkit default for suspend/resume
    
    Closes: https://bugs.gentoo.org/607352
    Package-Manager: Portage-2.3.62_p4, Repoman-2.3.12_p87
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 net-misc/networkmanager/networkmanager-1.16.0.ebuild | 2 ++
 1 file changed, 2 insertions(+)