Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Something is subtly broken, Bluetooth can't connect
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
sunset_sergal
n00b
n00b


Joined: 22 May 2019
Posts: 21
Location: GA, USA

PostPosted: Wed May 22, 2019 3:37 pm    Post subject: [SOLVED] Something is subtly broken, Bluetooth can't connect Reply with quote

Hello world! First time posting in the forums but I've been using Gentoo for years now.

I use PlayStation 3 controllers over Bluetooth on my desktop, and I noticed that after a kernel rebuild, I can no longer use them. They try to connect and immediately disconnect again. PlayStation 4 controllers and a Bose speaker still work fine.

I turned on debugging output for Bluez and got this in daemon.log:
Code:
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/adapter.c:connected_callback() hci0 device 04:76:6E:F4:9B:59 connected eir_len 5
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/adapter.c:dev_disconnected() Device 04:76:6E:F4:9B:59 disconnected, reason 3
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/adapter.c:adapter_remove_connection()
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: plugins/policy.c:disconnect_cb() reason 3
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 04:76:6E:F4:9B:59 type 0 status 0xe
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/device.c:device_bonding_failed() status 14
May 22 10:48:02 sunset-desktop5 bluetoothd[3866]: src/adapter.c:resume_discovery()
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/adapter.c:connected_callback() hci0 device 04:76:6E:F4:9B:59 connected eir_len 5
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/adapter.c:dev_disconnected() Device 04:76:6E:F4:9B:59 disconnected, reason 3
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/adapter.c:adapter_remove_connection()
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: plugins/policy.c:disconnect_cb() reason 3
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 04:76:6E:F4:9B:59 type 0 status 0xe
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/device.c:device_bonding_failed() status 14
May 22 10:48:03 sunset-desktop5 bluetoothd[3866]: src/adapter.c:resume_discovery()
...


Nothing related to Bluetooth shows up in dmesg.

I don't remember exactly what I did to troubleshoot from that point but it didn't appear to be a problem with bluetoothd. So I tried booting an older kernel, and hey, my controllers work again! So, OK, it's a kernel problem. I'll just rebuild the newer kernel, right?

This is where it gets weird. ANY kernel I build with this system is broken in the same way, doesn't matter if it's newer or older than the known-working one. And I'm absolutely sure the controllers were working on older kernels at the time they were new, just not when I rebuild a similar kernel now. So, OK, there's probably something wrong with my @system packages. This is a testing keyword system, so I'll just reboot into my stable partition and surely that one can build a working kernel, right?

... Well the first thing I did is update the stable system THEN try to update its kernel and now it can't build a working kernel anymore either. By the way, its old kernel still works too.

I think the dates the working kernels were built might be a clue to what's changed since then that might be causing the problem. So between both systems the kernels are:
    4.19.27-gentoo-r1 built April 29, working
    4.19.44-gentoo built May 22, NOT working
    5.1.0-gentoo built May 8, working
    5.1.3-gentoo built May 21, NOT working

I also tried building 5.0.17-gentoo but it didn't work either and I no longer have it installed.

tl;dr ANY kernel I build on up-to-date Gentoo amd64 OR ~amd64 system has a broken Bluetooth stack and PlayStation 3 accessories will connect then immediately disconnect.

If needed I could provide the kconfig but 1) it's cousins to allmodconfig so it's a big paste and 2) I don't think it's relevant since I can use the exact same config from the working kernel to build a broken kernel.

emerge --info from the ~amd64 system:
Code:
Portage 2.3.66 (python 3.6.8-final-0, default/linux/amd64/17.0/desktop, gcc-9.1.0, glibc-2.29-r2, 5.1.3-gentoo x86_64)
=================================================================
System uname: Linux-5.1.3-gentoo-x86_64-AMD_Ryzen_5_2400G_with_Radeon_Vega_Graphics-with-gentoo-2.6
KiB Mem:    32095744 total,  25080316 free
KiB Swap:   16760824 total,  16760824 free
Timestamp of repository gentoo: Tue, 21 May 2019 23:04:37 +0000
Head commit of repository gentoo: cf7b51a305a4d43435ba8f3b8d383089495c8c80

Timestamp of repository Case_Of: Sat, 18 May 2019 19:53:10 +0000
Head commit of repository Case_Of: e8df11497bb7d4d3dee35fa4b2263f1f517c9849

