Connecting 3G usb dongle/modem to osmc on raspberry pi

From my tinkering, I had the impression that as long as your dongle is supported by usb-modeswitch then it just presents a modem that you send AT commands to. I suppose sakis-3g uses a scattergun approach to find which port to talk to and which AT commands get a response. Ofono would have to be told what to send. So yes, it will be difficult to provide a plug-n-play experience but more knowledgeable users could make it work if connman could recognise a wwan/ppp device. Does it have to be compiled differently?

I couldn’t get it to recognise a ZTE device, but you may like to try, making sure usb-modeswitch does its stuff before connman starts up.

You may find this helpful. It’s how I use a USB 3G device with the Pi as a gateway to a wired ethernet. You would have to substitute ppp for wwan and wlan for eth.

well i am still trying it but so far it didnt detect any… im trying to create wifi hotspot with connman… i was able to successfully create the hotspot after boot by editing rc.local… the hotspot gets created and i could connect my devices to it… but when i try to surf something lets say i get couldnt resolve host name… what am i missing here? maybe dns ? or since im using sakis3g for ppp0 and connman for hotspot connman didnt recognise the ppp0 connection?

See above. Connman just gets in the way.

just now i saw the post. thanks for the help.

well my usb modem’s ip keeps changing everytime i dial it…
Link encap:Point-to-Point Protocol
inet addr: P-t-P: Mask:
RX packets:112 errors:1 dropped:0 overruns:0 frame:0
TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:26120 (25.5 KiB) TX bytes:9417 (9.1 KiB)
how to write the script then?

I guess you have to find the IP address using something like ip -f inet addr show ppp0, extracting it with grep, awk or sed. Note that my case is different: my 3G device is a router so always presents a local ip address. YMMV.

Note also you will have to address the security issue discussed here.

Well i finally found a way to use 3g modem and also share the internet via hotspot.

well this method doesnt need the complex way of using sakis3g or umtskeeper. plus i have to mention that the connman is badly documented and the ofono is the worst… the most annoying packages actually. i request the osmc guys to run networkmanger in future builds as its painless… ok here is the steps to easily activate 3g modem

  1. install networkmanager
    2.installl modemmanager

  2. install ppp

  3. check if ur modem is detected
    nmcli dev status

  4. now create your 3g connection via nmcli

follow instructions in this page command line - configure gsm connection using nmcli - Unix & Linux Stack Exchange

  1. make sure autoconnect is set to true in ur file

  2. creat a hotspot using nmcli

follow this Create Wi-Fi Hotspot on Linux using nmcli · GitHub

  1. make sure autoconnect is set to true

  2. sudo apt-get remove connman

  3. conmanpackage will be removed but it still stays…i dontknow how…

  4. since connman stays we can changed or edit wifi and ethernet using osmc addon

  5. cd /var/lib/connman

  6. ls

  7. delete anything in that by

`sudo rm -r (your file name starts with wifi)

  1. after deleting reboot,

  2. modem will be connected and also the hotspot…

if you want to use wifi or ethernet… unplug modem and use osmc addon to configure to wifi or ethernet `

this method detects nearly 90% of usb modems ( dont know about modems that act as usb ethernet like latest 4g modems)

GOOD luck folks…

Good work! I don’t know if the OSMC team is ready to ditch connman, however frustrating it is. Did you stop the connman service before trying to purge it?


I’m glad you’ve got your device working. But your advice isn’t good.

The choice to use ConnMan, and not NetworkManager is a conscious and hopefully, judicious one. We used NetworkManager in the past with Raspbmc and experienced some problems with this.

This isn’t something we will do. This has been covered on the forum in the past. While NetworkManager may be useful for advanced users, it’s not suitable for the average user. We have a focus on simplicity and need stability (API and predictability in behaviour) to ensure our users can perform simple tasks like connecting to WiFi networks from a GUI. When we’ve had issues with ConnMan, we’ve been able to submit fixes and get them merged upstream. For now, it sounds like the only reason you are putting NetworkManager forward is because it works with a larger set of USB modems. But that is not going to be used by a lot of users.

We don’t package the official connman from Debian (it’s old). What version of OSMC are you running? We haven’t packaged the official version since early 2015. Of course you will experience isssues if running an OSMC version that is this old.

See dpkg -l | grep connman-osmc

Keep in mind that while OSMC is based on APT and we encourage people to expand their system, we expect OSMC to manage the networking. Installing NetworkManager will break OSMC’s expectation of the network stack and in turn updates will likely not work as expected. We won’t be able to provide support for this but if you are happy to deal with this that is fine. We don’t recommend your proposed advice for the average user however. If there’s demand for 3G modem support in OSMC, it will come and it will work well (with My OSMC integration).



