For those rarely use Bluetooth, here’s how to turn it off and prevent from automatically starting at login in Linux.
I very rarely connects my phone or headphones to Linux laptop using the Bluetooth service. However, it starts automatically at login in Ubuntu 20.04, Ubuntu 21.10, Debian 11 and Fedora 35 systems that I’ve tried out.
If you’re in the same situation, then this tutorial may help to disable Bluetooth from auto-enable when your PC does not have a physical button to toggle the function.
Option 1: Disable Bluetooth Auto-Enable Behavior via Configure file:
In all the 3 Linux distributions mentioned above, there’s a rule in “/etc/bluetooth/main.conf” file that tells to auto-enable Bluetooth on startup. User may simply edit the file and disable that line to do the job.
1. Firstly, search for and open ‘terminal’ from ‘Activities’ overview (or start menu depends on desktop environment).
2. Secondly, run command in terminal to edit the configuration file via nano text editor.
sudo nano /etc/bluetooth/main.conf
Here I use nano since it's universal in most Linux. You may replace it with your favorite editor, e.g., gedit for GNOME.
When the file opens, find out and change AutoEnable=true into AutoEnable=false. Finally, save the file by pressing “Ctrl+X”, type “y” and hit Enter.
For those using “Blueman” manager, there’s an option under “View -> Plugin -> PowerManager” to toggle auto power-on under configuration.
Option 2: Disable Bluetooth by running a command at login:
The previous method somehow may not work sometimes due to unknown reason. So, there’s a workaround by running
rfkill block bluetooth command automatically at login.
Firstly, search for and open ‘Startup Applications’ utility from activities overview.
Next, click ‘Add‘ to add a new startup program, then type in:
- Name: Turn off Bluetooth (or whatever as you prefer)
- Command: /usr/sbin/rfkill block bluetooth
- Comment: optional.
Option 3: Disable & Mask Bluetooth system service:
The option 2 should work in most cases including mine. Though user may also disable the system service for using Bluetooth.
To do so, first open terminal from start menu (‘Activities’ overview) and run following commands one by one.
1. Stop the Bluetooth service using command:
systemctl stop bluetooth.service
2. Disable the service so it won’t start automatically at next login using command:
sudo systemctl disable bluetooth.service
3. And user may mask the service to stop other processes from starting the service:
sudo systemctl mask bluetooth.service
(Optional) Restore Bluetooth service:
Disable the system service makes it impossible to use Bluethooth again. In case you want to re-enable it, run commands below one by one:
- First, unmask the service:
sudo systemctl unmask bluetooth.service
- Then, re-enable it:
sudo systemctl enable bluetooth.service
- And finally start the system service:
sudo systemctl start bluetooth.service
To disable the Bluetooth auto-enable behavior, changing the configuration rule via option 1 is the recommended method in my own opinion though it’s not working in some cases. Mask the system service works however the Bluetooth status (off) is still present in system tray menu. And, user has to run a few commands again when want to restore. In my case, I did the option 2 to run a startup command automatically to turn it off.