11

I'm trying to disable the bluetooth at boot, without blacklisting the kernel module.

I commented the following two lines in the /etc/init/bluetooth.conf:

start on started dbus
stop on stopping dbus

Then I added:

stop on runlevel [0123456]


In the file /etc/init.d/bluetooth, wright before the exit 0, I added the line:

rfkill block bluetooth

None of those try succeeded.


I saw on the Internet to add the last command in the /etc/rc.local file. But instead of this file, I've got rc0.d to rc6.d and rcS.d folders, full of symbolic links to scripts.


I'm running under Ubuntu-Mate 17.04, with the 4.10.0 kernel.

1
  • 1
    Have you tried using systemd? e.g. systemctl disable bluetooth.service – Christopher Díaz Riveros Aug 21 '17 at 23:54
12

Just in case someone else needs the answer ;)

If the user is running systemd (default in many distros) the service can be disabled with

systemctl disable bluetooth.service

8

The suggested solution completely disables bluetooth till the service is (re)started. Since this answer comes up prominently in searches I post an alternative for another case:

In case you want to disable BT temporarily only on startup, your problem is probably that the blueman-applet enables bluetooth at startup due to a relatively hidden setting. If that's your issue then simply run (from https://askubuntu.com/a/923539/244648):

gsettings set org.blueman.plugins.powermanager auto-power-on false

or go into the plugins settings of the applet/PowerManager/Configuration and tick off Auto power-on.

3
  • Doesn't work on Ubuntu 20.04. Says No such schema “org.blueman.plugins.powermanager” – Ali Tou Sep 18 '20 at 9:01
  • if gsettings list-schemas | grep blue does not show any results this answer does not apply to your environment at all. It's also possible that they have changed the path/name. In that case the output above might help figure that out or you can use the GUI path I described as well. – stefanct Sep 19 '20 at 10:12
  • Disabling blueman/bluetooth applet Auto power-on will prevent it to enable bluetooth radio if it was previously disabled when the applet is starting (usually when logging in). Mine was already enabled just after booting, so I used tlp to manage bluetooth state (enabled or not) when computer is booting and voilà! See /etc/tlp.conf if it is installed on your computer. – Totor Nov 30 '20 at 17:48
7

to deactivate bluetooth on startup issue this

sudo systemctl disable bluetooth.service

then on next reboot bluetooth will not be active ... to view status issue

sudo systemctl status bluetooth.service

to activate bluetooth on startup issue this

sudo systemctl enable bluetooth.service
3

Edit the bluetooth configuration file and set AutoEnable to false to disable bluetooth on boot.

sudo gedit /etc/bluetooth/main.conf

At the end of the file

AutoEnable=false

1

A couple more solutions!


RFKILL

rfkill was merged into the linux kernel in 2.6 and is a simple way to manage wireless devices.

For example, view wireless devices by calling rfkill with no arguments:

cat@rt~ $ rfkill
ID TYPE      DEVICE      SOFT      HARD
 0 wlan      phy0   unblocked unblocked
 1 bluetooth hci0     blocked unblocked

Then (with sudo/root) block the devices rfkill block $TYPE:

cat@rt~ $ sudo rfkill block bluetooth
cat@rt~ $ sudo rfkill block wlan

Now check their new status with rfkill again:

cat@rt~ $ rfkill
ID TYPE      DEVICE    SOFT      HARD
 0 wlan      phy0   blocked unblocked
 1 bluetooth hci0   blocked unblocked

Note the devices I disabled are listed blocked under SOFT but not HARD. This means we've disabled the device through software (and can re-enable the device through software).

A HARD blocked device indicates the wireless device was hardware blocked. This could be a hardware kill switch (some laptops have a switch to toggle wireless off), or the device may be disabled by bios, or possibly doesn't have a driver for the software to interact with it (double-check me on that last one though).


modprobe

You may instead want to tell your kernel not to load the driver for these wireless devices at all. This means your OS and kernel won't know how to interface with these devices and they will remain unpowered.

First, check what kernel modules are currently loaded with lsmod:

cat@rt~ $ sudo lsmod
Module                  Size  Used by
btusb                  57344  0
btrtl                  20480  1 btusb
btbcm                  16384  1 btusb
btintel                28672  1 btusb
bluetooth             577536  5 btrtl,btintel,btbcm,btusb
ecdh_generic           16384  1 bluetooth
ecc                    32768  1 ecdh_generic
[...]

This is just what my machine has loaded. Yours may look different, or even be using different drivers.

We can see on my machine there's several bluetooth drivers running. btusb, btrtl, btbcm, btintel, and bluetooth.

btusb is the generic driver that each of the other modules relies on. It should be sufficient just to unload btusb, but since I know the others aren't going to be used either, I like to be thorough and make sure none of these drivers load.

We will do this with modprobe by telling its configuration file to ignore these kernel modules with the blacklist command. This will go in /etc/modprobe.conf[^1].

If this file doesn't exist for you, don't worry, you can simply create the file and edit it. If it exists already, just append these lines to the bottom.

cat@rt~ $ sudo vim /etc/modprobe.conf

# In the editor vim, I added these lines to the bottom of the file:
blacklist btusb
blacklist btrtl
blacklist btbcm
blacklist btintel
blacklist bluetooth

This won't take effect until your next reboot. At startup, modprobe will use this file to know more about what kernel modules to load, and when it sees the blacklist commands in this file, it will know to ignore modules with those names.


Footnotes

[^1]: You can define this either in /etc/modprobe.conf, or if you prefer, you can use the directory /etc/modprobe.d/ and place a number of files within it ending in .conf, all of which will be read and used.

0

I use TLP;

you can edit the configuration file in order to disable bluetooth at boot, by adding this line:

DEVICES_TO_DISABLE_ON_STARTUP="bluetooth"
0

On debian/kali please check following:

in /etc/default/bluetooth BLUETOOTH_ENABLED=0

in /etc/bluetooth/main.conf AutoEnable=false

and if you have blueman-applet, check it's plugin PowerManager settings

1

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.