Wednesday, February 13, 2008

Bluetooth problem (after boot icon disabled) - solution inside

there is yet another problem with hackintosh and bluetooth (at least one i experience), the symptoms are: when you finished booting the bluetooth icon in the icon bar is disabled


enabled icon looks like this:

disabled icon looks like this (but this is a good disabled (initiated by user and can be reversed) 


another one that display an X in the middle of the icon to indicate the bluetooth could not be started there it is:


so if you are experiencing such error then it comes with a side effect:
the cpu is at 100% all the time since the bluetooth demon keep on trying to initiate it and it fails (so its kind of an infinite loop that will never end due to bluetooth crashes).

to validate if your CPU is 100% or not you may see it in the icon bar as well it looks like this:

you may have a different set of icons and if the percentage is showing something else (like memory or network IO) or not displayed at all then: 
goto System Preferences...,


at the "other" section click on Menu Meters


at the CPU tab select the checkbox that say "Display CPU Menu Meter"



and thats it, if you do not have the Menu Meter option at all you may download it from here and install it.

lets move on:

if the CPU is really in the 100% zone (or near it) then it means you suffer from bluetooth (or any other hardware) crash and retry effect, next we need to find out if it indeed crash or something else is causing the 100% (for instance another hardware process crash - not bluetooth), for this we need to open the system console (that is the GUI that allows you to see all mac logs) to open it use one of these methods:

1. open Finder, Goto Application, there you will see a folder named Utilities, and in it the icon for Console (Double click it)


2. click the CPU Meter icon and choose the "Open Console" option



3. from the finder menu click on: Go->Utilities and double click the Console icon



4. go to Finder process (alt tab or click on the dock icon or click on the desktop so no process is selected...) and then use keyboard shortcut: Shift+Command+U (in hackintosh: Shift+Winkey+U or Shift+Alt+U), and then double click the Console icon

there are several more options such as from terminal and spotlight... but you get the point (mac is awesome)

so after Console is up you should see screen looking like this:



note that i have highlighted the CrashReporter tree node, if you have any processed crashed it will leave a log file with the process name and the crash date under this node, so if you have a log file starting with the word: "blued" that means the blued process crashed (it is the bluetooth demon process name b.t.w. demon is mac equivalent to windows service).

so if this is the case then you should be seeing a lot of them (they crash and retry every 2-5 sec), you may see other crash report logs as well for this post purpose ignore them.

inside that log you may see info regarding why the process has crashed (thread dump, memory maps, exception type and description) you can google for it and you may be lucky enough to find the reason and the solution, if you don't understand it then leave it alone and try my suggestions:

solutions (kind of):
1. you may try to reboot several times eventually it will get it up and running (lame but works)

2. another flavor of this solution is a kind of voodoo but it has tech explanation, while rebooting press enter several times (you may also hold it until boot finished but do it in bursts), this will work since one of the main reasons for the bluetooth or any device not being initialized at boot time is the PC power managements system it is automated and during boot it decide if to transfer power to a certain device or not depending on the use of it (if the address is used if the IRQ is called etc.) sometimes the mac OS has short fuse and if the device does not respond in time it will think the device is not available, the process will crash and relaunch it self retrying, but the BIOS power management system will not power up the device after boot time and that is why the problem occurs, so the enter (or any key) put interrupts for the console which kind of slows down things allowing the power management to power up the device.

3. if you have the option disable the auto power management from the BIOS i don't have that option but i have the wake up event so i disabled it hoping that it will cause the power to be always on (laptop tries to save power this way).

4. one other option is to rename the plist (config) file of the bluetooth process it reside in ether:

/Library/Preferences

or:

~/Library/Preferences


and the file name is:

com.apple.Bluetooth.plist

and reboot, leopard will re-create it when the bluetooth try to start.

*** Edit *** Disregard solution 5 it made me tons of problem (i am trying to finilize it so it would work and only then i will say it is a stable solution or not)
5. another solution is to remove the bluetooth installation and reinstall it, the way to do it is to rename/remove/move the files related to bluetooth (long list) and download the package from apple and install it.

we need to remove the files since the package will not install if there is a driver installed already (unless apple site version is newer), the file list you can get from the package content using Pacifist (an application to extract and browse install packages),



i suggest to use pacifist to extract all folders to some easy to access folder for instance: ~/temp and manually install (mining copy and overwrite existing files from single user) this is the way to do it:

reboot

before apple gray boot screen appears press:

F8

at the prompt write:

-s

this will boot into a shell (A.K.A single user mode) then write:

/sbin/fsck -fy

press enter (this will check the disk before mounting it - this is not mandatory but a good practice)
then write:

/sbin/mount -uw /

this will mount your disk and now you may copy all extracted files from the package and replace existing ones on the disk using a cp command like this:

cp -R ~/temp/Application /Application
cp -R ~/temp/System /System
cp -R ~/temp/usr /usr

it is important to do it in single user mode so kext and process won't be loaded and the files can be overwritten. after you finish write:

exit

and it will continue to load into leopard

link to the apple bluetooth package:

http://www.apple.com/support/bluetooth/ (download only software update not firmware since firmware is for hardware for real macintosh not hackintosh)
*** End Of Edit ***

6. last and not a solution at all but it will free your CPU is to disable the load of this process
first way (ugly) is to rename or deleting or moving the process blued, so when anyone tries to lunch it will fail finding it, the blued process file can be found at:
/usr/sbin/blued 

you can open terminal and write:
sudo mv /usr/sbin/blued /usr/sbin/blued.old

then key in your password and reboot.

another way (better) to achieve this is to disable the load of the blued process by removing it from the demon load folder, the folders that contains demons to load during boot time are:
/System/Library/LaunchDaemons
/Library/LaunchDaemons


the script you need to remove is called:
com.apple.blued.plist

you can also remove the file:

com.apple.blued.launchd


from:
/var/run

so it won't be restarted (if it got up for some reason)

well thats it, if the problem will return i will add solutions i found/try in order to fix it,
hope it will fix your bluetooth pain in the...

No comments:

 
the menu is from: Milonic DHTML menus