Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i have a ubuntu10.10/win7 dual boot. i use win7 as a host for virtual box and run the existing ubuntu in virtual box.

when i installed vb additions and extensions, the xorg.conf file got overwritten.

depending on how i would boot (natively or through virtual machine) i have to change xorg.conf file manually. is there a way to make it automatic? putting both configs into xorg.conf file didn't work.

i filed a ticket couple days ago http://www.virtualbox.org/ticket/8360 but got no response. i'm sure there is a quick fix for this. any ideas??? i documented my experience (if u need more details) here: http://kirilligum.wordpress.com/2011/02/17/run-existing-linux-ubuntu-10-10-partition-in-virtualbox-under-host-windows-7-system-on-thinkpad-x201t/

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Create a script in /etc/init.d that runs during boot that detects whether or not it's running in a VirtualBox VM, and install the appropriate xorg.conf. Something similar to this should work:

if [ `dmidecode -s system-product-name` = "VirtualBox" ]
then
    cp /etc/X11/xorg.conf.vbox /etc/X11/xorg.conf
else
    cp /etc/X11/xorg.conf.real /etc/X11/xorg.conf
fi
share|improve this answer
    
i've made a .sh file with the script that you wrote, made it executable and put it into /etc/init.d/ it doesn't start on reboot. how do i make it start on startup? –  kirill_igum Apr 4 '11 at 16:15
    
That technique works for me on Fedora, but perhaps Ubuntu does it differently. Try calling your script from within /etc/rc.local. That file is supposed to run each time Ubuntu boots. –  cantfork Apr 5 '11 at 1:04
    
i just have to put the script in the folder and make it executable, right? –  kirill_igum Apr 5 '11 at 1:51
    
That's all you should need to do in /etc/init.d. But if that's not working, edit /etc/rc.local and call your script from there. –  cantfork Apr 5 '11 at 2:35
    
turns out i just needed to do update-rc.d vbstart.sh default , thank you! –  kirill_igum Apr 5 '11 at 3:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.