Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
OpenELEC (4.0.1) WIFI connection details using `connman`

Even though there is a nice XBMC add-on to configure your WIFI settings, sometimes, you may still want to setup the WIFI connection for many reasons or just for fur.

OpenELEC use connman for managing connection to the various available network.

Setuping connman to connect to your protected WIFI network is an easy requiring you only to create a config file and enter some commands in a shell.

This guide was run using OpenELEC 4.0.1 which use internally connman 1.21. It will guide through all necessary steps to configure a connection to your WIFI network. Once setup, OpenELEC will automatically re-connect on boot as long as you keep the configuration in your storage.

Here we go!

  1. Ensures connman daemon is running:

    ps faux | grep connmand

    If you see something like below, then you are good to go:

    OpenELEC:~ # ps faux | grep connmand
     862 root       0:00 /usr/sbin/connmand -nr
     1033 root      0:00 grep connmand

    If you only see:

    OpenELEC:~ # ps faux | grep connmand
     1033 root      0:00 grep connmand

Then you will probably need to startup connmand manually. Note that this will not be persistent, i.e. it will not autostart next time you boot your machine.

To start connmand manually, do:

   `/usr/bin/connmand -nr`
  1. Ensures there is a network adapter for your WIFI card (or USB dongle or whatever):


    You should see an adapter starting with wlan in the list. Here the result of the command in my hardware:

    eth0      Link encap:Ethernet  HWaddr B8:27:EB:0F:01:A0
              inet addr:  Bcast:  Mask:
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:2307 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1268 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:320940 (313.4 KiB)  TX bytes:159217 (155.4 KiB)
    lo        Link encap:Local Loopback
              inet addr:  Mask:
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    wlan0     Link encap:Ethernet  HWaddr 00:13:EF:20:01:8A
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  2. Enable connman wifi technology:

    connmanctl enable wifi

    Maybe connman will complain that wifi is already enabled, if it's the case, no problem, just move to next step.

    If connman cannot enable wifi, it probably means there is something fishy with your adapter (wrong linux driver maybe).

  3. Scan for WIFI network nearby:

    connmanctl scan wifi

    This will scan nearby network available.

  4. List found WIFI network:

    connmanctl services

    This will list all known services. A services for connman is an available device for which is possible to connect to. This is not limited to WIFI and includes ehternet, bluetooth (if enabled) and more. Here the list I received when doing this command on my hardware:

    *AR Wired             ethernet_b827eb0f01a0_cable
     BELL825              wifi_0013ef20018a_42454c4c383235_managed_psk
     VIDEOTRON2188        wifi_0013ef20018a_564944454f54524f4e32313838_managed_psk
     bungie               wifi_0013ef20018a_62756e676965_managed_psk
     Moth                 wifi_0013ef20018a_4d6f7468_managed_psk
     Maison               wifi_0013ef20018a_4d6169736f6e_managed_psk
     GOAHEAD              wifi_0013ef20018a_474f4148454144_managed_psk
     VIDEOTRON6117        wifi_0013ef20018a_564944454f54524f4e36313137_managed_psk
     VIDEOTRON4100        wifi_0013ef20018a_564944454f54524f4e34313030_managed_psk
     Nicolas              wifi_0013ef20018a_4e69636f6c6173_managed_psk

    As you can see, there is a bunch of them. All the one starting with wifi_ are WIFI network available to connect to. The suffix _psk means it's a protected network.

    If my case, the network I want to connect to is Moth, so its service id assigned by connman is wifi_0013ef20018a_4d6f7468_managed_psk.

  5. Create the configuration file to access the network.

    The connman configuration files on OpenELEC are not at the usual location of /var/lib/connman. In the OpenELEC distribution, you must put your configuration file in /storage/.cache/connman.

    So, navigate to this directory and create a file with the pattern <name>.config. The <name> should be replaced with any name you think is useful to remember the network. In my case, I chose moth as the <name> since it relates closely to the WIFI SSID name.

    When the file is created, enter the following content in it using your favorite editor (nano is the default one in OpenELEC):

    Name = Moth
    Description = Moth Wifi service config file
    Type = wifi
    Name = Moth
    Passphrase = <passphrase>

    This is the minimal configuration required (in fact, the [global] section is not really necessary but useful to have).

    For the [global] section, enter an identifier for the file in the Name field and a description of the network in the Description field.

    Other section must always start with a service_. What follows after is simply again another identifier which identity the network. In my case, I used the pattern wifi_<ssid_name>.

    Then, in this section, the Type if the type of technology for the service which is wifi in our case. The Name represents the SSID network name with is Moth in my case. And finally, Passphrase is the password for the network, replace <passphrase> with your own secret passphrase.

    If you have an SSID name with special characters (like spaces or anything else), removed the Name line and put a line SSID = <SSID_name_in_hex> instead. The value <SSID_name_in_hex> should be replaced by the hex value of your SSID name which can obtained online with a service like . For example, for the network Moth, the configuration file would look like this when using the SSID field:

    Name = Moth
    Description = Moth Wifi service config file
    Type = wifi
    SSID = 4d6f7468
    Passphrase = <passphrase>

    There is more more configuration available but only those will suffice for you guide. Refer to the config file format for more information on the configuration file format (links to version 1.21 of connman).

  6. Check that connman correctly sees your new settings.

    For this, simply run:

    connmanctl scan wifi
    connmanctl services

    In the refreshed services list, there now should be a A* just before the network you configured, this indicates that connman knows how to connect to this service:

    *AR Wired                ethernet_b827eb0f01a0_cable
    *A  Moth                 wifi_0013ef20018a_4d6f7468_managed_psk
        BELL825              wifi_0013ef20018a_42454c4c383235_managed_psk
        bungie               wifi_0013ef20018a_62756e676965_managed_psk
        Nicolas              wifi_0013ef20018a_4e69636f6c6173_managed_psk
        Maison               wifi_0013ef20018a_4d6169736f6e_managed_psk
        GOAHEAD              wifi_0013ef20018a_474f4148454144_managed_psk
        VIDEOTRON2188        wifi_0013ef20018a_564944454f54524f4e32313838_managed_psk
        VIDEOTRON6117        wifi_0013ef20018a_564944454f54524f4e36313137_managed_psk
        VIDEOTRON4100        wifi_0013ef20018a_564944454f54524f4e34313030_managed_psk

    If the network does not have the *A before it, try restarting the connman daemon to force it to reload configuration files. First, obtain the connmand pid by running:

    ps faux | grep connmand

    And then checking the first number if the result line.

    kill <connmand_pid>

    It should restart automatically but if it's not the case:

    /usr/bin/connmand -nr

    When it have restarted, run another wifi scan and check if the services has the *A flag.

  7. Connect to the network

    connmanctl connect wifi_0013ef20018a_4d6f7468_managed_psk

    Where wifi_0013ef20018a_4d6f7468_managed_psk is the servie id reported by connman for your network.

    If everything went well, should then be connected to your protected WIFI network.

