5

I am using Ubuntu 18.04 on Dell XPS-13 and every time the laptop starts bluetooth is enabled and you have to disable it manual. But i am using it not very often.

Therefore: is it possible to have bluetooth disabled by default? (i know about the tweak in the rc.local file but since Ubuntu 14.04 the rc.local does not exist and is not used anymore)

  • Have you tried turning off Bluetooth in Settings? I've done that and the setting is retained after shutdown and reboot – Broadsworde May 11 '18 at 17:59
  • Please clarify. Your title makes it sound like you want to disable bluetooth by default, but then you ask "is it possible to have bluetooth enabled by default? " Several of us can't understand what your problem is due to this Please edit your post to provide further clarity. Thank you for helpin us help you! – Elder Geek May 11 '18 at 22:52
  • This is a well known bug. – Pilot6 May 14 '18 at 14:16
  • Im sorry for the confusion between enabled and disabled, i corrected that. @Broadsworde if i turn bluetooth off in the settings it is enabled after a restart. – J.Doe May 14 '18 at 14:40
  • 2
    Possible duplicate of How can I deactivate Bluetooth on system startup? – Fabby May 14 '18 at 15:54
7
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
  • +1 because this ended up in the LQ queue for some or other reason... – Fabby May 14 '18 at 15:41
  • I tried the first solution and disabled bluetooth in the settings if i than reboot my laptop bluetooth is again enabled. But i do not want to disable bluetooth permanently just do not have it enabled by default on start. – J.Doe May 16 '18 at 7:13
  • Look at the duplicate mentioned in the comments @J.Doe – Fabby May 16 '18 at 10:40
  • @J.Doe the edit is still there in /etc/bluetooth/main.conf? Can you show the status of bluetooth.service in the question? And maybe main.conf too? On my 18.04 BT is disabled and stays disabled and I used the settings to do this. – Rinzwind May 16 '18 at 14:49
  • @Rinzwind yes the edit was/is still in the main.conf But "sudo systemctl disable bluetooth" worked and i can still activate bluetooth with the settings if i want to. Thank you – J.Doe May 18 '18 at 8:55
0

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

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.