LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-10-2009, 06:09 PM   #1
jren
LQ Newbie
 
Registered: Feb 2009
Posts: 6

Rep: Reputation: 1
Question How to switch off the bluetooth when the system boots up?


Slackware 12.2. Thinkpad X200s.

I have recompiled the kernel 2.6.28.2 and all the bluetooth related drivers were turned off. Now the above messages do not appear in the dmesg. But the bluetooth still on, even if you turn it off from the Windows, once the system boots into linux, the bluetooth switch on. Looks like the slackware boot up scripts checked the hardware and "forgot" to switch it to what it was. Anyone knows what to do.

JR
 
Old 02-10-2009, 10:14 PM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Hi JR,

Use "chkconfig --list | grep bluetooth" to determine whether or not your system is starting bluetooth services in different runlevels. You want to see output like this:-
Code:
bluetooth       0:off   1:off   2:off   3:off   4:off   5:off   6:off
Which indicates bluetooth isn't started in any of the runlevels.

If it is on, and you want to turn it off, do this:-
Code:
chkconfig bluetooth off
Hope this helps
 
Old 02-11-2009, 01:36 AM   #3
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
Slackware doesn't have chkconfig.

Is /etc/rc.d/rc.bluetooth executable?
Does 'sh /etc/rc.d/rc.bluetooth stop' turn it off?
What does dmesg say about bluetooth?
 
Old 02-11-2009, 02:44 AM   #4
jren
LQ Newbie
 
Registered: Feb 2009
Posts: 6

Original Poster
Rep: Reputation: 1
Angry

Quote:
Originally Posted by Nille_kungen View Post
Slackware doesn't have chkconfig.

Is /etc/rc.d/rc.bluetooth executable?
Does 'sh /etc/rc.d/rc.bluetooth stop' turn it off?
What does dmesg say about bluetooth?


Before I recompiled the kernel, this what I had:

The /etc/rc.d/rc.bluetooth is already set non-executable. But when the system up, the following messages appear in dmesg:

Bluetooth: Core ver 2.13
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized

and then the bluetooth was initialized. I am wandering which start up script runs the "Bluetooth Core".

After the kernel was recompiled, the message disappears, but the bluetooth light still on. And you can check from Windows that the bluetooth was switched on. Even if you turn it off in Windows, once the system boot into Linux, the bluetooth is switched on again.
 
Old 02-11-2009, 04:06 AM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
This is a kernel message: "Bluetooth: Core ver 2.13"
The kernel is activating the bluetooth drivers during initial execution of kernel code. This happens long before the initscripts are run, so the /etc/rc.d/rc.buetooth script has nothing to do with that.
You probably need to either disable bluetooth completely in your kernel or compile it as a module and then blacklist the module so that it does not get automatically loaded.
 
Old 02-11-2009, 12:10 PM   #6
bl0tt0
Member
 
Registered: Aug 2005
Location: The Glorious People's Republic of Austin
Posts: 178

Rep: Reputation: 62
I was noticing the same thing on my thinkpad t42, and after a little googling, it turns out that as of the 2.6.27 kernel the bluetooth acpi interface has been superseded by the generic rfkill class (hence the inability to compile the thinkpad_acpi extras without rfkill enabled). unfortunately, this leads to bluetooth always being switched on when rfkill is loaded. I haven't found a way to fix it yet, but adding
Code:
 echo disabled > /proc/acpi/ibm/bluetooth
to rc.local will switch it off as the system is going multiuser. It's not ideal, but it'll do the trick until there's a better solution.
 
1 members found this post helpful.
Old 02-11-2009, 06:35 PM   #7
jren
LQ Newbie
 
Registered: Feb 2009
Posts: 6

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by bl0tt0 View Post
I was noticing the same thing on my thinkpad t42, and after a little googling, it turns out that as of the 2.6.27 kernel the bluetooth acpi interface has been superseded by the generic rfkill class (hence the inability to compile the thinkpad_acpi extras without rfkill enabled). unfortunately, this leads to bluetooth always being switched on when rfkill is loaded. I haven't found a way to fix it yet, but adding
Code:
 echo disabled > /proc/acpi/ibm/bluetooth
