We have moved to a new Sailfish OS Forum. Please start new discussions there.

Use terminal to turn on network

asked 2014-01-25 16:05:32 +0300

plaristote gravatar image

updated 2014-01-25 19:47:38 +0300

Hey !

For some reason (3G stops working after reboot), I'd like to try to turn on a network from the terminal.

I've been able to turn the interface on, but I haven't been able to get an IP. This is where I am now:

    $ devel-su
    $ ifconfig rmnet0 up
    $ # Looking for an ip here ?

I've found someone doing something similar on Android: http://stackoverflow.com/questions/11326645/use-ifconfig-to-turn-on-network-in-android-but-it-doesnt-work. He solved this problem by using netcfg, which isn't what Jolla uses (neither that or netctl for that matter).

Does someone know what I should use ?

EDIT: I found out about connman. I haven't found a lot of documentation about how to interact with connman from the cli, and this seemed like the only thing I could do:

  $ connmand -i rmnet0 -d -n
  Name already in use

I'm almost certain connman is the guy handling this, but I'm starting to think maybe connmand isn't the command I need. I installed the connman-test package, which I figured is probably the one containing the tools I seek. But I haven't been able to set up any connexion with the commands the package provides.

edit retag flag offensive close delete


Install connman-tools and then run /usr/bin/connmanctl

If you need wlan you'll need to enable agent

run connmanctl and then type help.

llornkcor ( 2015-11-09 05:48:07 +0300 )edit

2 Answers

Sort by » oldest newest most voted

answered 2014-01-30 02:08:19 +0300

Philippe De Swert gravatar image

updated 2014-01-30 02:13:23 +0300

You can use connman, but the DBUS api to do so is rather painful. You need to devel-su first.

Then you need to figure out the cellular connection

#  dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Manager.GetServices | grep cellular.

This will give you output that looks like this:

      object path "/net/connman/service/cellular_244915471972882_context1"
          variant                   string "cellular"

You now need that object path in the following command

# dbus-send --system --type=method_call --print-reply --dest=net.connman /net/connman/service/cellular_244915471972882_context1 net.connman.Service.Connect

Replace the cellular object path by the one you got in the previous command.

edit flag offensive delete publish link more


Thanks ! That looks like the way to go ! Though I'd be very grateful for some advice on where to look next, because the first command doesn't return any result (skipping the grep, I just get an empty array). The cellular service doesn't exist anymore, though the device still show in ip link show.

plaristote ( 2014-02-02 02:28:21 +0300 )edit

On Sailfish 2.0 this does activate mobile data, but on the "events" page the "mobile data" icon doesn't light up... Is there something to restart to make Jolla acknowledge the change in the UI too?

Joril ( 2015-11-08 17:29:03 +0300 )edit

answered 2014-01-25 22:54:57 +0300

sledges gravatar image


pkcon install connman-test

It's a set of scripts to control it, connecting to wifi is pretty straightforward: https://wiki.merproject.org/wiki/Minimal/Networking

Also tethering is done with it as well: http://elinux.org/Jolla#How_do_I_enable_WiFi_tethering.3F

I haven't found a script which enables 3G, but I'm sure it's out there :)

Have fun!

edit flag offensive delete publish link more


Thanks ! Unfortunately, none of the commands worked. I'll try the configuration file and see what gives, but the Wifi doesn't seem to work on my Jolla (haven't been able to connect to anything, not in, not on 1.0.2.x: it just scans for netwroks, it doesn't connect).

plaristote ( 2014-01-26 00:11:16 +0300 )edit

Does wifi tethering (Portable Wi-Fi Hotspot) work out of interest (see second link)? - it would create it's own AP, and that's something I can confirm tested and working on Jolla. Surely, you can test tethering only if you can enable 3G again via UI (your original problem says "3G stops working after reboot")

sledges ( 2014-01-26 00:14:59 +0300 )edit

The Wifi configuration works, but the connection fails. Dmesg logs seems to point at an authentication failure, but the ids are definitely correct. Tethering worked, but my computer couldn't connect. And 3G actually went down again: connman-test service shows that the cellular service disappeared.

plaristote ( 2014-01-26 01:24:06 +0300 )edit

To issue an IP address request for a manually brought up 3G connection, use:

udhcpc -i rmnet0

(following the logic from the android link you gave in the post)

sledges ( 2014-01-26 01:44:42 +0300 )edit

Thanks ! Though I wasn't able to find in which package udhcpc was included ? It's not present by default on my system.

plaristote ( 2014-01-26 11:54:47 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2014-01-25 16:05:32 +0300

Seen: 2,219 times

Last updated: Jan 30 '14