My PC is running Debian Buster, and it's boot time seems to be slowed down by keyboard-setup.service. I understand that this is involved in setting up the keyboard for use at the console. The output of systemd-analyze blame is as below. I've checked it a number of times and it's always been similar.

 5.549s keyboard-setup.service
 5.063s dev-sda2.device
 4.140s udisks2.service
 3.565s accounts-daemon.service
 3.487s console-kit-log-system-start.service

This makes me wonder why I need to spend 5.5 seconds setting up my keyboard every time I boot. Is keyboard-setup supposed to be this slow?

If yes, then why? What's it doing? And is it safe to just disable it?

If no, then what's going wrong and how should I go about fixing it?

Edit: systemd-analyse critical-chain

graphical.target @17.385s
└─gdm.service @15.588s +1.797s
  └─rc-local.service @15.476s +110ms
    └─network.target @15.475s
      └─networking.service @14.971s +502ms
        └─apparmor.service @8.262s +3.147s
          └─local-fs.target @8.256s
            └─boot-efi.mount @8.000s +255ms
              └─local-fs-pre.target @7.971s
                └─keyboard-setup.service @2.421s +5.549s
                  └─systemd-journald.socket @2.420s
                    └─system.slice @2.417s
                      └─-.slice @2.186s
  • The service is taking a long time to timeout. Try to: edit /lib/systemd/system/keyboard-setup.service, and adding the line: TimeoutStartSec=10sec after the last line of [Service] bit. – vfbsilva Dec 29 '17 at 14:07
  • 1
    You would have a better question for editing the output of systemd-analyze critical-chain into it. – JdeBP Dec 29 '17 at 14:25
  • @vfbsilva Unlike askubuntu.com/q/919428/309061, the service is taking 5 seconds to start, not 20. Adding TimeoutStartSec=10sec doesn't have any effect. – GKFX Dec 29 '17 at 17:17

The best suggestion is to put a timeout limitation for the service to control the time it consumes at start up.  You may do this with two methods:

sudo mkdir -p "/etc/systemd/system/$SERVICETOFIX.d"
sudo echo -e "[Service]\nTimeoutStartSec=10" | tee "/etc/systemd/system/$SERVICETOFIX.d/reduce-timeout.conf"

Method 2: I personally prefer this method: First run sudo systemctl edit keyboard-setup.service, and then in the editor add the below and then save and exit the editor.

  • Hi AndyBaba! Thanks for the advice, but it was made clear in the comments on the question why this wouldn't work. – GKFX Dec 15 '18 at 20:28
  • Hi GKFX:) I guess in that regard you are right, however this is still a helpful tip to use for similar cases caused by other services. I do apologize if my answer if its not helpful though. – AndyBaba Dec 16 '18 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.