to rc.local will switch it off as the system is going multiuser. It's not ideal, but it'll do the trick until there's a better solution.


Thank you bl0tt0. It works! You know the bluetooth is a power consumer device and it bothered me for a while. Now the bluetooth light turns off.

JR
 
1 members found this post helpful.
Old 02-14-2009, 02:34 PM   #8
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
I got a little script to toogle bluetooth on/off on my t60 with Fn+F5.
I ripped out the bluetooth part from my acpi script here called /etc/acpi/thinkpad.sh thats why i got the case part.

Code:
#!bin/sh

bluetooth_toggle ()
{
BLUETOOTH_STATUS=`grep status /proc/acpi/ibm/bluetooth |sed 's/^.*[\t]//'`
if [ $BLUETOOTH_STATUS = enabled ]; then
  echo disabled > /proc/acpi/ibm/bluetooth
  if [ -x /etc/rc.d/rc.bluetooth ]; then /etc/rc.d/rc.bluetooth stop;fi
  #echo "Bluetooth off" | osd_cat -p bottom -A center -d 2 -s 3 -c blue -f "-*-lucidatypewriter-*-*-*-*-*-240-*-*-*-*-*-*" -l 3
elif [ $BLUETOOTH_STATUS = disabled ]; then
  echo enabled > /proc/acpi/ibm/bluetooth
  if [ -x /etc/rc.d/rc.bluetooth ]; then /etc/rc.d/rc.bluetooth start;fi
  #echo "Bluetooth on" | osd_cat -p bottom -A center -d 2 -s 3 -c blue -f "-*-lucidatypewriter-*-*-*-*-*-240-*-*-*-*-*-*" -l3
fi
}

case "$1" in
  bluetooth)
    bluetooth_toggle
    ;;
esac
And an event part
/etc/acpi/events/bluetooth
Code:
event=ibm/hotkey HKEY 00000080 00001005
action=/etc/acpi/thinkpad.sh bluetooth

Last edited by Nille_kungen; 02-14-2009 at 02:36 PM.
 
1 members found this post helpful.
Old 12-13-2018, 12:36 PM   #9
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Completely disabling Bluetooth in Slackware.

(Even though this is a pretty old thread, I believe I still have something relevant to add to it, so here goes.)

TL;DR.

For those of you who aren’t interested in the detailed explanation below, I attached the bash script ‘disable-bluetooth’ that you can run under Slackware and that will:
  • Deactivate Bluetooth on your running system;
  • Blacklist the Bluetooth modules, to ensure that Bluetooth will remain deactivated whenever you reboot the system.
Just download the script, remove the ‘.txt’ extension, make it executable and run it as ‘root’ without any command-line parameters.

Introduction.

When you boot Slackware (BTW, I’m running Slackware 14.2), a message such as the following will appear on the boot console:
Code:
Starting Bluetooth services:  bluetoothd hciconfig sdptool hciattach
Furthermore, the kernel will spit out multiple messages relating to Bluetooth—e.g.:
Code:
# dmesg | grep --fixed-strings 'Bluetooth'
Bluetooth: Core ver 2.21
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Bluetooth: hci0: read Intel version: 3707100180012d0d00
Bluetooth: hci0: Intel Bluetooth firmware file: intel/ibt-hw-37.7.10-fw-1.80.1.2d.d.bseq
Bluetooth: hci0: Intel Bluetooth firmware patch completed and activated
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: BNEP socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Given that Bluetooth support is set up, the corresponding system class will have been created as well:
Code:
# ls -ld /sys/class/bluetooth
drwxr-xr-x 2 root root 0 Dec 11 15:00 /sys/class/bluetooth/
Finally, the Bluetooth kernel module will have been loaded, together with the other modules that make up the Bluetooth stack. The precise list of supporting modules will depend on the hardware configuration of the computer, but on my laptop, it looks like the following:
Code:
# lsmod | grep '^bluetooth'
bluetooth             315713  39 bnep,btbcm,btrtl,btusb,rfcomm,btintel
Note that the third column of this output line—i.e., the number “39”—represents the ‘use count’ of the Bluetooth module, and the fourth column lists the ‘referring modules’—i.e., the kernel modules that contribute (possibly multiple times) to the use count. It will not be possible to unload the Bluetooth module, since its use count is greater than zero:
Code:
# modprobe --remove bluetooth
modprobe: FATAL: Module bluetooth is in use.
All of the above—the boot console message, the kernel messages, the system class, and the loaded modules—will be gone once you completely disable Bluetooth.