No i didnt stop before purging it . since i was using ssh to do all the stuffs i was afraid that might stop the wifi inturn ssh… im gonna get a usb keyboard to do the terminal works locally…ill be also trying to integerate myosmc addon with network manager… i really need some help in finding where the osmc image is installed when installing via qtinstaller.


well yeah i didnt explain it well since i was almost 100%tired and sleep when i wrote the post… ill make a detailed one just to get usb modem working …

well i understand the situation as 99 % of users will be using either ethernet or wifi as source… but the remaining 1% who live remotely or dont have ethernet should have a chance too… i tried using wifi but since lot of devices in my home used wifi… osmc didnt get enough bandwidth… so i had to do this., since the 1% use a very wide variety of modems of lot of kinds… networkmanager gets them working…

well in my honest opinion supporting modems will be like honouring the persons who like osmc but have to deal with usb modems… :slight_smile:

maybe if osmc can make a separate version using network manager… i hope that wont be a big task…

and well i use the latest build of osmc…
after i deleted conman…

it somehow is still working actually…

im able to get connmanctl runiing and im able to connect wifi over osmc addon. which means connman is still in there…

when i checked with dpkg it says not found…

well since connman is working it is messing up with the automatic wifi hotspot…

my hotspot turns on at boot but turns off after 30 seconds… i guess thats the work of connman…

ill do a clean install once again and try to sort it out… thanks for the helo :slight_smile:


Yes – it means you didn’t remove ConnMan. If you did, you would break dependencies on a fair few OSMC packages which would bork your system.

Your system is still a mess, but as long as it works, good to hear it. Updates likely won’t work and we won’t be able to support them if that turns out to be the case.

yup sudo apt-get remove connman didnt remove the connman that came with osmc. as you said i did dpkg -l |grep method to find and remove connman. i used network manager then to connect to the modem.

Your system is still a mess

yes it is a total mess removing connman and installing network manager… so i reverted back to connman and sakis3g combination which works good.


i later pursed with connman trying to find way to use connman and ofono.

i achieved partial success till the point the modem got successfully detected by ofono and connman… but i still couldnt find the trigger connman to turn it on. i found that that ofono is being controlled by dbus. can you throw me some light in this regard… im literally too close in making this work via connman+ ofono

so far im able to get my modem status information, network provider name, signal level and connection type…

I sent this patch to @grahamh but he hasn’t had a chance to test it yet. I haven’t tested it myself, but it will get ConnMan built with Ofono support.

diff --git a/package/connman-osmc/ b/package/connman-osmc/
index 6db91ef..c752e9c 100755
--- a/package/connman-osmc/
+++ b/package/connman-osmc/
@@ -23,6 +23,7 @@ then
        handle_dep "iptables"
        handle_dep "libgnutls28-dev"
        handle_dep "libglib2.0-dev"
+       handle_dep "ofono-dev"
        sed '/Package/d' -i files/DEBIAN/control
        echo "Package: ${1}-connman-osmc" >> files/DEBIAN/control
        pushd src/connman-$VERSION
diff --git a/package/connman-osmc/files/DEBIAN/control b/package/connman-osmc/files/DEBIAN/control
index 37b1138..2d8d42f 100644
--- a/package/connman-osmc/files/DEBIAN/control
+++ b/package/connman-osmc/files/DEBIAN/control
@@ -5,4 +5,4 @@ Essential: No
 Priority: optional
 Maintainer: Sam G Nazarko <>
 Description: connman for OSMC
-Depends: dbus, init-system-helpers, libdbus-1-3, libglib2.0-0, libgnutls-deb0-28, libreadline6, libxtables10
+Depends: dbus, init-system-helpers, libdbus-1-3, libglib2.0-0, libgnutls-deb0-28, libreadline6, libxtables10, ofono
osmc@vero:~/GitProjects/osmc$ patch -p1 < ofono.patch
patching file package/connman-osmc/
Hunk #1 FAILED at 23.
1 out of 1 hunk FAILED -- saving rejects to file package/connman-osmc/
patching file package/connman-osmc/files/DEBIAN/control
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 21:

Just patch it manually (only a couple of lines). You probably ran in to white space or issues copying it

The lines are tab-indented but copy/paste will contain 8 spaces.

Happens all the time! :wink:

You can use --ignore-whitespace to ignore

No cut and paste - I just did the wget you posted. Anyway, connman now installed on v4k and ofono from the repo. The modem is recognised with a little help from usb-modeswitch, but ofono doesn’t seem to see it ie nothing returned by list-modems (from ofono-scripts package). Trying to turn on debugging for connman and ofono but the instructions at the Ubuntu wiki are out of date. What am I missing?

I’m assuming once ofono knows the modem is there, connman will list it as a technology (currently only p2p, wired, wireless, BT)

That’s correct.

Perhaps the ofono in the Debian repository is too old; or a kernel module is needed for the modem to work properly. I don’t know a lot about USB modems and how they work under Linux