27

Ubuntu 13.04 64 bits, on ELiteBook 8740, gnome desktop with bluetooth-applet shown.

I could not figure out how to turn on and off from shell the Bluetooth and not from the notification bt applet menu. I need to turn on the service and the thing from menu from shell or C.

service bluetooth start/stop has noting to do with the applet button menu item because here are the scenarios I can see.

  1. 1.

service off,

menu item from applet is off (shows turn on)

bt-device --list  yields  bluez service is not found
  1. 2.

service on, (sudo service bluetooth start)

menu item from applet is off (shows turn on)

bt-device --list  yields  rg.bluez.Error.NoSuchAdapter: No such adapter
  1. 3.

service on,

menu item from applet is on (shows turn off)

bt-device --list  yields

Added devices:
HMDX JAM (36:8F:E8:07:B2:CA)
Mint Speaker (5BA5) (01:19:53:4C:5B:A5)
  1. 4.

service off,

menu item from applet is on (shows turn off)

bt-device --list  yields  
bluez service is not found

I want to be able to turn on and off the Bluetooth as is being done from the applet button.

How can I do this ?

29

The commands you're looking for are:

rfkill block bluetooth

and

rfkill unblock bluetooth
  • Great find! I needed to always use toggle for bluetooth – Anwar Nov 13 '16 at 13:18
12

To stop :

sudo /etc/init.d/bluetooth stop

To start :

sudo /etc/init.d/bluetooth start

To restart :

sudo /etc/init.d/bluetooth restart
  • 5
    The use of service is preferred over /etc /init.d/, but this works as well. – Gerhard Burger Nov 23 '13 at 21:15
  • this is not correct. turning off bluetooth and stopping the service are different things (most notably, the latter requires sudo permissions). – Marcus Oct 7 '16 at 19:57
3

On Ubuntu 15.04 and later

systemctl start bluetooth.service

for turning on Bluetooth

systemctl stop bluetooth.service

for turning off Bluetooth

systemctl restart bluetooth.service

for restarting Bluetooth

  • werewolf_65 - FYI you can omit .service because it is assumed if there is no extension (and who likes typing) – Zanna Dec 31 '17 at 10:24
  • @Zanna alright. Now it is clearer, should have considered to edit the answer like you did... – Thomas Dec 31 '17 at 10:26
0

What worked for me was:

  1. Go to http://en.archive.ubuntu.com/ubuntu/pool/universe/b/bluez-tools/

  2. Select your compatible version

  3. Install it manually

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.