Arduino Leonardo as USB KEYBOARD incompatibility with KVM device

I guess there might be a problem that the Leonardo at startup is a serial device first (to enable uploads of new programs). The KVM device (it might help to know which KVM device we're talking about) might simply ignore the device as it's not purely a keyboard device. Even when your sketch is activated there is also a virtual serial interface active to again enable the upload functionality by listening for a 1200 baud connection in which case the Leonardo will reboot. If these other USB devices disturb your KVM device, you must change your code to disable all serial functionality. The IDE developers made a lot of effort to prevent this so it might be tricky to realize inside the IDE.