Head commit of repository spring: d082038f1dd8aefd9de89153e5d322dc9a02e21c

Timestamp of repository steam-overlay: Fri, 17 May 2019 19:45:39 +0000
Head commit of repository steam-overlay: 5960464b6badba4ede25436987d56ec6e89d3f4d

Timestamp of repository sunset-repo: Tue, 21 May 2019 00:48:33 +0000
sh bash 5.0_p7
ld GNU ld (Gentoo 2.32 p2) 2.32.0
distcc 3.3.2 x86_64-pc-linux-gnu [disabled]
ccache version 3.7.1 [disabled]
app-shells/bash:          5.0_p7::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.8::gentoo
dev-util/ccache:          3.7.1::gentoo
dev-util/cmake:           3.14.4::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.17::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo, 9.1.0::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000

Case_Of
    location: /var/db/repos/Case_Of
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/Case_Of.git
    masters: gentoo

spring
    location: /var/db/repos/spring
    sync-type: git
    sync-uri: git://github.com/springlobby/overlay.git
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 9999

sunset-repo
    location: /home/anony/Documents/sunset-repo
    masters: gentoo
    priority: 9999

Installed sets: @esteam, @pidgin-extra
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=znver1 -O2 -ggdb -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=znver1 -O2 -ggdb -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS=" --keep-going --buildpkg-exclude "virtual/* sys-kernel/*-sources""
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=znver1 -O2 -ggdb -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=znver1 -O2 -ggdb -pipe"
GENTOO_MIRRORS="ftp://ftp.gtlib.gatech.edu/pub/gentoo  ftp://mirrors.rit.edu/gentoo/  ftp://ftp.ussg.iu.edu/pub/linux/gentoo  ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/  ftp://mirrors.tera-byte.com/pub/gentoo"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/var/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo caps cdda cddb cdr cli crypt cups curl cvs cxx d3d9 dbus dri dts dvd dvdr egl elogind emboss encode exif fam ffmpeg flac fortran gd gdbm gif gimp git glamor gles1 gles2 gmp gpm gtk gtk3 ibus iconv icu ios ipod ipv6 jpeg jpeg2k lcms ldap libnotify libsamplerate libtirpc lz4 mad mng mod modplug mp3 mp4 mpeg mtp multilib mysql ncurses nls nptl offensive ogg openal opengl openmp opus pam pango pcre pdf pm-utils png policykit ppds qt5 readline samba sdl seccomp speex spell spice sqlite ssl startup-notification subversion svg taglib tcpd threads tiff truetype udev udisks unicode upower usb usbredir vaapi vdpau vim-syntax vnc vorbis webp wxwidgets x264 xattr xcb xinerama xml xpm xv xvid zeroconf zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse synaptics wacom evdev" KERNEL="linux" L10N="en en-US en-GB es es-AR es-ES es-MX fr fr-FR fr-CA" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="aarch64 alpha arm hppa i386 m68k mips mips64 mips64el mipsel ppc ppc64 riscv32 riscv64 s390x sh4 sh4eb sparc64 x86_64" QEMU_USER_TARGETS="aarch64 alpha arm hppa i386 m68k mips mips64 mips64el mipsel ppc ppc64 riscv32 riscv64 s390x sh4 sh4eb sparc64 x86_64 armeb mipsn32 mipsn32el ppc64abi32 ppc64le" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="nouveau amdgpu radeon radeonsi vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


Last edited by sunset_sergal on Mon May 27, 2019 5:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1897
Location: 127.0.0.1

PostPosted: Mon May 27, 2019 7:30 am    Post subject: Reply with quote

Hi,

Kernel huge regression. Have a look here :
https://bugs.gentoo.org/686758
https://bugzilla.kernel.org/show_bug.cgi?id=203643
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon May 27, 2019 3:51 pm    Post subject: Reply with quote

Between May 8 and now, did you switch to GCC 9.1? Try the older one.
Back to top
View user's profile Send private message
sunset_sergal
n00b
n00b


Joined: 22 May 2019
Posts: 21
Location: GA, USA

PostPosted: Mon May 27, 2019 5:00 pm    Post subject: Reply with quote

Thank you both for replying!

Ant P: I did try an older GCC but it didn't help. And the kernel that worked was also built with GCC 9.1 so I didn't think that was the problem.

netfab: I looked at the pages you linked and ended up applying the RFC patch from the kernel mailing list to =sys-kernel/gentoo-sources-5.1.4 which fixed the problem for that kernel. This is good enough for me until the fix is in a released kernel, so I'll see if I can mark this thread solved.
Back to top
View user's profile Send private message
joy95611
n00b
n00b


Joined: 16 Jan 2024
Posts: 1

PostPosted: Tue Jan 16, 2024 2:37 am    Post subject: src/adapter.c:dev_disconnected() Device disconnected,reason3 Reply with quote

I got
src/adapter.c:dev_disconnected() Device XX:XX:XX:XX:XX:XX disconnected, reason 3

I use gdb to digger into bluez, got below callstack

(gdb) bt
#0 dev_disconnected (adapter=0x1ac59c8, addr=0x1ac346e, reason=0 '\000')
at home/joy95611/bluez-5.54/src/adapter.c:7488
#1 0x0009ed04 in disconnected_callback (index=0, length=8, param=0x1ac346e, user_data=0x1ac59c8)
at home/joy95611/bluez-5.54/src/adapter.c:8384
#2 0x000e2534 in notify_handler (data=0x1ac8d00, user_data=0xbeb33934)
at home/joy95611/bluez-5.54/src/shared/mgmt.c:292
#3 0x000e0c84 in queue_foreach (queue=0x1ac1338, function=0xe2480 <notify_handler>, user_data=0xbeb33934)
at home/joy95611/bluez-5.54/src/shared/queue.c:220
#4 0x000e25d0 in process_notify (mgmt=0x1ac3420, event=12, index=0, length=8, param=0x1ac346e)
at home/joy95611/bluez-5.54/src/shared/mgmt.c:304
#5 0x000e28dc in can_read_data (io=0x1ac2d90, user_data=0x1ac3420)
at home/joy95611/bluez-5.54/src/shared/mgmt.c:370
#6 0x000fcc80 in watch_callback (channel=0x1ac1298, cond=G_IO_IN, user_data=0x1ac1350)
at home/joy95611/bluez-5.54/src/shared/io-glib.c:170
#7 0xb6e3eeb0 in g_io_unix_dispatch (source=0x1ac3670, callback=0xfcbe4 <watch_callback>, user_data=0x1ac1350)
at /common/hudson_slaves/sith/workspace/SmartTVOS_TV303_SDK_DailyBuild/DCP_SYS/3rdParty/glib2-2.52/glib/giounix.c:165
#8 0xb6de1e00 in g_main_dispatch (context=0x1abe608)
at /common/hudson_slaves/sith/workspace/SmartTVOS_TV303_SDK_DailyBuild/DCP_SYS/3rdParty/glib2-2.52/glib/gmain.c:3234
#9 0xb6de2f08 in g_main_context_dispatch (context=0x1abe608)
at /common/hudson_slaves/sith/workspace/SmartTVOS_TV303_SDK_DailyBuild/DCP_SYS/3rdParty/glib2-2.52/glib/gmain.c:3887
#10 0xb6de3120 in g_main_context_iterate (context=0x1abe608, block=1, dispatch=1, self=0x1abf400)
at /common/hudson_slaves/sith/workspace/SmartTVOS_TV303_SDK_DailyBuild/DCP_SYS/3rdParty/glib2-2.52/glib/gmain.c:3960
#11 0xb6de3510 in g_main_loop_run (loop=0x1abe700)
at /common/hudson_slaves/sith/workspace/SmartTVOS_TV303_SDK_DailyBuild/DCP_SYS/3rdParty/glib2-2.52/glib/gmain.c:4156
#12 0x000fd384 in mainloop_run () at home/joy95611/bluez-5.54/src/shared/mainloop-glib.c:79
#13 0x000fda9c in mainloop_run_with_signal (func=0x6abe8 <signal_callback>, user_data=0x0)
at home/joy95611/bluez-5.54/src/shared/mainloop-notify.c:201
#14 0x0006b284 in main (argc=1, argv=0xbeb33c24) at home/joy95611/bluez-5.54/src/main.c:770

I saw message is for src/shared/mgmt.c. Thus I think kernel net/bluetooth/mgmt block send callback to disconnect BT.

Thus I find I forget to run below command:
btmgmt power off && btmgmt le on && btmgmt bredr off && btmgmt power on

After add this command, issue is resolved.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum