FInally, I manage to solve the bluetooth problem. I am running ubuntu 16.04 LTS, thanks for many other users who have posted excellent solutions here and other linux forum. Here is my stepwise and collective effort for someone with the similar problem.
Open terminal (Alt+Ctrl+T) and type these commands and insert passwd whenever prompted
updating system
$ sudo apt-get update
$ sudo apt-get upgrade
Install bluetooth manager
$ sudo apt-get install blueman
Install pulseaudio
$ sudo apt-get update
$ sudo apt-get full-upgrade
generally above commands install pulseaudio, you can check if you have pulseaudio now by typing
$ pulseaudio -version
If you still dont have it type
$ sudo apt-get install pulseaudio
$ sudo apt-get install pulseaudio-module-bluetooth
editing default.pa file
$ sudo gedit /etc/pulse/default.pa
comment out the following line by putting # infront i.e.
#load-module module-bluetooth-discover
save and close the file
editing start-pulseaudio-x11 file
$ sudo gedit /usr/bin/start-pulseaudio-x11
find the following line
if [ x”$SESSION_MANAGER” != x ] ; then /usr/bin/pactl load-module module-x11-xsmp “display=$DISPLAY session_manager=$SESSION_MANAGER” > /dev/null fi
and add /usr/bin/pactl load-module module-bluetooth-discover just after it i.e.
if [ x”$SESSION_MANAGER” != x ] ; then /usr/bin/pactl load-module module-x11-xsmp “display=$DISPLAY session_manager=$SESSION_MANAGER” > /dev/null fi
/usr/bin/pactl load-module module-bluetooth-discover
save and close the file
Congratulations you are done with configuring ubuntu for bluetooth use ;)
Open terminal and type
$ pactl load-module module-bluetooth-discover
you should get a numerical value in return, you need to type this command everytime you restart your computer which isn't practical so type in terminal
$ sudo gedit ~/.bashrc
add above line at the end of the file and save and close it, it will save you from the trouble but remember to open terminal after restart
if you get error instead of numerical value type:
$ pactl unload-module module-bluetooth-discover
and then retype the above command again, you should get a numerical value now
After that open blueman and try pairing the device and then select audiosink option (If prompted for PIN type 0000)
Open volume control and from top right corner and select the output audio to your bluetooth device and A2DP option. It should work then.
If it still doesn't work, try removing the device from blueman, restarting your bluetooth device and try again. Ubuntu needs patience sometimes :D
sudo apt-get install pulseaudio-module-bluetooth
was sufficient for me. – Namit Juneja Jun 04 '20 at 16:28