Voilà and enjoy Matt

Great article. Thanks for posting this. The wifi is super slow on my Raspberry Pi with OpenElec. I have an edimax wireless N usb dongle. Does this one suck or is there a way to force wireless N?


ghost commented Apr 12, 2014

It is a very useful article.I managed to configure a raspberry pi with openelec without problem through a ssh conection.


maoueh commented May 18, 2014

@SlackMaster, thanks for the good words. I have also a slow WIFI connect with a really small usb dongle and speed is not great. On my side, I think the antenna is not strong enough for where I live. I will probably order a more stronger adapater, will tell you how things went on this side.

@JoSeFer thanks also for the good comments. This was also my use case when I wrote this guide, and as a reference next time I need to to it just like today. I wonder also why I didn't get emails about your two posts...

naitse commented May 22, 2014

what if I do connmanctl services and no wifi apperars but all previous steps are done ok? :/

my wifi dongle is

Bus 001 Device 007: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter


maoueh commented Sep 20, 2014

@naitse Hard to say :( Sorry for long responses, I do not receive notifications for those. Maybe your wireless cannot be seen by your dongle. For example, at home, I have two wireless setup (one on 5Ghz frequency named butterfly and another on the 2.4Ghz frequency called moth). When retrieving services, only moth is found, surely because my dongle is not able to detect wireless network within the 5Ghz range.

There can be other possibility, I would try the dongle inside another computer to test it and ensure you can connect to the network. If it works, it may be a bug in OpenELEC or if you are far from the router, maybe the distance.

Good luck :)

alesch commented Mar 17, 2015

Thank you for this article!

Frog90 commented Apr 2, 2015

Using OpenElec 5.0.7 on Raspberry Pi 2 quand-core.

Could not get Wifi to work via GUI with this Wifi dongle ( via lsusb ) :

Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

This guide worked first time. My WiFi has a WEP encryption running "G" 54Mbps on 2.4Ghz.

Many thanks.

Absolutely brilliant article!

Wonderful article!!

The target wifi for the RP2B is a WiFi with WPA2 encryption. I've been unable to connect to it following quaduple checking of the steps followed in the article. Is this becuase the WiFi setup described is for WEP only? If so, what is the connman config line / revision to activate a WPA2 WLan?

Ok, last post for now:

I disconnected the Pi from power and wired Ethernet. Powered it back up and...

...successfully pinged the Pi via WiFi !!

Now, back to my original query: Where did that (now working) wifi connection file get saved??


Great info, much appreciated. I may be a right fool here but can someone please clarify the process to add two or more wlan configs. I would like to have a box that'll connect in a number of places and would like to have it store a list of known networks.

If you get the answer to your multi SSID wifi question above, please post it here. Would like to acheive the same with my RPi2B. Thanks in advance.

pigoz commented Aug 21, 2016

Great article. Thanks for taking the time to write it! 👍

Thanks, this was helpful. In case of plex original raspberry image... doing ssh... root/plex > that password is nowhere documented and ssh is only way to get in as plex does NOT allow to open another console with ctrl+alt+F2 key combination

Thanks for a great guide! Can you please take a look at the issue that I'm having? I don't know where to set this ap_scan thing (openELEC 6.0)

  • Oct 23 19:36:23 OpenELEC wpa_supplicant[2713]: Note: nl80211 driver interface is not designed to be used with ap_scan=2; this can result in connection failures
  • Oct 23 19:36:23 OpenELEC wpa_supplicant[2713]: Using interface wlan0 with hwaddr xx:xx:xx:xx:xx:xx and ssid "xxxxxxxxxxxxx"
  • Oct 23 19:36:23 OpenELEC kernel: Disconnect STA : ff:ff:ff:ff:ff:ff scb_val.val 3

smosse commented Dec 31, 2016

thx !

Thanks so much this is really fantastic, wifi option for Plex Media Player on Pi3. Runs very smooth at 10Mbs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment