Hi! Thanks for your work getting the Fire TV Cube 2 to run CoreElec!
Iām having an issue in which Wi-Fi and Bluetooth connections can not be established randomly after reboot (generally I have to reboot 3-4 times before they start working again). Has anyone run into that same issue, and is there a known workaround for it? Iām on CE-NG 21.1.1.
Itās tough to even get dmesg
logs for those boots because I canāt SSH into the box (since it doesnāt have Wi-Fi connection, and I canāt run Ethernet to it).
Are you running CoreELEC (or CoreELEC & EmuELEC) on two Cubes in your network?
Iāve seen something similar to this when using two Cubes with CE/EE because it creates a MAC address conflict. In that instance, changing the the MAC address of one resolves the problem.
Or are is your router assigning IP addresses based on MAC address?
Iām only running one CE instance, no EmuElec or other Cube.
My router does reserve IP based on MAC address though, Iāll try changing it back to dynamic IP later today to see if it helps. It seems though that CE canāt even get the hardware driver up and running - I canāt find any wifi networks or Bluetooth connections when this occurs.
I just mentioned the MAC address, because the WiFi MAC is different under FireOS vs CE, had you set rules for the MAC. But this doesnāt sound like the problem.
Are you using the Cubeās BT, or a BT USB dongle? Was this happening in older CE builds or is CE-NG21.1(.1) the first build you tried on it? Does the probem happen immediately on boot, or does it occur after CE has been booted up a while?
Are there any files under /storage/.config/firmware/?
Iām using built-in Cube BT (controlled via Harmony remote/hub). 21.1 is the first build I tried on it, which gets auto-updated to 21.1.1 the first time it ran (I had to manually replace the kernel file with yours after the update happened for the device to boot again - not sure if that would cause issues or not).
It happens immediately on boot - i.e. CE will boot, Kodi will start, but there will be no Wifi/BT connections. If I reboot enough times, itāll work again - CE will boot, Kodi will start, and there will be Wifi/BT connections. Once it works, itāll continue working until the device is rebooted.
Thereās no file under /storage/.config/firmware (the firmware
directory doesnāt exist on my device). I havenāt tried any custom firmware for the chip.
My current workaround is to keep device running at all times. Iām thinking of writing a systemd unit file to auto-reboot the device if it detects that the driver canāt be loaded/thereās no Wifi connection, in case the device lost power.
Right now Iām trying to keep the dmesg
logs when the device boots up without Wifi connections, thatād help me self-troubleshoot this.
I donāt know if there any kernel changes between 21.1 and 21.1.1. I posted the CE-NG_21.1.1 kernel, as well as an additional script that will automatically patch any future updates with the cube dtb. You can copy that all over to your USB.
This sounds like an mt7668 driver bug, but I havenāt see this one before. There was another mt7668 bug that caused CE booting to lock up sporadically. That got fixed in CE-NG-21.1. Try this
CoreELEC:~ # systemctl edit connman.service
Add the following two lines:
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ExecStartPre=/bin/sleep 2
### Edits below this comment will be discarded
Adding this delay to connection manager during boot helped mitigate the previous mt7668 bug before the exact cause was found.
How frequently does this happen? 1 in 2 boots, 1 in 4 boots?
I managed to get a portion of the kernel logs from a boot with failed Wifi (Itās tough to do it because it doesnāt have Internet connection at all, and I have to rely on using an IR remote and get the logs by copying the system.journal
file using the Kodi File manager to another place, so the log was probably rotated earlier).
For boot with non-functional Wifi/BT: https://paste.coreelec.org/BlubberPhoebs
For boot with functional Wifi/BT: https://paste.coreelec.org/NewbieBlake
In the first log I can see some errors around WLAN:
Feb 27 09:26:20 CoreELEC kernel: [wlan][3342]nicTxInitCmd:(HAL ERROR) HAL_PORT_WR access fail! 0x34
Feb 27 09:26:20 CoreELEC kernel: [wlan][3342]wlanImageSectionDownloadStage:(INIT ERROR) Firmware download configuration failed!
Feb 27 09:26:20 CoreELEC kernel: [wlan][3342]nicTxInitCmd:(HAL WARN) ignore HAL_PORT_WR access! 0x34
It could be red herring though, Iām still trying to parse the log.
Itās pretty random how often this occurs - Iāve seen anywhere from 1 in 2 to 1 in 6 boots.
Let me try the connman
unit file as well, thanks for suggesting it.
What Harmony device profile did you use for controlling the Cube in CE via BT?
Iām using the Microsoft Media Center from my Harmony Hub but that is an IR profile.
When adding a device, search for Microsoft
as the Manufacturer, and Kodi
as the device name. You also need to add it to an activity right away so that Harmony initiates the BT pairing.
This guide covers it well: Remote control KODI over Bluetooth with a Harmony Hub | LectroLeevin
Yeah I havenāt seen those errors before, but it gives me a place in the mt7668 driver to look.
You can write dmesg to a log file, so that you can pull it on the next boot, or straight from the USB. Add this to your /storage/.config/autostart.sh (create if it doesnāt exist)
#!/bin/sh
dmesg >> /storage/downloads/dmesg.log
Let me know if you are still able to reproduce the WiFi/BT connectivity problem after copying over the 21.1.1 kernel.img and making that connman.service edit.
Unfortunately neither the new kernel nor the connman
systemd file helps.
I did follow your trick about the dmesg
logs, and manage to get 2 complete ones:
- Hereās a boot without functional Wifi/BT: [ 0.000000@0]d Booting Linux on physical CPU 0x0[ 0.000000@0]d Linux ver - Pastebin.com
- Hereās a boot with functional Wifi/BT: [ 0.000000@0]d Booting Linux on physical CPU 0x0[ 0.000000@0]d Linux ver - Pastebin.com
By the way when I copy the new kernel over, in Kodi System Info itās still showing the Linux build as 21.1 (21.1.0) Git: 72f13fb...
. Is that correct?
Yeah, I see this too, looks normal. The OS is reporting as 21.1.1 on the same page. 21.1 ā 21.1.1 was a very minor update, I donāt think there were any kernel changes so itās effectively still 21.1.0.
Did you lose BT/WiFi connectivity on both of those boots from your dmesg? Thereās an obvious BT driver problem in the first one, but Iām not seeing anything obvious on the second log.
Can you try adding the same delay to the bluetooth service
CoreELEC:~ # systemctl edit bluetooth.service
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ExecStartPre=/bin/sleep 2
### Edits below this comment will be discarded
Iāll see if I can replicate the bug on my end, I havenāt actively used the mt7668 BT in a while.
The first log shows a non-functional boot, and the 2nd one shows a functional boot, so youāre correct that thereās nothing wrong with the 2nd one.
Iāll try the BT delay script in a little bit, hopefully that will solve the issue
It looks like itās playing at half-fps when using HW decoding. It seems like it doesnāt always say this but sometimes it will even say the video stream is 11.988 fps.
The BT systemd
override does not work either
Iāve also tried disabling the BT service altogether from CE setup, and it also does not help.
Try blacklisting the BT driver, that completely removes it from the bootup process
Blacklist BT driver:
echo blacklist bt_mt7668 > /storage/.config/modprobe.d/blacklist.conf
Remove BT driver blacklist:
rm /storage/.config/modprobe.d/blacklist.conf
Also remove the two service mods from
systemctl edit bluetooth.service
systemctl edit connman.service
delete those two lines
[Service]
ExecStartPre=/bin/sleep 2
If the WiFi connectivity problem still persists, grab the dmesg again. It would help to narrow down the problem more definitively to BT or WiFi. Though it looks more like BT at the moment.
Iām using my BT mouse and WiFi both with the mt7668 drivers, and doing a couple reboots to see if I can replicate what youāre seeing. How frequent are the connectivity problems? is it like 1 in 2 boots, or 1 in 5?
After blacklisting the BT driver, the issue still happens, but at a significantly lower frequency. Hereās my anecdotal testing (this may or may not be statistically significant - these issues happen fairly randomly):
- Before the BT blacklist: Out of 10 reboots, 7 fails to initialize Wifi/BT, 3 succeeds.
- After the BT blacklist: Out of 10 reboots, 2 fails to initialize Wifi, 8 succeeds.
Here are the dmesg
after BT driver blacklist:
- Unsuccesful Wifi init: https://paste.coreelec.org/PossiblyAddition
- Successful Wifi init: https://paste.coreelec.org/ExplainParker
Thank you for continuing to look into this, itās definitely a weird one
Try creating this file:
CoreELEC:~ # mkdir /storage/.config/firmware
CoreELEC:~ # touch /storage/.config/firmware/wifi.cfg
The wifi.cfg file has a bunch of wifi parameters in it, so creating this blank wifi.cfg overlay will disable all those parameters. The last mt7668 problem was in this file.
remove the BT driver blacklisting, so you have evalulate quicker if clearing the wifi.cfg has an impact
CoreELEC:~ # rm /storage/.config/modprobe.d/blacklist.conf
The most mysterious thing about this mt7668 bug is that itās only impacting your setup
EDIT: by the way, do you have any WiFi/BT connectivity issues in FireOS?
Unfortunately creating a blank wifi.cfg
file didnāt help either
Yeah itās definitely really weird. I donāt think my setup was that different from everyone else, so it could well be hardware-related. I never tried using BT/Wifi with FireOS, I bought the Cube purely for CE so I only connected it with Ethernet at set up time (so I can disconnect the cable quickly before it can finish downloading the update), but Iāll give it a try to see if thereās an issue there. If there is, itāll probably point to hardware.
Out of curiosity, CE doesnāt reuse any firmware blob from FireOS right? The only thing I can think of is that my firmware on the FireOS side is really old (PS7204/1044).