76

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 four scenarios I can see.

  1. Service off, menu item from applet is off (shows turn on)

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

  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

  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)
    
  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?

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
user2195463
  • 871
  • 1
  • 7
  • 6

7 Answers7

100

The commands you're looking for are:

rfkill block bluetooth

and

rfkill unblock bluetooth
Marcus
  • 2,315
  • 4
  • 23
  • 28
  • 3
    Great find! I needed to always use toggle for bluetooth – Anwar Nov 13 '16 at 13:18
  • 3
    thanks Marcus, this unstuck my BT on 18.04! saved me a reboot – secretAgent Feb 10 '20 at 13:10
  • Thank you so much! it is the only workaround for my touchpad-problem that works for me. – graceman9 Mar 10 '20 at 01:01
  • Also works on 20.04, and seems better than stopping / starting the bluetooth service – mivk Jul 28 '21 at 10:00
  • Thank you, works on Pop_OS! 22.04. My trackpad was someone turned off - happened only when I am not logged in, otherwise the trackpad worked when I was logged out. After executing your commands I managed to get a hold of my blue tooth mouse and go into the settings to enable the trackpad. – George Smith Jan 30 '23 at 11:06
32

To stop :

sudo /etc/init.d/bluetooth stop

To start :

sudo /etc/init.d/bluetooth start

To restart :

sudo /etc/init.d/bluetooth restart
Anwar
  • 75,875
  • 31
  • 191
  • 309
Chester
  • 1,068
  • 7
  • 14
  • 8
    The use of `service` is preferred over `/etc /init.d/`, but this works as well. – Gerhard Burger Nov 23 '13 at 21:15
  • 1
    this is not correct. turning off bluetooth and stopping the service are different things (most notably, the latter requires sudo permissions). – Marcus Oct 07 '16 at 19:57
22

On systems that use systemd, including Ubuntu 15.04 and later:

systemctl start bluetooth

for turning on Bluetooth

systemctl stop bluetooth

for turning off Bluetooth

systemctl restart bluetooth

for restarting Bluetooth

moonshadowolf13
  • 331
  • 2
  • 6
  • 1
    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
  • 1
    @Zanna alright. Now it is clearer, should have considered to edit the answer like you did... – Thomas Dec 31 '17 at 10:26
  • 1
    I also discovered that I had too reboot, as there was some state info that wasn't reset without that. Now all is working properly - I hope this helps others. Beware of attempting to turn on bluetooth through Settings. And when working with keyboard/mouse that used a 2.4 Ghz dongle, I needed the bluttooth on, even though I would have thought that as being irrelevant. – JoelParke Apr 23 '21 at 20:54
3

Try this, it worked for me: From: bluetooth keeps turning off in 19.04 after physically and manually turning off bluetooth device, any fix to this?

$ sudo rmmod btusb
$ sudo modprobe btusb
nirala
  • 176
  • 4
  • 1
    The only working solution for me. The problem happened after a power failure. No other solution worked for me. But this one turned on my bluetooth like a charm. – ar2015 Oct 22 '22 at 13:32
2

I know this is a quite old question.

service

command worked for me.

To stop the service -

service bluetooth stop

To start the service -

service bluetooth start

  • Hi Mitesh. How is your answer better/different from the others? Great you want to contribute though. I recommend you to add this as a comment under existing similar answers, as it is already answered very similarly previously :) – denNorske Sep 11 '21 at 20:15
  • This answer represents an alternative to "sudo /etc/init.d/bluetooth stop" as mentioned in the comments of the above answer. – zx485 Sep 11 '21 at 22:51
2

If you have tlp installed you can use:

$ bluetooth on  # To start 
$ bluetooth off # To stop

To install TLP:

$ sudo apt install tlp
Grammargeek
  • 2,762
  • 2
  • 14
  • 24
arrazicode
  • 21
  • 1
0

What worked for me was to install bluez:

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

  2. Select your compatible version

  3. Install it manually

Zanna
  • 69,223
  • 56
  • 216
  • 327
noname
  • 1
  • 1
    Installing extra SW to achieve something built-in is never a good idea and leads to hellish problems down the road. If systemctl stop doesn't work then there are other issues. https://askubuntu.com/a/990973/232407 – RichieHH May 14 '21 at 07:09