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.
8 Answers
You can try to find out what is taking the most time with systemd
systemd-analyze blame
- 469
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.
- 35,017
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
- 146
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.
- 221
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
- 431
- 4
- 9
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.
- 36,752
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.
- 55
- 1
- 4
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!
- 11