CasperSpeedup
Background
Casper and the boot process of live-cd images on ARM based hardware is currently very slow. As part of the blueprint mobile-lucid-une-casper-speedup the process needed to be first investigated, profiled and conclusions drawn on that information.
Time-stamping information was added to the call_scripts function in /usr/share/initramfs-tools/scripts/functions of a live-cd, the date binary added, and the initramfs recreated using ModifyCasper.
Initial Findings
The output from the initial time-stamping.
5 seconds plus (aka, the culprits)
26 seconds |
|
23 seconds |
|
11 seconds |
|
8 seconds |
|
8 seconds |
Two to 5 seconds (aka, should be looked at)
5 seconds |
|
4 seconds |
One second or less (aka, no use optimizing)
10driver_updates |
20iso_scan |
30custom_installation |
01integrity_check |
05mountpoints |
05mountpoints_lupin |
10custom_installation |
10ntfs_3g |
12fstab |
13swap |
15autologin |
18hostname |
20xconfig |
22gnome_panel_data |
22screensaver |
22serialtty |
23etc_modules |
23networking |
25configure_init |
30accessibility |
31disable_update_notifier |
32disable_hibernation |
33enable_apport_crashes |
34disable_kde_services |
36disable_trackerd |
37kubuntu_netbook_installer_link |
40install_driver_updates |
41apt_cdrom |
42disable_apparmor |
43disable_updateinitramfs |
44pk_allow_ubuntu |
46disable_services |
47unr_ubiquity |
More detailed analysis
10adduser
chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF set passwd/root-password-crypted * set passwd/user-password-crypted U6aMy0wojraho set passwd/user-fullname $USERFULLNAME set passwd/username $USERNAME set passwd/user-uid 999 EOF
Takes around 7 seconds.
chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null
Takes around 12 seconds.
chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF set passwd/root-password-crypted set passwd/user-password-crypted set passwd/user-fullname set passwd/username set passwd/user-uid EOF
Takes around 4 seconds.
19keyboard
Each of the
casper-preseed /root console-setup/layoutcode '' false casper-preseed /root console-setup/variantcode '' false casper-preseed /root console-setup/modelcode '' false casper-preseed /root console-setup/optionscode '' false casper-preseed /root console-setup/codesetcode '' false
Take around 4 seconds each.
24preseed
chroot /root debconf-communicate -fnoninteractive casper)"
Takes around 5 seconds.
14locales
chroot /root /usr/sbin/locale-gen "${LANG}"Takes around 7 seconds (chroot + generating the locale)
45disable_guest_account
chroot /root dpkg -P gdm-guest-session || true
Takes around 7 seconds to read the database (129858 files and directories according to the output)
22sslcert
chroot /root /usr/sbin/make-ssl-cert generate-default-snakeoil --force-overwrite
3 seconds are spent on the chroot, 1.5 seconds on the "make-ssl0cert:again".
35fix_language_selection
chroot /root fontconfig-voodoo --auto --quiet || true
Pretty much all the 4 seconds are spent here.
The original output
[04:59:48] Calling hook 10driver_updates [04:59:48] Calling hook 20iso_scan [04:59:48] Calling hook 30custom_installation [04:59:50] Calling hook 01integrity_check [04:59:50] Calling hook 05mountpoints [04:59:50] Calling hook 05mountpoints_lupin [04:59:50] Calling hook 10adduser Shadow passwords are now on. [05:00:16] Calling hook 10custom_installation [05:00:16] Calling hook 10ntfs_3g [05:00:16] Calling hook 12fstab [05:00:16] Calling hook 13swap [05:00:16] Calling hook 14locales Generating locales... en_US.UTF-8... done Generation complete. [05:00:24] Calling hook 15autologin [05:00:24] Calling hook 18hostname [05:00:24] Calling hook 19keyboard [05:00:47] Calling hook 20xconfig [05:00:47] Calling hook 22gnome_panel_data [05:00:48] Calling hook 22screensaver [05:00:49] Calling hook 22serialtty [05:00:49] Calling hook 22sslcert [05:00:54] Calling hook 23etc_modules [05:00:54] Calling hook 23networking [05:00:55] Calling hook 24preseed [05:01:06] Calling hook 25configure_init [05:01:07] Calling hook 30accessibility [05:01:07] Calling hook 31disable_update_notifier [05:01:07] Calling hook 32disable_hibernation [05:01:08] Calling hook 33enable_apport_crashes [05:01:08] Calling hook 34disable_kde_services [05:01:08] Calling hook 35fix_language_selector [05:01:12] Calling hook 36disable_trackerd [05:01:12] Calling hook 37kubuntu_netbook_installer_link [05:01:12] Calling hook 40install_driver_updates [05:01:12] Calling hook 41apt_cdrom Using CD-ROM mount point /cdrom/ Identifying.. [4dc8ab4694d3b0e7528f442bee3567df-2] Scanning disc for index files.. Found 1 package indexes, 0 source indexes, 0 translation indexes and 1 signatures Found label 'Ubuntu 9.10 _Karmic Koala_ - Release armel+imx51 (20091027.2)' This disc is called: 'Ubuntu 9.10 _Karmic Koala_ - Release armel+imx51 (20091027.2)' Copying package lists...gpgv: Signature made Tue Oct 27 21:59:50 2009 UTC using DSA key ID FBB75451 gpgv: key FBB75451 was created 1104415711 seconds in the future (time warp or clock problem) gpgv: key FBB75451 was created 1104415711 seconds in the future (time warp or clock problem) gpgv: Can't check signature: timestamp conflict E: Sub-process gpgv returned an error code (2) W: Signature verification failed for: /cdrom/dists/karmic/Release.gpg [05:01:13] Calling hook 42disable_apparmor Removing any system startup links for /etc/init.d/apparmor ... /etc/rcS.d/S37apparmor [05:01:13] Calling hook 43disable_updateinitramfs [05:01:13] Calling hook 44pk_allow_ubuntu [05:01:13] Calling hook 45disable_guest_account (Reading database ... 129861 files and directories currently installed.) Removing gdm-guest-session ... Purging configuration files for gdm-guest-session ... [05:01:21] Calling hook 46disable_services [05:01:21] Calling hook 47unr_ubiquity No value set for `/apps/netbook-launcher/favorites/favorites_list' No value set for `/apps/netbook-launcher/favorites/favorites_list' No value to set for key: `/apps/netbook-launcher/favorites/favorites_list'