Original post by: Reece ,
Open it first, and check for any obvious liquid damage. The trackpad on the 2015 13" MacBook Pro (assuming it is a 13") must be recognised by the MacBook in order for the keyboard to work. If the trackpad is unplugged, or there is an intermittent fault with the cable, both the trackpad and cable will not work. I have never tried booting into another OS when I come across one with this issue, but I imagine Mac OS uses some signals transferred through the trackpad cable Ubuntu does not, which is why it may work fine on another OS. There is a common fault with the trackpad cable on this model, which is easy to replace. If there is no liquid damage inside the Mac, I would recommend trying this first since the cable costs around £10. This issue can be very intermittent, so ones which I see will sometimes work fine, then stop working when put to sleep, or vice versa.