Search This Blog

Sunday, May 15, 2011

Plasma NM: NM-0.9 (WORKING)

Hi all, as I said in another post I have spent last Saturday (May 14th) and Sunday (May 15th) trying to improve NetworkManager-0.9 support in Plasma NM. The situation before May 14th was a follow: networkmanagement/master compiles/works with NM-0.8.1 and above. Branch networkmanagement/nm09 compiles against NM-0.8.x but needs several hacks to work with NM-0.9. Plasma NM uses Solid's NetworkManager and ModemManager backends from kde-workspace repository. Since 4.6.0 the NetworkManager backend uses the ModemManager backend for Bluetooth/Gsm network interfaces.

I have heard of two other attempts to bring/improve NM-0.9 support to Plasma NM. The first one is from Fedora guys and even them admit that it is not ideal. The other is from Will Stephenson, the Plasma NM maintainer and who most people here already know, including me, hi Will :-). Well, I do not know how much time Will's libnm-qt is going to take to be ready to be used in Plasma NM so I am doing what I proposed last month:

  1. Create the new Solid's NM-0.9 backend outside kde-workspace repository so that we could change it freely without KDE's freature freeze/ABI restrictions. (DONE)
  2. Make it compile against NM-0.8.999. (DONE)
  3. Remove #ifdef COMPILE_MODEM_MANAGER_SUPPORT and #ifdef NM_0_8 from the source code. (DONE)
  4. Make everything compile/work when the old NM-0.7 backend from KDE SC 4.{6,7} is installed. (DONE)
  5. Create code to import existing NM-0.8 connections to NM-0.9. (DONE)
  6. Make it really work with NM0-0.8.999. (DONE)
  7. Convert code to use libnm-qt instead of Solid::Control::*Nm09. (DONE)
  8. Improve support for Pppoe (Pots in NM-0.9 terminology), Cdma and IPv6. (TO BE DONE)
  9. Implement the new interface types: LTE, Wimax and OlpcMesh. (TO BE DONE)
Item #3 means Plasma NM requires at least KDE SC 4.6.0 to compile now. Item #4 means I can connect to my VPNC, ethernet, WPA wifi and 3G/Gsm connections, probably bluetooth is also working since it is very similar to 3G/Gsm, but I have not tested it. Item #6 depends on NetworkManager guys since Pppoe support is still in progress there. Item #7 may take a long time since I do not have any of those equipaments to do tests, the same is true for Cdma and IPv6.

Update: VPN works now after Ilia Kats implemented the secrets agent from NM-0.9 specification, Lukáš Tinkl changed the DBus types used to (de)marshall objects in QtDBus, and I created the SecretsObject needed to get the secrets from kwallet/kconfig and fixed another bug that prevented the secret types ("always ask", "saved", "not required") to work properly.

Secrets (passwords, Gsm PIN, wifi/vpn encryption keys) can now be saved in KDE session using kwallet (encrypted) or in (plain text) Plasma NM's configuration file. When creating or editing a connection check the checkbox "System connection" to make them be saved in (plain text) NM configuration files. The default is to save them in KDE session, which means a connection with secrets requires Plasma NM running to work. Connections without secrets work without Plasma NM running reggardless if the "System connection" checkbox is checked or not. Maybe we can improve the user interface to make that clearer.

The new backend is going to support only NM-0.9 and it keeps the old Solid::Control namespace. I have just duplicated the classes used in NM-0.7 backend with a Nm09 suffix to distinguish them, so Solid::Control namespace is more inflated now, sorry hehe. The new headers for Solid::Control::*Nm09 classes are installed in $KDEDIR/include/solid/controlnm09 to do not clash with the old ones in KDE SC. When Will finishes his libnm-qt we are going to remove the Solid::Control namespace (at last), which probably is going to happen before KDE SC 4.7.0 release.

