2

I recently installed Ubuntu 16.04 MATE on my Thinkpad X240. In order to disable the automatic start of bluetooth, I did the following:

Attempt 1: sudo pluma /etc/rc.local, then add the line rfkill block bluetooth above exit 0. However, when I restarted bluetooth was still activated. So I again edited the file and removed the line I had added.

I later followed the suggestions here, and repeated attempt 1 with adding also echo disable > /proc/acpi/ibm/bluetooth, but that didn't do the trick as well

Attempt 2: Following the description here (in German), I created a file /lib/systemd/system/disablebluetooth.service with the content:

#########################################################################
#
# disablebluetooth.service
# systemd service: disable bluetooth at start
#
#########################################################################

[Unit]
Description=Disable Bluetooth

[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill block bluetooth

[Install]
WantedBy=multi-user.target

# EOF

and then ran sudo systemctl enable disablebluetooth.service

This also did not help, bluetooth still automatically started on startup.

However, this then, Ubuntu also reports a problem on the system startup (and a dialogue opens in which I can click cancel, or report problem). [EDIT: fixed now]

So, to undo attempt 2, I ran
sudo systemctl disable disablebluetooth.service and deleted the file I had created.

But the warning/problem report at startup still shows up. So now, my questions are

  1. How can I find out details about the problem report plopping up at the system startup, and how can I get rid of it? EDIT: Apparently, that warning was only the result of some earlier problems, I was able to remove it by clearing /var/crash/* (or something like that)
  2. How do I disable the autostart of bluetooth?

lsusb returns

Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 5986:0268 Acer, Inc 
Bus 002 Device 006: ID 8087:07dc Intel Corp. 
Bus 002 Device 002: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Please edit the question to include the warning/problem report. Also include results for lsusb – Jeremy31 Jan 24 '17 at 23:12
  • @Jeremy31 See edits regarding warnings. I will include results for lsusb this evening when I have access to the computer again – user3825755 Jan 25 '17 at 8:34
  • @Jeremy31 I added the lsusb results, not sure if that helps though – user3825755 Jan 25 '17 at 18:13
0

We can still use a udev rule to disable bluetooth. Start by

sudo -H pluma /etc/udev/rules.d/81-bluetooth-hci.rules

Enter the following as one line

SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="07dc", ATTR{authorized}="0"

Save, exit editor, and reboot.

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.