Enabling VirtualBox in 2.6.31+ kernels

For sure reasons, after installing the latest kernel(2.6.32-23) in my Ubuntu machine, I had problems in running my virtual machines.

I have checked several sites which suggest that I re-run /etc/init.d/vboxdrv setup but still it fails to load:

$ sudo /etc/init.d/vboxdrv setup
* Stopping VirtualBox kernel module * done.
* Removing old VirtualBox netadp kernel module * done.
* Removing old VirtualBox netflt kernel module * done.
* Removing old VirtualBox kernel module * done.
* Recompiling VirtualBox kernel module * done.
* Starting VirtualBox kernel module
* modprobe vboxnetflt failed. Please use ‘dmesg’ to find out why

If you are to manually load the network module:

$ sudo modprobe vboxnetflt

FATAL: Error inserting vboxnetflt (/lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko): Invalid module format

One way to load this is

$ sudo insmod /lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko

Run lsmod and you will see this module loaded:

$ lsmod | grep vbox
vboxnetflt 14288 0
vboxdrv 1778380 1 vboxnetflt

The problem might occur during the next boot, so I suggest add the insmod (sudo insmod /lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko) lines on /etc/rc.local.


Searching for multiple words/string patterns using Grep

?: How do I search multiple string using the grep command? For example, I’d like to search wordA, wordB, wordC and so on within /path/to/file. How do I force grep to search multiple words?

A: Answer by citing an example, we would like to find error and warning messages in /var/log/messages:

cat /var/log/messages |grep “\(warning\|error\|critical\)”

or

grep “\(warning\|error\|critical\)” /var/log/messages