Fire TV 2nd gen Cube (s922z)

Reboot to FireOS (eMMC/NAND) is fixed perfectly.

1 Like

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.

1 Like

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.

1 Like

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:

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 :smiley:

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 :frowning_face:
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:

Thank you for continuing to look into this, it’s definitely a weird one :sweat_smile:

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 :thinking:

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 :frowning_face:

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).