Ubuntu – How to improve the boot / shutdown time

12.10bootchartlaptop

I have a pretty decent laptop (Intel Core i7-3520M CPU @ 2.90GHz, SataII SSD from Samsung, 8GB Ram), but I not satisfied with my boot and shutdown times…
I have installed bootchart, and am trying to interpret it, but I don't understand some parts.

Bootchart output

In particular, I don't get what is happening during the first 10 seconds, when there is almost no CPU utilization, nor I/Os. What is happening then ? (there seem to be only udevd, modprobe and plymouth running).

On the other end of my daily work, I also experiente slow shutdown. No shotdown chart here, so I'm even more clueless…

Update
I have come accross a hint saying hitting the up key while shutting down gives access to the console (I had been fighting with F1 / Alt F1 before that). So I have seen that the long shutdown time seems to have to do with rpcbind and modem-manager being unable to quit cleanly… Any idea?

Update 2
I have uninstalled rpcbind, as well as modemmanager. This made things better for shutdown, but I still have several seconds waiting between the 'All processes ended within 1 seconds' message, and the real shutdown. Just then, I get a quick message I was unable to read yet, but I suspect some sort of timeout to occur…

Update 3
Ok, I think I have narrowed things down to the execution of resume and wait-for-root during the first 10 seconds of the boot process. This is taking more than 5 secs, with no disk nor noticable CPU activity. I noticed that swap UUID in /etc/initramfs/conf.d/resume does not match with the real UUID of my swap partition, which happens to be… crypted. Maybe that is the point ? Any hint on initramfs-tools and cryptswap ?

Best Answer

Ok, I have found the problem. As I was feeling, the 5 seconds waiting on resume and wait-for-root is not normal.

Googling around, I finally found this bug report: 5 second delay on wait-for-root

Essentially, it states that the 5 secs wait is due to a wrong entry in /etc/initramfs-tools/conf.d/resume.

It turns out that my swap is encrypted, and I had the initial installation UUID in /etc/initramfs-tools/conf.d/resume. I tried to put the one given by blkid for /dev/mapper/cryptswap1, but it didn't work...

I finally just commented out the entry in the file, and the 5 seconds delay is gone. Any way, hibernate is not enabled on my system (I think it is disabled by default in Ubuntu). Notice the # at the beginning of the entry.

#RESUME=UUID=3835540d-0cb4-46fc-b39a-de9ff88dcefd

then run:

sudo update-initramfs -u

So here is my latest bootchart:

bootchart

Much better. Regarding shutdown, removing rpcbind and modemmanager did the trick. I now have great boot and shutdown times.