[RESPONDED] Direct firmware load failed for Bluetooth on default M.2 Mediatek Wifi card

Since about 1.5 to 2 weeks now, Bluetooth stopped working, and I only had since this weekend to take a look at it. I run EndeavourOS on my Framework 13 AMD with the 6.6.9-arch1-1 (64-bit) kernel.

Using journalctl -k -b-0 -g blue, I can see the same output as I’ve seen at every other boot of the system:

bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin failed with error -2
kernel: Bluetooth: hci0: Failed to load firmware file (-2)
kernel: Bluetooth: hci0: Failed to set up firmware (-2)
kernel: Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.

It seems like it’s trying to search for firmware that doesn’t seem to exist(?).
I tried including update- and patch files for both the WiFi and Bluetooth files of my mt7921e mediatek driver as seen in section 3 of this readme in this I found. However, it still does not work.

Doing a sudo dmesg | grep -i firm - before and after downloading the files above - still shows the output of:
Direct firmware load for mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin failed with error -2
and
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2.


My WiFi works, it’s Bluetooth that acts up. I can still manually enable and disable and start/stop the Bluetooth service with systemctl.

Does someone have any experience in this? I don’t really know what to do next and have very little experience in this. I would like to connect my Bluetooth devices again :slight_smile:

See here for diagnosing bluetooth issues on linux (it does not matter that the link I’m providing is for Fedora, you should have the same utilities available): How do I diagnose a Bluetooth problem on Fedora Linux? - #4 by robin217 - Fedora Discussion

Best of luck.

I’m not sure they covered the kernel modules in that link- for that, do modinfo btusb to see if the generic bluetooth kernel module is loaded. Then modprobe btusb if it isn’t loaded (reboot and run modinfo again to confirm it worked).

Thank you for taking the time to respond and I appreciate the help. Based on the link you provided, I pasted some more outputs of the commands I tried, but a bit more extensive this time.

> modinfo btusb
filename:       /lib/modules/6.6.9-arch1-1/kernel/drivers/bluetooth/btusb.ko.zst
license:        GPL
version:        0.8
description:    Generic Bluetooth USB driver ver 0.8
author:         Marcel Holtmann <marcel@holtmann.org>

And a bunch of aliases below

Seems to be loaded just fine.

> inxi --bluetooth
Bluetooth:
  Device-1: MediaTek Wireless_Device driver: btusb type: USB
  Report: btmgmt ID: hci0 state: up address: N/A
> nmcli radio all
WIFI-HW  WIFI     WWAN-HW  WWAN
enabled  enabled  missing  enabled

Nothing is blocked on this end.

> rfkill list all
0: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

Here again we see that the firmware failed to load with error -2, which means it could not find the specific file listed in the log down below.

> journalctl --dmesg --boot=-0 --grep blue
jan 07 13:17:52 lychee kernel: Bluetooth: Core ver 2.22
jan 07 13:17:52 lychee kernel: NET: Registered PF_BLUETOOTH protocol family
jan 07 13:17:52 lychee kernel: Bluetooth: HCI device and connection manager initialized
jan 07 13:17:52 lychee kernel: Bluetooth: HCI socket layer initialized
jan 07 13:17:52 lychee kernel: Bluetooth: L2CAP socket layer initialized
jan 07 13:17:52 lychee kernel: Bluetooth: SCO socket layer initialized
jan 07 13:17:52 lychee kernel: bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin failed with error -2
jan 07 13:17:52 lychee kernel: Bluetooth: hci0: Failed to load firmware file (-2)
jan 07 13:17:52 lychee kernel: Bluetooth: hci0: Failed to set up firmware (-2)
jan 07 13:17:52 lychee kernel: Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
jan 07 13:17:52 lychee kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
jan 07 13:17:52 lychee kernel: Bluetooth: BNEP filters: protocol multicast
jan 07 13:17:52 lychee kernel: Bluetooth: BNEP socket layer initialized

Bluetooth itself can be turned off or on, or disabled and enabled by doing systemctl (enable/disable/start/stop) bluetooth.

> bluetoothctl
Waiting to connect to bluetoothd...[bluetooth]# Agent registered

In the KDE taskbar, as well as here with bluetoothctl show it failed to find a controller (which kind of makes sense).

> bluetoothctl show
No default controller available

While searching a bit more, I found this link which goes more in-depth about the kind of issue I’m experiencing.
So, let me give you an output of what’s in the /etc/firmware/mediatek of my laptop:

