I reinstalled Ubuntu 17.04 Desktop 64-bit UEFI on my Laptop on a harddisk.

Laptop: Intel Core i5-5200U, Intel HD Graphics 5500, 16 GB Ram.

Booting takes ~120 seconds (from pressing the powerswitch to loginscreen, with Ubuntu 16.04.2 on a ssd it takes less than 20 seconds).


$ systemd-analyze blame
          5.187s dev-sdb2.device
          4.268s ModemManager.service
          3.138s accounts-daemon.service
          2.852s fwupd.service
          2.688s grub-common.service
          2.421s irqbalance.service
          2.367s apport.service
          2.360s gpu-manager.service
          2.269s NetworkManager.service
          1.641s thermald.service
          1.632s polkit.service
          1.567s rsyslog.service
          1.336s keyboard-setup.service
          1.241s lightdm.service
          1.240s plymouth-quit-wait.service
          1.231s speech-dispatcher.service
          1.172s udisks2.service
          1.159s apparmor.service
          1.019s alsa-restore.service
           976ms repowerd.service
           957ms upower.service
           900ms bluetooth.service
           821ms systemd-resolved.service
           792ms dev-hugepages.mount
           792ms dev-mqueue.mount
           789ms avahi-daemon.service
           755ms sys-kernel-debug.mount
           689ms systemd-cryptsetup@cryptswap1.service
           663ms systemd-modules-load.service
           638ms rtkit-daemon.service
           599ms systemd-backlight@backlight:intel_backlight.service
           540ms systemd-rfkill.service
           511ms systemd-udevd.service
           505ms systemd-fsck@dev-disk-by\x2duuid-F685\x2d7079.service
           456ms systemd-machine-id-commit.service
           455ms openvpn.service
           444ms systemd-timesyncd.service
           386ms systemd-user-sessions.service
           326ms systemd-journald.service
           321ms kmod-static-nodes.service
           273ms systemd-logind.service
           243ms colord.service
           239ms systemd-udev-trigger.service
           227ms wpa_supplicant.service
           199ms networking.service
           192ms console-setup.service
           191ms systemd-tmpfiles-setup-dev.service
           188ms pppd-dns.service
           184ms systemd-hostnamed.service
           171ms user@1000.service
           170ms systemd-localed.service
           165ms setvtrgb.service
           162ms systemd-tmpfiles-setup.service
           131ms dns-clean.service
           101ms systemd-journal-flush.service
            92ms resolvconf.service
            91ms sys-fs-fuse-connections.mount
            82ms systemd-sysctl.service
            79ms systemd-remount-fs.service
            70ms systemd-random-seed.service
            51ms ufw.service
            44ms systemd-update-utmp.service
            42ms boot-efi.mount
            37ms snapd.socket
            14ms plymouth-start.service
            11ms plymouth-read-write.service
             6ms snapd.autoimport.service
             4ms ureadahead-stop.service
             4ms dev-mapper-cryptswap1.swap
             3ms systemd-update-utmp-runlevel.service
             1ms swapfile.swap

systemd-analyze plot

Any ideas?

  • Why Legacy? Why do you have a /boot partition and why is it so big? This questions are more rhetorical than anything else and have the sole purpose of alerting you that you're doing the opposite of the recommended practices therefore problems are to be expected (as shown in the systemd log). – user589808 Apr 15 '17 at 9:04
  • i tried UEFI it took same time then i thought maybe BIOS is faster, the boot partition is because it is on a harddisk so i want the fastest part of the disk for my boot, the size is because on my other laptop with older kernels cleaned out is 250+ MB so 1 GB would be plenty. – user58634 Apr 15 '17 at 9:11
  • What you just commented is nonsense from top to bottom. – user589808 Apr 15 '17 at 9:17
  • do you have any recommendations for me? – user58634 Apr 15 '17 at 9:18
  • 1. A separated /bootpartition is only required for LVM. Otherwise is not even recommended. 2. Legacy boot can only be as good as the native (and always recommended) UEFI mode, never better and often worse for hardware support. 3. Not mentioned in your specs but if you have an addon graphics cards you may need to install proprietary drivers. – user589808 Apr 15 '17 at 9:30

Got it, it's a Ubiquity problem with encrypted home option: system hangs because of ecryptfs-setup-swap not working with swapfiles !

I set up Ubuntu with encrypted Home like i always do, with the fix as described in the link boot went from ~200 seconds down to ~30 seconds, this is on a hdd.

Edit: the problem is when installing Ubuntu with encrypted home, 17.04 creates a swapfile instead of a swap partition like previous versions, then the installer writes a faulty config file.

Quote, from the Original Bug Report:

In particular, ecryptfs-setup-swap puts in /etc/crypttab a line like this:

cryptswap1 UID=XXXXXXXX /dev/urandom

(like there were a swap partition with UID=XXXXXXXX) while with a swapfile it should put the following line:

cryptswap1 /swapfile /dev/urandom

If you manually change that line and reboot, you get rid of the problem - before rebooting, check also that your /etc/fstab file ends with:

#/swapfile none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0

Because of this error Ubuntu spends a long time waiting for the swap.

fixed systemd-analyze blame

fixed systemd-analyze plot

  • 4
    Can you please explain how this fix works? I almost cannot get it. I think there would be many others who also cannot understand the workflow for solving the problem – Mostafa Ahangarha Apr 22 '17 at 10:44
  • 1
    Thank you! My boot time went down from 2 minutes to 2 seconds. I did exactly what you say, changed that line to have /swapfile. Also note that the launchpad link you point to says there should be #/swapfile ... in the /etc/fstab, but I have /swapfile ... as you show here and it works perfectly. – Illidanek May 21 '17 at 8:05
  • Best solution of this trouble – Kostya Jun 27 '17 at 20:34
  • My boot time got reduced from 2 minutes to 15 seconds! Thanks a lot! – Pedro Rodrigues Jul 7 '17 at 15:19
  • Worked for me as well. It didn't speed boot up time but "shutdown -h" works and shuts down in a few seconds vs a couple of minutes. Ubuntu should really fix this when doing a dist-upgrade. – dude Jul 23 '17 at 3:30

Installing with LVM enabled also prevents this issue, (for Ubuntu MATE anyway) as it creates a swap partition.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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