Dual Monitor Linux Virtual Machine Strangeness

VirtualBox’s seamless mode is a pretty neat way to work with a virtual machine and a great way of working with two different operating systems at the same time in an almost seamless way. Windows from both the host machine and the virtual machines can exist side by side almost as if they are the machine. No more working with the virtual machine in its own isolated window. It does require having the VirtualBox Guest Additions installed on the virtual machine but once installed you are ready for seamless mode. To get to seamless mode you use ctrl+l if you have not set a different host key.

On a single monitor things are pretty simple and seamless mode mostly just works. On a dual monitor system you can get some strangeness.

First, I am working with a Windows 7 host with Kali Linux and Samurai WTF virtual machines for security testing. I have not tried other Linux distributions this way yet but if there are issues there the fixes may be similar.

Setting up a VM to use dual monitors is simple using the VM’s display settings. Set the monitor count to 2 and increase the video memory until you get to at least an acceptable amount if not more like I have. VirtualBox will let you set too low a memory setting so watch this!

vm_dual_monitor_settings

Click OK and when you next start the virtual machine you will have dual monitors.

Now the strangeness.

Cloned/Mirrored Mode Startup

When I start the VMs, they come up with the desktops in cloned mode (or mirrored mode depending on the distribution’s prefered term) where both displays are the same rather than as extended desktops. With Kali this only happens the first time I started the VM with dual monitors and then during every initial logon but once logged on it reverts to the way you want it. With Samurai it happens with every startup. Fixing this is similar on both distributions. Go to the systems settings dialog box. On Kali you want the Display settings and on Samurai you want Display and Monitor. To avoid some additional strangeness do this while the virtual machines are in full screen mode. (Ctrl+f if you have not remapped the host key in your virtual machines.) If you are not in full screen mode you will get some of the other strangeness you can get.

When you first start Kali in dual monitor mode the Mirror displays check box will be checked. Uncheck it.

Kali_display_settings

When you first start Samurai VBox1’s position will be set to Clone of VBox0. Set it to something different. You have to do this every time Samarai starts up.

samurai_display_settings

With either distribution you should close the display settings dialog boxes before changing the VM’s display modes or you will run into the strangeness below.

Resizing or Switching out of Full Screen Mode

If you have the display settings dialog box open when you resize the windows or switch out of full screen mode, the system detect the change in resolution and the dialog gets updated. When you go to close the dialog it asks if you want to keep the changes or abandon them. Saving them can cause some weird behavior. Windows might disappear entirely or jump from one screen to another. I have also had the two display positions switch from relative (left, right, etc.) to absolute positioning which can cause display overlap and some rather unexpected behavior until you realize what has happened.

The best bet is to just make sure the display settings dialog is closed before you resize the screen or switch screen mode and let the guest additions handle the screen size and mode changes from then on.

Lost Start Menu and Panels

When you switch to seamless mode, the start menu of the virtual machine can disappear entirely. It is not consistent but happens occasionally when you switch to seamless mode when you have no windows open on the virtual machine. (This also happens on single screen setups so this isn’t a dual monitor only issue.) The simple fix is to go back to full screen and open a window before going back to seamless mode.

Screen Positioning

Screen positioning can be rather interesting if you do not set the virtual machine’s displays up the same way as the physical layout. The key thing to keep in mind here is both the screen positioning of the host operating system AND the virtual machines are in play here. You can use this to your advantage to solve one of the issues I encountered in trying to work the way I want to work.

I like to have my host OS’s main desktop on the left of the two monitors and the virtual machine’s main desktop on the right. In full screen mode, you can set this up in the virtual machine’s settings the way you would expect and things work fine. Switch to seamless mode and it goes weird. Windows can disappear, the start menu can go away even with windows open. It just does not behave the way you would expect. For some reason the Linux distributions in question (and maybe others) do not like having the main desktop on the right and the extended desktop on the left when you switch into seamless mode.

You can fix this in a counterintuitive way. Remember both the host OS screen position and the virtual machine’s screen positions are in play here. Set the virtual machines to think its extended desktop is to the right of the main desktop even though it is physically on the left. The host’s screen positions can make it seem to you that the virtual machine’s extended desktop is on the left. Set the virtual machine’s extended desktop to be to the right of the main desktop and the weirdness in seamless mode goes away. The host machine’s arrangement simply takes over. The virtual machine will still think its extended desk is to the right so you will get delightful effects like drag a window to the edge of the right screen and watch it appear on the left edge of the left screen but this is minor. I get to work the way I want to work and the weird behavior has gone away.

Screen Time Out

While not really weird, if you have different time out settings on your host display and a shorter one on the virtual machine’s display, you will see you open virtual machine windows go black if they remain idle long enough. Set actual screen savers and things do get weird. The VM may switch out of seamless mode when the screen saver kicks in. Best to not set one and let the host OS control this.

Anybody else go fixes to the weirdness above or experienced other Linux virtual machine dual monitor weirdness?