keyboard-setup.service taking too long in startup (20+sec)

Solution 1:

@hector-muñoz-h's answer works, but it is not the right way. You should not edit distro files.

This is the right way:

FIXSERVICE="keyboard-setup.service"
mkdir -p "/etc/systemd/system/${FIXSERVICE}.d"
echo -e "[Service]\nTimeoutStartSec=10" > "/etc/systemd/system/${FIXSERVICE}.d/reduce-timeout.conf"

You can also use systemctl edit keyboard-setup.service and paste in the editor:

[Service]
TimeoutStartSec=10

Then save & quit the editor.

Solution 2:

Ok, I've managed to decrease dramatically the keyboard-setup.service from 20 secs to 2 secs. sudo gedit /lib/systemd/system/keyboard-setup.service,

and adding the line:

TimeoutStartSec=10sec

after the last line of [Service] bit. Turns out my problem was that this service was going to timeout and this had not been defined.