I commited the code to nm09 branch in May 16th. If you are a programmer and want to help fix the remaining bugs please test it. If you are a user that wants a rock solid network connection just wait until we fix the most obvious bugs, this code is not for you yet. Expect crashes, instability and missing features when using this code. Update: thanks to whoever fixed the connection editing problem :-)


    Anonymous said...

    Good work! Thanks for info.

    Gillian said...

    can't wait !

    Anonymous said...

    you can't imagine how many people are grateful for your hard work.


    Anonymous said...

    Hello, I hope you fixed all of the bugs, I can assure you the NM plasmoid was the most buggy software of the KDE SC, and imho it's part of the core, since all distros ship NM by default.

    I even had to switch to Wicd.

    Anonymous said...

    Wow.... I can not say than WOW!

    Networkmanager improves very nice speed and looks like the networking is at much better state than ever for desktop users in any platform.

    Anonymous said...

    Wonderful. You rock man!

    Anonymous said...


    I really appreciate Your work, thanks!
    But I have some issue, I can't get VPN to work with 0.8.x compiling from master. I use archlinux with KDE 4.6.3 and no VPN is shown anywhere, I tried with NM 0.8.1 - 0.8.4 and nothing.
    Is there smth I missed or this is known not to work at all?


    Lamarque said...

    I have a VPNC (Cisco) connection working that I use for tests. Since I do not have other VPN type connections to do tests I do not know if they really work.

    Anonymous said...


    Ahh, that was so quick :D I have tried all types of VPN and none works, mostly I require VPNC to connect to my workplace. Do You have any suggestions how I could debug out why VPNC connections are not on the list at all?

    thank you and regards

    Lamarque said...

    You can watch NetworkManager's log (mine is in /var/log/daemon.log) and KDE's session log (~/.xsession-errors). Those are the two that I use to debug problems in Plasma NM.

    Anonymous said...

    Hi again!

    Sorry for troubling again, but in those logs where is nothing really that stands out for not showing VPN connections...
    Only this when creating VPN connection:
    X Error: BadWindow (invalid Window parameter) 3
    Major opcode: 18 (X_ChangeProperty)
    Resource id: 0x4c00019

    I wonder why it don't show up. When I go to manage connections it's there, it's just it never shows up and I can't connect to it :(

    thanks in advance

    Lamarque said...

    That is strange. The "virtua" VPN interface item only appears if there is at least one VPN connection. It does not appear then Plasma NM did not find any VPN connection. But if you say it appears in the connection configurator then there is something wierd happening here.

    I won't have time to investigate this problem for the next couple of months. There many other urgent things to fix first. Open a bug entry in and when I have more time I will investigate it.

    Thijs said...


    I've spent quite some frustration in getting PPPoe over WiFi to work for me, some parts not working at all, some only through the gnome applet. Work on such a commonly used part of KDE will be appreciated and/or taken for granted by so many people over the world.... Not to mention the consistent blogging.


    Lukas said...

    Can't wait to see in official release :)

    I just wonder if
    >>check the checkbox "System connection" to make them be saved in (plain text) NM configuration files.
    is the best solution.

    What about having private/public key encryption: Each user shares his public key, and when connection is checked as system, NM creates encrypted file for each user.

    To read it, just use the private key, protected in KWallet. This would probably require KWallet to be extended, but still...

    Lamarque said...

    @Lukas, system connection means the connection is shared with all users. Any user has permission to activate/deactivate a system connection. Using private/public keys for each user would prevent that from working.

    NM should encrypt the secrets, the problem is how to save the encryption key. If it is saved in a plain text file, that is as bad as using plain text files to save the keys.

    Anonymous said...

    Personally I do not like NM. It's working a little bit better under Gnome but globally it's more a pain thant a help.
    Somethimes, I do not know why NM decide to butcher my internet connection and because there are no way to stop/restart it properly and simply, the only way to have a working connection was to restart the computer.
    I do not have any problem using Wicd so the problem is clearly NM. So that will be really good if you can implement a way to stop and restart properly NM.

    Lamarque said...

    Believe me, I know how painfull NM can be. As far as I know wicd does not support 3G connections, which I use. NM's clients (Plasma NM, nm-applet) are not supposed to restart NM, only disable networking or make NM sleep. In both cases NM is still running and the only way to restart it is through command line.

    NM works ok for me. The really big problem we from KDE have is understanding how a NM client is supposed to interact to the daemon. There is no documentation about that and sometimes I really get tired of guessing and look at nm-applet's source code. That is the only documentation we have, which is kind of reverse engineer :-/

    The VPN support in Plasma NM is going to this process. We really just not know what changed in NM from 0.8 to 0.9 that broke VPN in Plasma NM. All other connection types are working, only VPN is not, and the migration guide does not talk about VPN.

    Lukas said...

    @ Lamarque

    let say we have public keys of each user at
    The NM creates (that’s we we need public keys) encrypted version for **EACH** user with current key like

    Since each user HAS its own private key, he can read USER_NAME.connection_id.encrypted file and use the secrets inside them, then necessary.

    p.s. it would be great if refresh button would be implemented, since in some cases its not clear it the new networks are there (like iphone can share its 3G over WiFi)

    Sameer said...

    I am waiting for KDE to support Bluetooth Dial-up. From what I understand, it will work once your changes are in. Great work!

    Lamarque said...

    @Sammeer, the changes are already in KDE SC 4.7beta1 and Plasma NM (both nm08 and nm09 versions).

    dMaggot said...

    Just saw this post after reading and replying to your comment in mine. It's good to see the situation has moved forward and we are soon going to be able to use a decent Network Manager applet :D

    Gustavo said...

    Where do I find the libnm-qt source code?

    Lamarque said...

    libnm-qt is a branch in your repository:

    git git://
    cd networkmanagement
    git checkout libnm-qt