Windows 7, VirtualBox, OpenSUSE 11.4 (native install), X11 and fglrx driver

Hello. I have a little bit of problem…

I have a native installation of opensuse 11.4 x64 that uses fglrx driver (mainly for compiz). Today I had a very brilliant idea to run that natively installed opensuse in VirtualBox (on windows 7). All things went quite good until the point where X server was trying to run due to fact that VirtualBox could not find my ati graphics card. I solved this by changing my xorg.conf to original (install) one.

And here is what bothers my: is it possible to force X server to try running from default xorg.conf.install if running from xorg.conf fails? I find it quite uncomfortable to switch xorg.conf with xorg.conf.install manually each time I want to run opensuse natively/as vm.

Well … you can have several “SeverLayout” sections in xorg.conf, each of them including a different “Screen” section in turn including a different “Device” section that uses another graphics card and driver. As long as you use startx, you can the use -layout option on the command line. In other cases (in most cases since the use of startx is deprecated) you will have to modify the X server options of the session manager (probably not easier than switching xorg.conf).
Recipe 15.8. Choosing Different ServerLayouts at Startup

So basically I should modify startx script to:


#!bin/bash
if (lspci -v | grep -Fxq "VirtualBox Graphics Adapter")
then
    original_startx -layout VirtualMachine
else
    original_startx -layout FGLRX
fi

or even replace kdm script to:


#!bin/bash
if (lspci -v | grep -Fxq "VirtualBox Graphics Adapter")
then
    if (-e /etc/X11/xorg.conf)
    then
        rm /etc/X11/xorg.conf.vmtmp
        mv /etc/X11/xorg.conf /etc/X11/xorg.conf.vmtmp
    fi
else
    if ( -e /etc/X11/xorg.conf.vmtmp)
    then
        rm /etc/X11/xorg.conf
        mv /etc/X11/xorg.conf.vmtmp /etc/X11/xorg.conf
    fi
fi

original_kdm

?

If you’re using different xorg.conf, then you don’t need layouts and you’re back to your first solution.
If you use different layouts in the same xorg.conf, the startx syntax would be:

#!bin/bash
if (lspci -v | grep -Fxq "VirtualBox Graphics Adapter")
then
    original_startx **--** -layout VirtualMachine
else
    original_startx **--** -layout FGLRX
fi

The client options are separated from the server options by “–”. See man startx for more details.

If you’re using kdm, I think you could pass the layout (among other options) to **ServerArgsLocal ** in kdmrc. But I never tried - I use startx when I need more then one layout (such as for dual, left and right monitor).

I found even better solution - editing (a bit) xdm script.
Changing:


if cat /proc/cmdline | grep -q x11failsafe; then
    if  -f /etc/X11/xorg.conf.install ]; then
        export XORGCONFIG=xorg.conf.install
        echo
        echo "Using failsafe X.Org configuration ..."
    else
        echo
        echo "The failsafe failed ..."
        rc_status -u
        rc_exit
    fi
fi

to


if cat /proc/cmdline | grep -q x11virtualmachine; then
    if  -f /etc/X11/xorg.conf.virtualmachine ]; then
        export XORGCONFIG=xorg.conf.virtualmachine
        echo
        echo "Using failsafe X.Org configuration ..."
    else
        echo
        echo "Virtual machine confing (xorg.conf.virtualmachine) not found - skipping..."
    fi
fi

if cat /proc/cmdline | grep -q x11failsafe; then
    if  -f /etc/X11/xorg.conf.install ]; then
        export XORGCONFIG=xorg.conf.install
        echo
        echo "Using failsafe X.Org configuration ..."
    else
        echo
        echo "The failsafe failed ..."
        rc_status -u
        rc_exit
    fi
fi

This method requires adding line to menu.lst with new boot option x11virtualmachine, but I had to do it already to alter vga option, so this way is better for my ;).