/etc/init.d/virtualbox-ose wastes 10 seconds with find /lib/modules

Bug #369550 reported by Marius Gedminas
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
virtualbox-ose (Debian)
Fix Released
Unknown
virtualbox-ose (Ubuntu)
Fix Released
Wishlist
Daniel Hahler

Bug Description

Binary package hint: virtualbox-ose

bootchart shows me that /etc/rc2.d/S20virtualbox-ose spends 10 seconds doing disk I/O in find. I see this in the init script:

                if ! find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null
|grep -q vboxdrv; then
                    failure "No suitable module for running kernel found"
                fi
                if ! rm -f $DEVICE; then
                    failure "Cannot remove $DEVICE"
                fi
                if ! modprobe vboxdrv > /dev/null 2>&1; then
                    failure "modprobe vboxdrv failed. Please use 'dmesg' to find
 out why"
                fi

The sole purpose of that costly operation is to print a slightly more informative error message in case modprobe should fail.

I would suggest using 'modprobe -n -q vboxdrv' instead of find. Experiments show it takes only 1 second:

$ echo 3 |sudo tee /proc/sys/vm/drop_caches
3

$ time modprobe -n -q vboxdrv
real 0m0.995s
user 0m0.004s
sys 0m0.000s

$ time find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv
real 0m12.979s
user 0m0.036s
sys 0m0.076s

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 9.04
Package: virtualbox-ose 2.1.4-dfsg-1ubuntu3
ProcEnviron:
 LC_CTYPE=lt_LT.UTF-8
 PATH=(custom, user)
 LANG=lt_LT.UTF-8
 SHELL=/bin/bash
SourcePackage: virtualbox-ose
Uname: Linux 2.6.28-11-generic i686

Revision history for this message
Marius Gedminas (mgedmin) wrote :
Revision history for this message
Daniel Hahler (blueyed) wrote :

Thank you for your investigation and proposed solution. This sounds like a great improvement in boot time.

I'm looking into getting it fixed in Karmic and forwarded to Debian.

My results (please note that you should use "sudo" for the modprobe call):

$ echo 3 |sudo tee /proc/sys/vm/drop_caches
3
daniel@base { ~ }
$ time sudo modprobe -n -q vboxdrv

real 0m2.076s
user 0m0.008s
sys 0m0.004s
daniel@base { ~ }
$ echo 3 |sudo tee /proc/sys/vm/drop_caches
3
daniel@base { ~ }
$ time find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv

real 0m9.875s
user 0m0.028s
sys 0m0.072s

Changed in virtualbox-ose (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
tags: added: boottime performance
Daniel Hahler (blueyed)
Changed in virtualbox-ose (Ubuntu):
assignee: nobody → Daniel Hahler (blueyed)
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virtualbox-ose - 2.1.4-dfsg-1ubuntu4

---------------
virtualbox-ose (2.1.4-dfsg-1ubuntu4) karmic; urgency=low

  * Do not use find in virtulbox-ose init script, which saves about
    ~10s during boot/init (LP: #369550).
    Thanks to Marius Gedminas for the suggestion and bug report.
    - debian/patches/09-initscript.dpatch:

 -- Daniel Hahler <email address hidden> Thu, 30 Apr 2009 23:06:48 +0200

Changed in virtualbox-ose (Ubuntu):
status: In Progress → Fix Released
Changed in virtualbox-ose (Debian):
status: Unknown → New
Changed in virtualbox-ose (Debian):
status: New → Fix Released
Revision history for this message
Daniel Hahler (blueyed) wrote :

The fix submitted by me is wrong - I'll get the proper fix from Debian.

Changed in virtualbox-ose (Ubuntu):
status: Fix Released → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virtualbox-ose - 2.1.4-dfsg-1ubuntu5

---------------
virtualbox-ose (2.1.4-dfsg-1ubuntu5) karmic; urgency=low

  * Merge proper fix for LP: #369550 from Debian.
    - debian/patches/00list
    - debian/patches/09-initscript.dpatch
    - Drop debian/patches/08-

 -- Daniel Hahler <email address hidden> Tue, 05 May 2009 23:54:28 +0200

Changed in virtualbox-ose (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.