The most common “legitimate” Linux keyloggers are

lkl, uberkey, THC-vlogger, PyKeylogger, logkeys

Logkeys is the only one available in the Ubuntu repositories.