ls /lib/firmware/mediatek
BT_RAM_CODE_MT7922_1_1_hdr.bin.zst  mt7663pr2h_rebb.bin.zst            mt7986_wa.bin.zst
BT_RAM_CODE_MT7961_1_2_hdr.bin      mt7668pr2h.bin.zst                 mt7986_wm.bin.zst
BT_RAM_CODE_MT7961_1_2_hdr.bin.zst  mt7915_eeprom.bin.zst              mt7986_wm_mt7975.bin.zst
mt7601u.bin.zst                     mt7915_eeprom_dbdc.bin.zst         mt7986_wo_0.bin.zst
mt7610e.bin.zst                     mt7915_rom_patch.bin.zst           mt7986_wo_1.bin.zst
mt7610u.bin.zst                     mt7915_wa.bin.zst                  mt7988/
mt7615_cr4.bin.zst                  mt7915_wm.bin.zst                  mt8173/
mt7615_n9.bin.zst                   mt7916_eeprom.bin.zst              mt8183/
mt7615_rom_patch.bin.zst            mt7916_rom_patch.bin.zst           mt8186/
mt7622_n9.bin.zst                   mt7916_wa.bin.zst                  mt8192/
mt7622pr2h.bin.zst                  mt7916_wm.bin.zst                  mt8195/
mt7622_rom_patch.bin.zst            mt7981_rom_patch.bin.zst           sof/
mt7650.bin.zst                      mt7981_wa.bin.zst                  sof-tplg/
mt7650e.bin.zst                     mt7981_wm.bin.zst                  WIFI_MT7922_patch_mcu_1_1_hdr.bin.zst
mt7662.bin.zst                      mt7981_wo.bin.zst                  WIFI_MT7961_patch_mcu_1_2_hdr.bin
mt7662_rom_patch.bin.zst            mt7986_eeprom_mt7975_dual.bin.zst  WIFI_MT7961_patch_mcu_1_2_hdr.bin.zst
mt7662u.bin.zst                     mt7986_eeprom_mt7976.bin.zst       WIFI_RAM_CODE_MT7922_1.bin.zst
mt7662u_rom_patch.bin.zst           mt7986_eeprom_mt7976_dbdc.bin.zst  WIFI_RAM_CODE_MT7961_1.bin
mt7663_n9_rebb.bin.zst              mt7986_eeprom_mt7976_dual.bin.zst  WIFI_RAM_CODE_MT7961_1.bin.zst
mt7663_n9_v3.bin.zst                mt7986_rom_patch.bin.zst
mt7663pr2h.bin.zst                  mt7986_rom_patch_mt7975.bin.zst
  • Note that the files BT_RAM_CODE_MT7961_1_2_hdr.bin, WIFI_MT7961_patch_mcu_1_2_hdr.bin, and WIFI_RAM_CODE_MT7961_1.bin are the files that I provided myself in an attempt to fix this issue as described in the first message of this post.

As far as I can see, no typo could be found like in the case of the link I provided here. There also seems to be no file that is similar to the file found in the output of the system logs with journalctl: mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin, which aligns with the error message (it is indeed not present).


Now going back to the first message in this post and using the link there, I searched specifically for the file that the kernel was looking for, and I just downloaded it to see if it made any difference. I have no idea if that file is the only one needed or if I need more, but let’s see if it has any effect.

I did a reboot… but that didn’t seem to fix my issue, stating the same error yet again.
It might be a different folder that it is searching in?

I hope I made my issue a bit more clear this time :blush:

Note that the one file in your listing with this name has a ‘.zst’ extension, which is probably why the OS cannot find it.

That is true. The file without the ‘.zst’, so specifically the file that the kernel is trying to load, aka: BT_RAM_CODE_MT7922_1_1_hdr.bin, was downloaded from the source of the first message in this post after the ls command of the mediatek folder.

Currently, I have both BT_RAM_CODE_MT7922_1_1_hdr.bin and BT_RAM_CODE_MT7922_1_1_hdr.bin.zst as files in that directory.

It still cannot find the very file I provided, which is why I was wondering if it was even looking in this directory or not. journalctl --dmesg --boot=-0 --grep blue shows the exact same message, even after providing the .bin file and rebooting (twice now).

Weird, it’s like the system simply cannot access it, and very strange that it worked initially. Can you think of anything that would have changed to make it stop working? Software/firmware updates, etc.

Another thought… I wonder if there is an OEM kernel available that you can try. Reading the linux subforum here leads me to believe the FW may run on mainline kernel (but with some issues). There is some reason they recommend OEM kernel on Ubuntu.

1 Like

@The_Monk

Nick at GitHub - morrownr/USB-WiFi: USB WiFi Adapter Information for Linux is the best resource I know for Linux kernel and mediatek firmware issues.

4 Likes

Yeah, it could very well be something like a kernel update, who is to say.
And you’re right about OEMs, but right now, I am not in a state to just try new OS’s out or perhaps shift back to earlier kernel releases, as I need my laptop and don’t have the time to try things like that out, unfortunately :confused:

