Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: how to disable bluetooth on startup?

  1. #1
    Join Date
    Aug 2018
    Beans
    2

    Question how to disable bluetooth on startup?

    hello community

    When I start my lubuntu (ubuntu 18.04.1 lts) I always have to manually turn off the bluetooth connection.
    Is there a way to turn it off completely, so that it doesn't start again?

    I couldn't find a working solution in the internet.
    Maybe you could help.

    best regards,
    loewenblum

  2. #2
    Join Date
    Aug 2013
    Beans
    75
    Distro
    Lubuntu

    Re: how to disable bluetooth on startup?

    Code:
    sudo systemctl disable bluetooth --now
    Budgie and loving it.

  3. #3
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: how to disable bluetooth on startup?

    To go along with aromo2's suggestion: to deactivate bluetooth on startup run this
    Code:
    sudo systemctl disable bluetooth.service
    then on next reboot bluetooth will not be active ... to view status issue
    Code:
    sudo systemctl status bluetooth.service
    to activate bluetooth on startup run this
    Code:
    sudo systemctl enable bluetooth.service
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  4. #4
    Join Date
    Aug 2018
    Beans
    2

    Re: how to disable bluetooth on startup?

    thank you, it works!

  5. #5
    Join Date
    Sep 2018
    Beans
    1

    Re: how to disable bluetooth on startup?

    Hi there,

    For me it didn't work just to disable bluetooth with the following code:
    Code:
    sudo systemctl disable bluetooth.service
    , because after a restart, bluetooth was enabled again.

    I found and alternative solution, and that would be the following (I use nano, feel free to use any other text editor):

    Step 1:
    Navigate to the folder:
    Code:
    /etc/systemd/system/
    Step 2:
    First create a script that will kill the bluetooth service once run:
    Code:
    nano bluetoothkill.sh
    Step 3:
    Instert the following script:
    Code:
    #!/bin/bash
    rfkill block bluetooth
    exit 0
    Step 4:
    Create a foo.service file in the same folder
    Code:
    /etc/systemd/system/
    :
    Code:
    nano foo.service


    Step 5:
    Insert the following script:
    Code:
    [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:
    Code:
    sudo systemctl start foo.service
    Step 7:
    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
    Code:
    foo.service
    file and add additional lines under the [Service] bracket to run additional scripts on startup, for example:
    Code:
    ExecStart=/full-script-filepath/newscript.sh

  6. #6
    Join Date
    Aug 2011
    Beans
    2

    Re: how to disable bluetooth on startup?

    Thanks, works great

  7. #7
    Join Date
    Aug 2011
    Location
    Berlin, Germany
    Beans
    7,970
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: how to disable bluetooth on startup?

    Why not simply blacklisting the BT driver instead of deeply manipulating the system?!

  8. #8
    Join Date
    Oct 2006
    Beans
    70
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: how to disable bluetooth on startup?

    This is like laslozr's suggestion, but with less steps.

    Using sudo, open this file in your favourite text editor: /etc/rc.local

    Below the commented out text (lines starting with #) and above the line that has "exit 0", add the following:

    Code:
    rfkill block bluetooth
    If you haven't edited this file before, then it should look like this after your change:

    Code:
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    rfkill block bluetooth
    exit 0
    Save and then reboot.

    To re-enable Bluetooth, you just flip the switch in Settings or in the Status Area dropdown. This way there's no need for sudo commands in the terminal to use Bluetooth when you need it. The above just turns off Bluetooth's state on start-up, but allows you to re-enable it. This has worked for me in 16.04 and 18.04.
    Last edited by Qew; October 6th, 2018 at 03:55 PM.

  9. #9
    Join Date
    Dec 2018
    Beans
    1

    Re: how to disable bluetooth on startup?

    Your solution worked with me, with a tweak. I have Ubuntu 18.04 LTS and there is no etc/rc.local file or folder. However, there is a Bluetooth folder in etc. Inside there is input.conf file. I wrote there the code at the end, like this:

    Code:
    # Configuration file for the input service
    
    # This section contains options which are not specific to any
    # particular interface
    [General]
    
    
    # Set idle timeout (in minutes) before the connection will
    # be disconnect (defaults to 0 for no timeout)
    #IdleTimeout=30
    
    
    # Enable HID protocol handling in userspace input profile
    # Defaults to false (HIDP handled in HIDP kernel module)
    #UserspaceHID=true
    
    
    rfkill block bluetooth
    exit 0
    And bluetooth is turned off at start-up and can be turned on from settings.

  10. #10
    Join Date
    Oct 2006
    Beans
    70
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: how to disable bluetooth on startup?

    Good that you got it working. Mind you, I'm not sure you need the "exit 0" at the end, as that file isn't a script, it's just a conf file.

    Also, I learnt that 18.04 LTS doesn't come with /etc/rc.local now, but I also learnt that if you add /etc/rc.local, make it executable, and add "#!/bin/sh -e" on the first line and "exit 0" on the last, then it'll work as I mentioned above. It came with 16.04, which I upgraded from to 18.04, hence why I've still got it and it works for me. I didn't know that rc.local isn't in use by default in 18.04, so good to learn something new. Cheers!

    More info here (this is for 16.10, but works for 18.04): https://askubuntu.com/questions/8866...n-ubuntu-16-10
    Last edited by Qew; December 16th, 2018 at 04:40 AM.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •