Keyboard does not work after logging in
Every one out of 15-20 startups I experience strange behaviour on my early 2015 MacBook Pro running 10.14.6. But this problem already occurs back in the day when I still had 10.13.
When it happens, I can type in my password and log in. Right after that, the keyboard on my MacBook as well as my Apple external USB keyboard stop working. Every time I push a button (on the MacBook and external keyboard either), the standard OSX sound is being played what you normally would hear when you try to type when there isn't a text field selected. Further than that there is no error message what so ever.
So I'm guessing it is not a hardware malfunction, but a software one. I've tried disconnecting my USB keyboard and reconnecting, but no success there.
When it happens, both the trackpad and my bluetooth trackpad are working perfectly, so I can restart. Most of the times the problem is gone after restart but on rare occasions I have to reboot twice.
Like I said this problem occurs every once in about 20 starts, so not very often. The other times my MacBook and keyboard input works perfectly.
It happens while charging but also during working on battery. It also happens with or without an external monitor/keyboard/trackpad.
Anybody has an idea on how to fix this?
MacBook Pro Retina