Forcing Bluetooth on at start-up.

A question I’ve been meaning to get around to asking, but how do I FORCE my built-in bluetooth adapter to come on at start-up of Ubuntu?

It will start-up automatically whilst in the POST boot process, but once Ubuntu has loaded it will turn itself off, and stayed turned off until I press the button to enable it again, something tells me there’s a script of some sort that just needs tweaking.

I’ve googled for the same exact question, but it’s all for “audio” devices, not keyboards or mice, which is the reason I’m asking this question.

This sounds like it’s being disabled in hardware, maybe by the BIOS … is there any setting in the BIOS for bluetooth ?

What was the make/model of your laptop again ?

Which distro/version ?

Can you run:

dmesg > ~/dmesg.txt

then attach the file called dmesg.txt from your home directory to your next post.

Nope no settings in the BIOS. It’s a mini-PCI Express card, I opened the laptop not to long ago to give it a clean out.

Laptop is a Acer Aspire 6920g running Ubuntu 12.04 :slight_smile:

Dmesg file

just as a matter of interest, after a reboot, and without manually turning BT on … what is listed by:
rfkill list

and what happens if you run:

rfkill unblock all
sudo service bluetooth restart

What is the key combo to turn it on ?

How soon after the POST does the bluetooth light go out ?

Has bluetooth ALWAYS behaved like this in Linux ? … how about Windows ?

I’ll find out for you, laptop needs restarting anyway, it’s been on for 3 days straight.

Yeah bluetooth has always behaved this way in both Windows & Linux, so it’s not an “issue” really… more a niggle I’m trying to sort.

Combo key for bluetooth is actually a dedicated bluetooth button on the side, as shown here:

http://farm8.staticflickr.com/7079/7181531495_a8bd115f3c_z_d.jpg

Laptop in the photo is actually mine btw.

The minute you get to the Ubuntu bootscreen it goes off around 3/4 seconds into it.

Laptop in the photo is actually mine btw.

a) Which laptop … you can only see a sliver of it
and
b) I’m glad it’s yours because youve painted red stripes all over it
and
c) Aint your mom gonna go mad at you writing Wifi, Firefox, Thunderbird, and Bluetooth on the sheets :slight_smile:

I doubt if this is “fixable” … if it’s doing it that early on, and did it in Windows too … it’s likely a hardware “feature”.

If you check the internet, a LOT of people were complaining that the default for Acer Aspires seemed to be to turn bluetooth on at bootup, but people didn’t like that as it harms battery life … so maybe Acer turned em off by default.

If it were a key combo, we may have been able to write a script that ran those keystrokes at boot … but as it’s a separate hardware switch, I doubt if it will register as a keypress in the normal way.

Well I’m pretty sure the switches are configurable, as I’m able to use the “web” button to open up Nautilus. Infact I’ll go check it out!

EDIT: Good news, it’s configurable. :slight_smile:

It turns on bluetooth. (WOW!)

So now you just need to automate that :wink:

ahem With your scripting skills… cough.

I’ll type sommat up tomorrow … in the middle of sommat ATM :slight_smile:

Okey dokey :slight_smile:

If you don’t mind having a (hidden) script in your home directory that has your password in it:-

gedit ~/.bluetooth-startup.sh

Make it read:

#!/bin/sh rfkill unblock all echo "" | sudo -S service bluetooth restart

Obviously you need to replace <your_password> with YOUR password (quotation marks stay in)

Save the file.

Make it executable with:

chmod +x ~/.bluetooth-startup.sh

Now use Ubuntu’s startup applications editor to autorun /home//.bluetooth-startup.sh as a command.

Couldn’t we add this to the localrc/init file so that it’s available on startup of Ubuntu?

Question … are they BOTH necessary ?

or will:

sudo service bluetooth restart

work on its own ?

In answer to your question … I don’t know … adding the original commands (obviously leaving out sudo) to the runlevel init scripts, or rc.local may run it too early.

But you can try if you like :slight_smile:


Just a thought, but you haven’t got bluetooth blacklisted have you ?

Both are not necessary, no.

I guess I can only run it, and find out, right? Ha.

How would I know if bluetooth was blacklisted?

EDIT:

rfkill list
bally@bally-laptop:~$ rfkill list 0: acer-wireless: Wireless LAN Soft blocked: no Hard blocked: no 1: acer-bluetooth: Bluetooth Soft blocked: no Hard blocked: no 3: phy0: Wireless LAN Soft blocked: no Hard blocked: no 9: hci0: Bluetooth Soft blocked: no Hard blocked: no

Just double checking before I go ahead and save this, this is all correct (well apart from my password ;))

NOPE … anything run from rc.local is run AS ROOT anyway, so no need to SUDO

rfkill unblock all service bluetooth restart

exit 0

but if as you said you don’t need the rfkill comand

service bluetooth restart

exit 0

will do … but as I said, it may not work.


Did YOU uncomment that 3rd line

rc.local

or was it already like that ?

T’was already uncomment, removing sudo, will try this. Will be amazed if it works.

OK, just to be clear on this … here’s MY default /etc/rc.local

#!/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.

exit 0

so your’s would need to read:

#!/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.

Added by BkS

service bluetooth restart

exit 0

I posted this because I’m sure that 3rd line shouldn’t be uncommented, and you’d added a second shebang line.