Monday 16 April 2012

How to create a core dump on Linux for VirtualBox

A core dump is very helpful for helping us tracking down crashes of VirtualBox. To create a core dump, start VirtualBox from a command line.

$ ulimit -c unlimited
$ sudo su
# echo -n 1 > /proc/sys/kernel/core_uses_pid
# echo -n 1 > /proc/sys/fs/suid_dumpable
# exit
$ VirtualBox
or better start the VM directly: 
$ ulimit -c unlimited
$ sudo su
# echo -n 1 > /proc/sys/kernel/core_uses_pid
# echo -n 1 > /proc/sys/fs/suid_dumpable
# exit
$ /usr/lib/virtualbox/VirtualBox -startvm VM_NAME
 
Ensure that no startup script (~/.bashrc, ~/.bash_profile, ~/.profile)
contains an instruction like ulimit -c 0 as the limicannot be increased once 
it was set to zero. The VirtualBox processes are started suid root, that is, with 
permissions to do things  that "normal" applications cannot. This is the reason for the 
$ sudo su 
$ echo -n 1 > /proc/sys/fs/suid_dumpable
$ exit

before starting the VM/GUI (note that sudo echo will not do what we want here).
When VirtualBox or one of its processes crashes, a file core.<pid>
 is created in the current directory. Be aware that core dumps can be 
very huge. Please compress the file before submitting it to a bug 
report.
you can check which core dump process created them using the command
$ file core.<pid>

No comments:

Post a Comment