# Mouse integration problem - FreeBSD 10.1 on Virtualbox



## MnAdA (Dec 27, 2014)

Hello,
I am new to the FreeBSD. I have spent a couple of days making installation for FreeBSD 10.1 on VirtualBox v4.3.20. While the installation didn't take so much time, I was suffering from the installation of the emulators/virtualbox-ose-additions to make the right resolution. After a while I figure out that I have to install devel/kBuild/ before I use `make install clean` for the  emulators/virtualbox-ose-additions. I worked but unfortunately the mouse in not integrated! Any advice?


----------



## wblock@ (Dec 27, 2014)

The port has dependencies on everything it needs, so manually installing other things first should not be necessary.  Maybe you did not update the ports tree before installing emulators/virtualbox-ose-additions?  Remember that the ports included with the installer disk were created at the time of the release, and are not updated afterwards.

For pointer integration, see the sample xorg.conf in https://forums.freebsd.org/threads/...ted-screens-does-not-match.49538/#post-276839.


----------



## MnAdA (Dec 28, 2014)

Actually I have tried this but unfortunately X dies during startup. The only problem I have is the mouse integration. Now the mouse is captured in the VM. I have to release it each time I want to return to host. I have tried the same in VMware and it's working fine (integration) . I don't know if the mouse integration feature is supported on Virtualbox?

I am using KDE, what should I write in place of: 
	
	



```
Identifier "xfce"
```


----------



## wblock@ (Dec 28, 2014)

That xorg.conf can be used without modification.  The identifier is just an arbitrary name and does not need to be changed.

VirtualBox mouse integration does work, I use it.  Again, it sounds like a problem with your ports.  emulators/virtualbox-ose-additions must be installed in the VM, not the host.  Did you update the ports tree in the VM before installing that port?  Did you modify /etc/make.conf at all?


----------



## MnAdA (Dec 28, 2014)

It worked, here is what I have done. I have made a new installation, updated the ports and upgraded all the packages then made `make install clean` for the emulators/virtualbox-ose-additions, then I used `Xorg -configure` as usual it terminated for the mismatch of the monitors. I used the generated xorg.conf.new to tweak by deleting any mention for monitor1 and card1 and copied to /etc/X11/xorg.conf.

Here is the /etc/X11/xorg.conf:

```
Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/local/lib/xorg/modules"
    FontPath     "/usr/local/lib/X11/fonts/misc/"
    FontPath     "/usr/local/lib/X11/fonts/TTF/"
    FontPath     "/usr/local/lib/X11/fonts/OTF/"
    FontPath     "/usr/local/lib/X11/fonts/Type1/"
    FontPath     "/usr/local/lib/X11/fonts/100dpi/"
    FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
    Load  "glx"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "vboxmouse"
    Option       "Protocol" "auto"
    #Option       "Device" "/dev/sysmouse"
    Option       "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
    Identifier  "Card0"
    Driver      "vboxvideo"
    BusID       "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection
```

Notes:

I had also to install kbuild before using the port emulators/virtualbox-ose-additions
This time when I used `Xorg -configure` the section module only list glx, before a lot of modules would appear. when I try to reboot, X dies during startup.

Thanks


----------



## wblock@ (Dec 28, 2014)

It is no longer necessary or even advised to run `Xorg -configure`.  Please stop using it.  To repeat, this is *all* that is currently needed in xorg.conf for a FreeBSD VirtualBox VM:

```
Section "ServerLayout"
        Identifier "xfce"
        InputDevice "Mouse1"
        Option "AIGLX" "Off" # disable AIGLX for VirtualBox Additions
EndSection

Section "InputDevice"
        Identifier "Mouse1"
        Driver "vboxmouse"
EndSection
```

(Technically, even that much is not required!  The mouse entry just makes it easy to move this from a VM to real hardware.)

With a current ports setup, it is not necessary to install kBuild manually.  Maybe you installed from an old version of ports that was from before entry 20130103 in /usr/ports/UPDATING.


----------



## MnAdA (Dec 28, 2014)

Thanks I have tried the attached xorg.conf and it's working too. Again as I mentioned I am new to FreeBSD, I would like to know the proper procedure to install from recent version of ports (I have made `portsnap fetch extract`, is it something different?)
And also you mentioned modify make.conf, what should go there?


----------



## wblock@ (Dec 29, 2014)

Please see Upgrading FreeBSD Ports.  If you have more questions about that, please start a new thread with a different title so that people see it.

Oh, and make.conf was only mentioned because sometimes people "optimize" it with settings that turn out to be problems.


----------

