How to have bluetooth disabled per default?

Solution 1:

gedit /etc/bluetooth/main.conf

and set this:

AutoEnable = false

A more radical way is to either stop the bluetooth service

sudo systemctl stop bluetooth.service

Or even more radical is to disable it permantly

sudo systemctl disable bluetooth

Solution 2:

Here is how you can create a script that will run on startup and perform an action to kill the Bluetooth service, and that would be the following (I use nano, feel free to use any other text editor):

Step 1: Navigate to the folder:

cd /etc/systemd/system/

Step 2: First create a script that will kill the Bluetooth service once run:

nano bluetoothkill.sh

Step 3: Enter the following code, save and exit:

#!/bin/bash
rfkill block bluetooth
exit 0

Step 4: Create a foo.service file in the same folder /etc/systemd/system/ :

nano foo.service

Step 5: Enter the following code, save and exit:

[Unit]
Details=Additional startup scripts
After=network.target

[Service]
ExecStart=/etc/systemd/system/bluetoothkill.sh

[Install]
WantedBy=default.target

Step 6: Run the following command in the terminal:

sudo chmod 744 bluetoothkill.sh

Step 7: Run the following command in the terminal:

sudo systemctl start foo.service

Step 8: Restart the machine and on the next boot you will notice that the Bluetooth service is no longer enabled by default on startup. You can still enable it when ever you like in the settings, or the terminal it is behaving without any errors.

If you like to add more scripts on startup, you can always edit the foo.service file and add additional lines under the [Service] bracket to run additional scripts on startup, for example:

ExecStart=/full-script-filepath/newscript.sh