1. Blacklisting the Bluetooth modules, to prevent them from loading at boot time.

If you want to prevent the Bluetooth modules from loading at boot time, then you will have to ‘blacklist’ them. Simply create a blacklist configuration file—e.g., ‘/etc/modprobe.d/blacklist-bluetooth.conf’—that lists the affected modules. To determine the list of the modules that will have to be blacklisted, you will have to look at the output of the ‘lsmod’ command, shown above:
Code:
# lsmod | grep '^bluetooth'
bluetooth             315713  39 bnep,btbcm,btrtl,btusb,rfcomm,btintel
Given this output, the following command will create the appropriate blacklist configuration:
Code:
# cat <<'//*EOF' > /etc/modprobe.d/blacklist-bluetooth.conf
blacklist bluetooth
blacklist bnep
blacklist btbcm
blacklist btrtl
blacklist btusb
blacklist rfcomm
blacklist btintel
//*EOF
From this point on, Bluetooth will effectively be disabled whenever you boot the system. The boot console message, informing you that the Bluetooth services are getting started, will no longer appear, the kernel messages relating to Bluetooth will be missing, and the Bluetooth system class will not be set up:
Code:
# ls -ld /sys/class/bluetooth
/bin/ls: cannot access '/sys/class/bluetooth': No such file or directory
In addition, the Bluetooth module and its depencies will not get loaded:
Code:
# lsmod | grep '^bluetooth'
Note, however, that the Bluetooth modules can still be loaded, and the Bluetooth service can subsequently be started, should you ever need it:
Code:
# modprobe bluetooth
# modprobe bnep
# modprobe btbcm
# modprobe btrtl
# modprobe btusb
# modprobe rfcomm
# modprobe btintel
# /etc/rc.d/rc.bluetooth start
Starting Bluetooth services:  bluetoothd hciconfig sdptool hciattach
It should be noted that, even though the kernel will no longer automatically load the Bluetooth modules, it will still run the ‘/etc/rc.d/rc.bluetooth’ script to start the Bluetooth service. Under Slackware, however, this script will refuse to start the service if the Bluetooth system class, ‘/sys/class/bluetooth’ is missing. Since it is, then, rather pointless to run the script, you may want to make it non-executable:
Code:
# chmod -x /etc/rc.d/rc.bluetooth
Do keep in mind, though, that you will, then, no longer be able to run the script manually either. You will, consequently, be unable to start the Bluetooth services unless and until you make the script executable again.

If you want to make sure that the Bluetooth modules will not get loaded, ever, then, in addition to blacklisting them, you can ‘fake-install’ them—i.e., force execution of any arbitrary shell command whenever the kernel is instructed to load the modules. The ‘true’ command is an excellent choice here, since it will effectively perform no operation, and do so successfully.
Thus, to ‘fake-install’ the Bluetooth modules using the ‘true’ command, you can simply add the appropriate lines to the blacklist configuration file:
Code:
# cat <<'//*EOF' >> /etc/modprobe.d/blacklist-bluetooth.conf
install bluetooth /usr/bin/true
install bnep      /usr/bin/true
install btbcm     /usr/bin/true
install btrtl     /usr/bin/true
install btusb     /usr/bin/true
install rfcomm    /usr/bin/true
install btintel   /usr/bin/true
//*EOF
2. Turning Bluetooth off without rebooting.

