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


so I'm trying to improve my startup time now 41.772s (using UBUNTU 17.04/GNOME 3)

I have solved some problems but I can't seem to find a solution to improve keyboard-setup.service

systemd-analyze blame:

20.671s dev-sda6.device
     20.294s keyboard-setup.service
     16.885s systemd-tmpfiles-setup-dev.service
     15.296s systemd-sysctl.service
     10.730s networking.service
      9.848s ntp.service
      6.699s NetworkManager-wait-online.service
      5.546s click-system-hooks.service
      5.229s ModemManager.service
      4.989s accounts-daemon.service
      4.741s NetworkManager.service
      4.343s grub-common.service
      3.740s iio-sensor-proxy.service
      2.926s repowerd.service
      2.102s systemd-modules-load.service
      2.043s colord.service
      1.847s fwupd.service
      1.770s upower.service
      1.529s switcheroo-control.service
      1.372s user@128.service
      1.357s polkit.service
      1.322s irqbalance.service
      1.167s systemd-rfkill.service

systemd-analyze critical-chain:

graphical.target @36.002s
 └─multi-user.target @36.002s
  └─systemd-resolved.service @34.741s +363ms
    └─network.target @34.733s
      └─wpa_supplicant.service @30.369s +679ms
    └─basic.target @24.005s
      └─sockets.target @24.004s
        └─snapd.socket @23.986s +16ms
          └─sysinit.target @23.928s
            └─apparmor.service @23.387s +538ms
              └─local-fs.target @23.384s
                └─run-user-128.mount @35.104s
                  └─local-fs-pre.target @23.384s
                    └─keyboard-setup.service @3.089s +20.294s
                      └─systemd-journald.socket @3.049s
                        └─-.slice @2.602s

Any help? Can I disable it and make the service start after boot? or should I install another keyboard driver?
My computer is a hp pavillion dv6 Intel i7, 8GB RAM


Best Answer

  • @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:

    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:


    Then save & quit the editor.

  • Related Question