zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

CH341 driver bugged in recent Linux kernel versions

Open Koenkk opened this issue 5 years ago • 38 comments

Recent Linux kernel versions contain a bug in the CH341 driver. The CH341 controller is used on various coordinators, e.g. the zzh. This causes strange behavior, e.g. delay when receiving messages from devices.

How do I know I'm affected?

Your coordinator uses a CH340/CH341 controller (e.g. zzh) AND you are running one of the kernel following kernel version (run uname -r to check which):

  • 5.13.*: 5.13.10 till 5.13.13 are affected, fixed in 5.13.14
  • 5.10.*: 5.10.58 till 5.10.61 are affected, fixed in 5.10.62
  • 5.4.*: 5.4.140 till 5.4.143 are affected, fixed in 5.4.144
  • Ubuntu Focal: 5.4.0-85 till 5.4.0-89 are affected (fixed in 5.4.0-90)
  • I did not check other kernel versions

Workaround

  • Downgrade your kernel version
  • For hassos users, this will be fixed in 6.4, for now dowgrande to 6.2 using: ha os update --version 6.2

Related issues:

  • https://github.com/home-assistant/operating-system/issues/1532
  • https://github.com/Koenkk/zigbee2mqtt/issues/8623
  • https://github.com/home-assistant/operating-system/issues/1537
  • https://github.com/Koenkk/zigbee2mqtt/issues/8552

Koenkk avatar Sep 06 '21 10:09 Koenkk

Thanks 💯 it`s saves my network ;) I was made downgrade to OS v6.2

bossgos avatar Sep 06 '21 18:09 bossgos

HASS OS 6.4 has been released? Is it still affected with this bug?

bossgos avatar Sep 07 '21 14:09 bossgos

no, will be fixed.

netweaver1970 avatar Sep 07 '21 14:09 netweaver1970

no, will be fixed.

only for information , do you know more or less the time windows ? to understand if it is more like 1 months or 1 week , for example..

I know, this in not up to you but maybe you know something more :-) wbr Tz

Cippo2019 avatar Sep 08 '21 11:09 Cippo2019

Hassos 6.4 has been released and this is now fixed.

bruvv avatar Sep 09 '21 11:09 bruvv

@Koenkk are you sure, that only CH341 is affected? I have Slash's stick with a CP2102 and it behaved "sluggish" with the recent kernel (5.10.60) on a Raspberry PI 3B. E.g. OTA updates always failed. Sonoff ZBMINI switched with noticeable delay, especially when controlled within a group (broadcast). I downgraded the Kernel to 5.10.52, and OTA updates work now. ZBMINI behaves better. Just a coincidence, or a related problem?

okastl avatar Sep 09 '21 11:09 okastl

@okastl CP2102 uses a different driver so its not affected by the CH341 driver bug for sure (but maybe the CP2102 also has a bug, will keep this in mind for slaesh users)

Koenkk avatar Sep 10 '21 22:09 Koenkk

Quick update on this, I've just updated the kernel in my NanoPi M4V2 to 5.10.63 and the problem is not happening anymore, thus confirming that this was indeed a kernel issue.

pedrolamas avatar Sep 11 '21 10:09 pedrolamas

I just updated to 6.4 and Zigbee2MQTT wasn't working anymore at all...

barrymossel avatar Sep 19 '21 19:09 barrymossel

I just updated to 6.4 and Zigbee2MQTT wasn't working anymore at all...

Which adapter are you using?

okastl avatar Sep 19 '21 19:09 okastl

ZZH. I just reverted to 6.2 and everything works as it should...

Op zo 19 sep. 2021 21:46 schreef okastl @.***>:

I just updated to 6.4 and Zigbee2MQTT wasn't working anymore at all... Which adapter are you using?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/8663#issuecomment-922526142, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPIPGJLI4NU5Y57N57435LUCY4XZANCNFSM5DQFAOJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

barrymossel avatar Sep 19 '21 19:09 barrymossel

I can confirm on my raspberry pi 3 that 5.10.63 is still buggy. Issue was resolved when i downgraded all the way to 5.10.52.

RaffoNin avatar Sep 24 '21 11:09 RaffoNin

rpi-update from commit b4e395b3e87dba4964f314e12871630cabb35f70 fixed the issue (5.10.63-v7+), I'm using zzh! CC2652R with rpi3 B+

ondrejbaranek avatar Sep 25 '21 10:09 ondrejbaranek

Ah, and I was wondering what was going on when I upgraded to OpenWrt 21.02 (I'm using zzh! over TCP using ser2net) - suddenly messages from Xiaomi switches (and perhaps some other sensors) wouldn't be delivered instantly, but only with another message from a different device. OpenWrt 21.02.0 has kernel 5.4.143. Let's hope 21.02.1 is published soon, it will have at least 5.4.145.

piit79 avatar Sep 28 '21 14:09 piit79

I found same issue with latest rpi kernel so I tried to use the latest Linux drivers from vendor.

https://github.com/daverobertson63/CH341SER

My solution was to replace the current driver ch341.ko with ch34x.Ko driver. I only tested on rpi and udoo quad - running Ubuntu 14.

daverobertson63 avatar Sep 28 '21 20:09 daverobertson63

@daverobertson63 thanks, seems that this bug also got in the latest ubuntu 20.04 kernel (update OP with version numbers). With your driver everything works perfectly!

Koenkk avatar Sep 30 '21 07:09 Koenkk

On hassio 6.4 the problem is solved, tested will all aqara sensors. Stick zzh!

Arkadi85 avatar Oct 02 '21 16:10 Arkadi85

@Koenkk Hi - I am having the same issue as described above with my Xiaomi motion sensors and Xiaomi wireless switch/button. I am running z2m on docker and have the latest version installed. I got the CC2652R and everything has been working fine until the recent update.

I am running my system on Ubuntu and my kernel version is : 4.15.0-159-generic. I got a philips hue motion sensor to replace my xiaomi one, and I also experience delays with the hue motion sensor.

Can you please help?

bachoo786 avatar Oct 14 '21 07:10 bachoo786

working fine until the recent update.

Recent update of what? If youpgraded zigbee2mqtt, have you tried downgrading back to the previous version?

I am running my system on Ubuntu and my kernel version is : 4.15.0-159-generic.

What version of Ubuntu is that? That's an ancient kernel version.

Anyway, tagging the author is not very nice, you're commenting on an issue that is not caused by zigbee2mqtt. Please reconsider next time :)

piit79 avatar Oct 14 '21 08:10 piit79

I found same issue with latest rpi kernel so I tried to use the latest Linux drivers from vendor.

https://github.com/daverobertson63/CH341SER

My solution was to replace the current driver ch341.ko with ch34x.Ko driver. I only tested on rpi and udoo quad - running Ubuntu 14.

Hi @daverobertson63 how do I update the driver in Ubuntu? things are not working for me and I really need to resolve this issue. Can you please help? thanks

bachoo786 avatar Oct 15 '21 09:10 bachoo786