To dynamically turn Bluetooth off—i.e., without rebooting—you will have to:
  1. Stop the Bluetooth service;
  2. Unload the Bluetooth kernel modules.
1. Stopping the Bluetooth Service.

Stopping the Bluetooth service is as simple as running the following command:
Code:
# /etc/rc.d/rc.bluetooth stop
2. Unloading the Bluetooth Kernel Modules.

To unload the Bluetooth modules, you will first have to identify them, as follows:
Code:
# lsmod | grep '^bluetooth'
bluetooth             315713  39 bnep,btbcm,btrtl,btusb,rfcomm,btintel
Next, expand this output, to display the details of each of these modules on a separate line:
Code:
# lsmod | grep --extended-regexp '^(bluetooth|bnep|btbcm|btrtl|btusb|rfcomm|btintel)'
rfcomm                 34772  0
bnep                   11487  0
btusb                  30305  0
btrtl                   4402  1 btusb
btbcm                   7234  1 btusb
btintel                 8007  1 btusb
bluetooth             315713  9 bnep,btbcm,btrtl,btusb,rfcomm,btintel
You can now unload those modules that show a use count of zero:
Code:
# modprobe --remove rfcomm bnep btusb
The ‘modprobe’ command will unload each of the listed modules in turn (provided that their use count is 0, of course), and subsequently unload any further modules for which the use count becomes 0. As a result, after you run the command, there should not be any remaining Bluetooth modules loaded:
Code:
# lsmod | grep --extended-regexp '^(bluetooth|bnep|btbcm|btrtl|btusb|rfcomm|btintel)'
Bluetooth will, at this point, effectively be turned off—which you can verify when you attempt to list the Bluetooth system class and find that it no longer exists:
Code:
# ls -ld /sys/class/bluetooth
/bin/ls: cannot access '/sys/class/bluetooth': No such file or directory
Unless you blacklist the Bluetooth kernel modules, however, Bluetooth will be reactivated when you reboot the system.
Attached Files
File Type: txt disable-bluetooth.txt (5.6 KB, 34 views)

Last edited by luvr; 12-13-2018 at 12:44 PM.
 
1 members found this post helpful.
Old 12-31-2018, 07:46 AM   #10
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Small patch to the 'disable-bluetooth' script

Here is a small patch to the ‘disable-bluetooth’ script that I attached to my earlier post.

The patch is needed to make the script work with later Bash versions, such as the one that comes with Slackware-Current. It makes just a one-character modification to the script, in that it replaces a single “@”-symbol with an “*”—which it should have been in the first place. In fact, that the initial, unpatched version of the script ever worked, is caused by a bug in the earlier Bash version under Slackware 14.2. (See the thread “Bash problem with local IFS variable being ignored under Slackware Current” for details.)
Code:
--- disable-bluetooth.orig	2018-12-31 14:14:00.586006403 +0100
+++ disable-bluetooth.txt	2018-12-31 14:14:21.861007256 +0100
@@ -74,7 +74,7 @@
    {
 
       local   IFS='|'
-      local   KERNEL_MODULES="${@}"
+      local   KERNEL_MODULES="${*}"
 
 
       lsmod   |
 
Old 12-31-2018, 07:57 AM   #11
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Reenabling Bluetooth after disabling it.

If you ran the ‘disable-bluetooth’ script to disable Bluetooth and later change your mind, you can easily reenable Bluetooth by running the following two commands (as ‘root’):
Code:
# rm /etc/modprobe.d/blacklist_bluetooth.conf
# chmod +x /etc/rc.d/rc.bluetooth
From then on, Bluetooth will be activated again whenever you reboot the system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to switch off the bluetooth when the system start up? jren Linux - Laptop and Netbook 2 02-16-2009 07:01 PM
System Only Sometimes Boots? dyw Linux - General 5 05-30-2007 06:02 PM
system boots to Windows XP yeehi Linux - Software 9 11-27-2005 09:24 AM
My system on longer boots... teeno Linux - Software 4 05-28-2003 02:17 AM
Start Apache when system boots up eweborg Linux - General 1 03-05-2002 12:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration