37

I am trying to understand what I need to do to speed up my boot with Ubuntu 16.04. I have run dmesg and saved the output here. It all seems to go wrong after about 10 secs in.

  • If you look at your dmesg, you may well find an entry such as 'new mount options do not match the existing superblock'. If so Google for that string and it will lead you to a Linux bug which has never been fixed – NickT Apr 23 '16 at 12:30
  • I don't think I am seeing that error or similar. – Packwood Apr 24 '16 at 14:19
  • Why do you feel things become bad at 10 secs in? Which message do you think is specially worrying? – Ciro Santilli 新疆改造中心 六四事件 法轮功 Jun 18 '18 at 9:57
41

You can try to find out what is taking the most time with systemd

systemd-analyze blame
  • 26
    Yes so what after? do i have to stop some services from running? – mohammed amine bourkadi Sep 18 '16 at 0:24
26

Editing /etc/fstab's UUID of the swap space (to match the output of sudo blkid) worked like a charm!

Note: After that, if there are any swap entries in /etc/crypttab file, you should change its second parameter to match with your swap space, either by UUID or path (i.e. UUID=something or /path/to/swap).

On my SSD the bootup went from 2 mins down to less than 10 seconds.

The thing is, I just did a normal upgrade from 14.04 to 16.04, no messing around with partitions, when this problem started. Clearly there is some issues with the upgrade procedure.

  • Thank that helped me a lot : for test purpose I had put a swap on a removable caddy, no boot problem when the disk wasn't there on 14.04, on 16.04 boot took 1 or 2 minutes more . It seems that kernel 3 was faster than kernel 4 when not founding the swap. – Emmanuel Aug 19 '16 at 8:25
  • Thanks. you saved my alot of time. I was also upgrading the system from 14.04 so this issue occurred. – PaladiN Jun 18 '17 at 4:57
  • Thanks, I had the same issue with incorrect swap UUID, once I changed it to match blkid it took a long startup time of about 60 seconds to just 5 seconds – Brandon Søren Culley Aug 17 '17 at 3:38
  • 1
    Look in askubuntu.com/questions/38533/… answer for more info on how to do it. It reduced my boot time from 100+ seconds to 15. – Dmitry Sep 17 '17 at 16:58
  • yea, upgrade to 17.10 but my swap uuid match whit the result from "blkid" – Vasil Valchev Oct 23 '17 at 10:47
9

It's a workaround solution but this reduced my boot time significantly (from 1 min 24s to 16s).

sudo vim /etc/systemd/system.conf

Uncomment these two parameters and set the desired timeout:

DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s

Note: Please optimize these values to match your hardware needs ~ 5 - 60s.

As discussed here these parameters configure the default timeouts for starting and stopping of units, as well as the default time to sleep between automatic restarts of units, as configured per-unit in TimeoutStartSec=, TimeoutStopSec= and RestartSec= (for services, see systemd.service(5) for details on the per-unit settings).

For non-service units, DefaultTimeoutStartSec= sets the default TimeoutSec= value. DefaultTimeoutStartSec= and DefaultTimeoutStopSec= default to 90s. DefaultRestartSec= defaults to 100ms.


Edit - More in detail:

I analyzed the boot sequence with systemd-analyze plot > sequence.svg that showed services failing to start on my freshly upgraded OS. There were three - one was a misconfigured sendmail daemon then powerd.service & NetworkManager-wait-online.service. Since it's not a good idea to disable the NetworkManager service entirely I just let it timeout after 10 secs and applied this rule globally.

  • 2
    Could you expand on how this solution reduced your boot time by 68 seconds? – Elder Geek Oct 4 '16 at 14:11
  • No probs, enjoy! – Mirek Oct 5 '16 at 21:52
  • it doesn't work for me as after applying the changes my boot time went from 52 to 57 seconds. – Woeitg Nov 7 '16 at 9:13
  • 1
    10s is too low. It can make boot into recovery mode. I'm using 30s – Anwar Oct 27 '17 at 13:19
  • 10s broke my booting in 18.04. Now repairing Ubuntu in recovery mode. – Pasupathi Jun 17 '18 at 14:06
7

I ran into similar problem of longer boot time after upgrade.

What was the problem? I had deleted my swap space, so my /etc/fstab file and new file system had conflicts. The Boot loader waited for almost 1m 30s to find it.

How I solved the problem Run sudo blkid

Open your /etc/fstab file and compare the uuid's match with partitions you have. If there is mismatch change that and reboot.

  • The dmesg output in the question shows that OP has a different problem. – Byte Commander Jul 30 '16 at 10:55
1

This could be related to filesystem issues. You may want to check this link to see if repairing your filesystem improves boot time: https://help.ubuntu.com/community/FilesystemTroubleshooting

  • Hmm. now seems to be [longer!] (pastebin.com/a5g4wHvA) Looks like it goes wrong after around 30 secs. "eth0: link is not ready" "nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead" – Packwood Apr 24 '16 at 14:14
0

I had a similar problem I just solved: I run Ubuntu 16.04 on an SSD . I use a flash drive as swap partition . The drive had accidentall been moved slightly and it took more than 3 minutes to boot. I put it back correctly and now everything is fine. In case you tried smartctl or fsck and your filesystem is o.k, try to remove flash drives (or other peripherals?) and see how it goes. Good luck!

0

Based on your pastebin output a couple things jump out at me:

EXT4-fs (sda5): re-mounted

You may wish to fsck this volume and take a look at Smart Data for that drive.

and

[   31.022220] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   45.720952] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   45.761548] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

You might try disabling IPV6 on your network connections if your connection doesn't support it.

0

Following user536489's hint:

systemd-analyze blame

Check if there is a service that takes long to start and set a lower timeout:

sudo vim /lib/systemd/system/networking.service

Change TimeoutStartSec to something like 10s. The man page states Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass "infinity" to disable the timeout logic.

protected by Community Oct 21 '16 at 13:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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