CSM cannot be disabled and still use a PS2 keyboard. In fact, even some older USB devices will require CSM to be enabled. You MUST have ALL UEFI compliant hardware including peripherals that are connected, in most cases, especially if those peripherals are required for the POST process error checking, by USB.
What you CAN try to do to see if it will work as a band aid, is to go into the BIOS and disable the following two options if they are present, and they ARE for most modern motherboards from the last six years at least.
One, disable the option for the system to stop on error if no keyboard is detected.
Two, in cases where it is an older USB legacy device that is causing the problem, you can change the option for "full USB initialization during POST" to "partial USB initialization during POST". That will SOMETIMES resolve some issues of legacy devices during the POST process and allow the drivers for those devices to simply load once Windows or other OS environment takes over the boot process.
Otherwise, you need to either leave CSM enabled or get a newer keyboard that is fully UEFI compliant, so at least USB 2.0. Same goes for any other USB devices that are older legacy type hardware, or add in cards as well that are legacy non-UEFI.
The fact that it's Ubuntu doesn't really matter until after it has cleared the POST process environment.
I honestly doubt there is any work around for this so long as you are using a PS2 keyboard or other device though. That is absolutely a "legacy" device, and it cannot be supported by the UEFI boot environment.