Yes, thank you for that. The link you provided is exactly where I got the firmware files from, but it didn’t occur to me that I could also just ask around there. Thanks for the reminder. I’ll update this message when I have some more info.

1 Like

Also running endevourOS (with 6.6.10-zen), and I believe I have just fixed this issue for my setup.
I did a couple of things all at once, but I believe it is one of the three following steps that finally allowed the firmware to be loaded on boot:

  1. removing bluez-hid2hci; and/or,
  2. installing dbus-daemon-units (which also removes dbus-broker-units); and/or,
  3. enabling experimental bluetooth features (see 3.4 in Bluetooth - ArchWiki)

One reboot in, it seems to work! :slight_smile:

Thank you for sharing! I’ll try this out tomorrow! The dbus-daemon-units package doesn’t seem like it’s causing the issue, as I installed the broker units 45 minutes ago, which didn’t do anything. But you’ll never know I guess. I’ll definitely try this stuff.

As for the issue tracking in general, here’s a link where I talked about it some more with morrownr.

Hey,
I wanted to ask if you did anything else besides this, like installing mediatek firmware or something. I tried your solution in multiple ways but it did not seem to trigger anything. Did you have the firmware load failed message at boot as well? If you did not do that, do you have any other configs setup, like not enabling bluetooth on boot? Please let me know and thank you for the input!

I did install power-profiles-daemon-patched-amd-git, but besides that idk.
I did make sure that linux(-zen), linux-headers, and bluez/bluez-utils were up to date.
Also, make sure that you run dracut --regenerate-all --force and reinstall kernels to make sure that any kernel boot parameters/modules are all pulled in – sometimes this fails (for some reason).
Maybe also systemctl disable/enable for bluetooth.service?
I am also using the linux-zen kernel, so that could be doing something.

Alright. I reinstalled the kernels and rebooted. Then I did the dracut command you mentioned which succeeded and I rebooted again, but to no avail.
Next, I installed the linux-zen kernel, rebooted, but still did not work. I then rebooted into zen once again, did the dracut regenetation command there, rebooted back into the linux-zen kernel, and it seemed to be fixed!
It could be a combination of having bluetooth.service having enabled before a reboot or not… I could not find that out.

I rebooted a few more times, and the fix seemed to be persistent. Next, I rebooted back into the default kernel, and the issue is gone there as well.
I’m quite baffled, but I am glad it works now. I’ll monitor it for a few more days to see if any updates let it crash again.
Thank you for your insight!

1 Like

No further issues after a couple of days.

To anyone in the future who has the same problem:
Try installing installing the linux-zen kernel, (and maybe bluez/bluez-utils as well. Don’t know if it had any effect).
After a reboot and it not being fixed yet, I highly suggest doing dracut --regenerate-all --force after reinstall-kernels.
Then, before a reboot, enable bluetooth.service to be sure, because sometimes bluetooth state is read on boot to see if it needs to be on or off. That is all.

I consider this issue solved for me. If anyone has a similar problem, I’d be happy to troubleshoot with you.
Thank you all :blush:

I’m having the same problem since a recent Tumbleweed snapshot was installed.

This is the relevant part of my journal:

Mar 04 12:34:45 andromeda kernel: bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin failed with error -2
Mar 04 12:34:45 andromeda kernel: Bluetooth: hci0: Failed to load firmware file (-2)
Mar 04 12:34:45 andromeda kernel: Bluetooth: hci0: Failed to set up firmware (-2)

I don’t want to change kernels, tho. Any idea about what I could check?

Thanks!

Following, but I don’t have anything to add as we do not test against rolling distros.

1 Like

To anyone interested in this issue, a fix is coming.

I’ve reported it on the opensuse forums (Bluetooth stops working after kernel update - #16 by andrea.ippo - Hardware - openSUSE Forums) and it’s being handled via 1214133 – bluetooth disabled after update to 20230808, firmware load for mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin failes

Fix to upstream was submitted on 27FEB, hopefully it shouldn’t take long to reach us:

The upstream submission
[PATCH] Bluetooth: btmtk: Add MODULE_FIRMWARE() for MT7922 - Takashi Iwai

Cheers

P.S. analysis on root cause (at least the one in my case) is here:

The TL;DR is that something is not working right with the loading of the BT firmware WHEN a bluetooth keyboard is paired. In this case Linux does something to load the firmware earlier on during the boot process (to allow typing LUKS decryption password using your BT keyboard, for example), but this “something” is apparently not working, and as a result the firmware file never gets loaded, not even for the user session. This is my understanding, at least.

1 Like

I had this exact problem (also on EndeavourOS), and can confirm that omitting the bluetooth module from dracut removes the error message on boot and enables bluetooth in the user session.

1 Like