80

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?

7 Answers 7

107

The commands you're looking for are:

rfkill block bluetooth

and

rfkill unblock bluetooth

To toggle on/off:

rfkill toggle bluetooth
6
  • 4
    Great find! I needed to always use toggle for bluetooth
    – Anwar
    Nov 13, 2016 at 13:18
  • 4
    thanks Marcus, this unstuck my BT on 18.04! saved me a reboot Feb 10, 2020 at 13:10
  • Thank you so much! it is the only workaround for my touchpad-problem that works for me.
    – graceman9
    Mar 10, 2020 at 1:01
  • 1
    Also works on 20.04, and seems better than stopping / starting the bluetooth service
    – mivk
    Jul 28, 2021 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. Jan 30, 2023 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
2
  • 8
    The use of service is preferred over /etc /init.d/, but this works as well. Nov 23, 2013 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 7, 2016 at 19:57
25

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

3
  • 1
    werewolf_65 - FYI you can omit .service because it is assumed if there is no extension (and who likes typing)
    – Zanna
    Dec 31, 2017 at 10:24
  • 1
    @Zanna alright. Now it is clearer, should have considered to edit the answer like you did...
    – Thomas
    Dec 31, 2017 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, 2021 at 20:54
4

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
2
  • 2
    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, 2022 at 13:32
  • Same here! After a power outage..
    – SirOgm
    Sep 12, 2023 at 18:31
3

If you have tlp installed you can use:

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

To install TLP:

$ sudo apt install tlp
1
  • 1
    Did you try it yourself. there is no such command.
    – Pilot6
    Oct 16, 2022 at 8:17
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

2
  • 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, 2021 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, 2021 at 22:51
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

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. askubuntu.com/a/990973/232407
    – RichieHH
    May 14, 2021 at 7:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .