44

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.

3
  • 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, 2016 at 12:30
  • I don't think I am seeing that error or similar.
    – Packwood
    Apr 24, 2016 at 14:19
  • Why do you feel things become bad at 10 secs in? Which message do you think is specially worrying? Jun 18, 2018 at 9:57

8 Answers 8

46

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

systemd-analyze blame
1
  • 40
    Yes so what after? do i have to stop some services from running? Sep 18, 2016 at 0:24
29

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.

8
  • 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, 2016 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, 2017 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 Aug 17, 2017 at 3:38
  • 2
    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, 2017 at 16:58
  • yea, upgrade to 17.10 but my swap uuid match whit the result from "blkid" Oct 23, 2017 at 10:47
12

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.

3
  • The dmesg output in the question shows that OP has a different problem.
    – Byte Commander
    Jul 30, 2016 at 10:55
  • thanks @Gokul, you save my time, exactly the problem was different UUID between swap and /. I got the problem because installing new ubuntu without swap. Jun 19, 2020 at 16:09
  • I think you forgot the tell that we need to be root user before editing /etc/fstab to see the root level file. This fixed for me too.. I restored the backup from clonezilla. I think I need to figure out if I could also backup the swap partition. Jul 19, 2021 at 13:25
11

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.

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

1
  • 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, 2016 at 14:14
1

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

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

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .