Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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:

share|improve this question
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" ]
    cp /etc/X11/xorg.conf.vbox /etc/X11/xorg.conf
    cp /etc/X11/xorg.conf.real /etc/X11/xorg.conf
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 default , thank you! – kirill_igum Apr 5 '11 at 3:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .