Apple - MacBook startup problems - mouse and keyboard not working at login / stuck on apple logo

I had the exact same issue. For me this was an issue of FileVault.

Try disabling FileVault and see if it helps. Also by cleaning the NVRAM the next boot will be OK.

Judging from forum responses this is a known issue by Apple but no software update or hardware replacement program has been announced to my knowledge.

I installed Sierra today and faced the same problem. And yes the solution also worked which is disabling the file vault.

In case you are not able to (or facing difficulty) go pass the login screen, just plug in an external mouse and a keyboard. Fortunately, they work fine and this'll help you to go pass the login screen and fix the issue.

I had a similar problem with macOS 10.12.6 on my 2017 iMac. The problem goes away when I disconnected an external USB hard drive (Sabrent enclosure) and returns when I reconnect the drive.