How to Resolve Slow Boot Times in Ubuntu 16.04

I’ve recently upgraded my machine from Ubuntu 14.04.4 to Ubuntu 16.04.1, but while my computer used to boot in about 40 seconds, after the upgrade boot times increased considerably to 2 to 3 minutes.The first easy check was to look at dmesg:

There’s a bit 87 seconds gap between checking for the floppy, and VirtualBox drivers loading. So there’s definitely an issue here, but the log does not exactly give a clear queue.

I’ve read you could use systemd-analyze to find which process(es) may be slowing down your computer at boot time:

Shell

1

2

3

4

5

6

7

8

systemd-analyze blame

8.121sapt-daily.service

7.658sNetworkManager-wait-online.service

931msdocker.service

710mswinbind.service

695msnmbd.service

647mssamba-ad-dc.service

543msModemManager.service

Two processes are taking close to 8 seconds, but those 16 seconds still do not explain why it takes 2 minutes more to boot…Eventually, I realized systemd-analyze has a few more tricks up its sleeves:

Shell

1

2

3

4

systemd-analyze

Startup finished in5.784s(kernel)+3min651ms(userspace)=3min6.425s

systemd-analyze plot>test.svg

The first command shows there’s no problem with the kernel itself, and something is slow in user space. The second command draws a huge boot chart (SVG), whose shape looks like the picture below.

So we have something to look at, namely the area just before the large gap… I’ve zoomed in on it:

There are a few things there including the DVDROM drive, and “Prolific Technology Serial Controller” connected to /dev/ttyUSB0. The latter is a USB to TTL debug board based on PL2303, so I removed it and rebooted my machine, and miracle! Boot time was reduced to just 17 seconds:

Shell

1

2

3

4

systemd-analyze

Startup finished in5.764s(kernel)+11.282s(userspace)=17.047s

systemd-analyze plot>test2.svg

The SVG chart shape, shown on the right, also changed completely as it booted most of the same services in much less time. So since I don’t use the debug board everyday, I’ll make sure I only connect it when needed. Ideally, I suppose a bug should be filled, but I’m not sure which package cause the issue.

On a rather unrelated note, yesterday I also decided to look into Firefox performance issues (switching or closing tabs would take 2 to 3 seconds), and I discovered recent versions of Firefox browser (47+ and greater) include support for “about:performance” tab showing which add-on(s), plugin(s), or page(s) may be problematic. Just let it run for a while, and go about your business browsing the web, and then come back to the tab to check if any has many alerts. It helped me find an add-on slowing down browsing considerably, so I disabled it, and performance is now much better.

So this morning without debug board nor wifi dongle it booted in 17 seconds. I’ll keep updating this comment with boot times:
11/08 – 17 seconds
12/08 – 17 seconds
13/08 – 3 minutes 6 seconds
I can see some new messages in dmesg that I did not notice when I first wrote the article: