How do I permanently enable mobile broadband on boot?
Solution 1:
This problem is subject to a bug-report
Thus, until it is resolved upstream, a work around such as enabling mobile broadband on login will probably have to suffice.
Credit for the answer below goes to one of the bug contributors - if you have any additional information, add your details to the bug-report. Note - the subscribers dont like "me too" answers so dont just add "me too" - just click the subscribe button for updates.
Enable your broadband by clicking "enable broadband" in the network manager indicator.
In a terminal list the configured connections in your Network Manager:
nmcli con list
This show show the following example output:
NAME UUID TYPE TIMESTAMP-REAL
Tele2 Default 1 93c93207-adce-40e4-beb5-d9f9c830d474 gsm Sat 25 Feb 2012 01:27:42 PM CET
Vipnet connection 1 054bdd1f-34e3-4db1-b18b-d38e885276c8 gsm never
In the example look for your mobile broadband - it will have gsm
in the line of text. In the example above, the first item in a row contains the gsm
text and at the beginning of the line is the connection name that you will need below i.e. Tele2 Default 1
Now, create a text file (for example using gedit
) that starts one of your connections after a delay of e.g. 10 seconds (maybe you'll need a longer delay if your broadband device needs more time to initialize):
#!/bin/sh
sleep 10
nmcli nm wwan on
nmcli con up id "Tele2 Default 1"
i.e. change Tele2 Default 1
for your mobile broadband name
Save the file as start_my_connection
in your home folder.
Next move this file to somewhere you and others using your computer can access:
sudo mv ~/start_my_connection /usr/local/bin/start_my_connection
set the file permissions as follows:
sudo chmod 775 /usr/local/bin/start_my_connection
Finally, configure starting the script after login:
in Startup Applications Preferences add an item and enter the script path (/usr/local/bin/start_my_connection
) as the program command.
Solution 2:
I have another easy solution for this if anybody out there is still looking for it. In most of the cases, the mobile broadband connection, for example from above question "Airtel connection" is set to connect automatically.
So the only thing left to do is check "Enable Mobile Broadband" to make it connect. But we usually have to do it manually after every boot.
For this, we add a command to work at startup:
In a terminal,
sudo gedit /etc/rc.local
Now add this line above exit 0
(while :; do nmcli -t nm wwan on; sleep 1; done)&
Save the file and exit.
Thats it..
This not only starts up the connection but if connection drops, it reconnects
Solution 3:
The above response by @SriramKannan works perfectly. It did work after I restarted Ubuntu.
In a terminal,
sudo gedit /etc/rc.local
Now add this line above exit 0
(while :; do nmcli -t nm wwan on; sleep 1; done)&
Save the file and exit.
Solution 4:
Thanks to Brahim's answer above I have shortened the autostart script there as the following, and it works very well for me as I don't use jdownloader:
#!/bin/bash
while true; do
LC_ALL=C nmcli -t -f TYPE,STATE dev | grep -q "^gsm:disconnected$"
if [ $? -eq 0 ]; then
nmcli -t nm wwan on
sleep 10
fi
sleep 5
done