Sunday, September 7, 2014

Ubuntu 14.04 (Trusty) and VMWare Unity Mode

Unity mode is a nice feature of VMWare's virtualization software. However, you will find that you cannot switch to VMWare Unity mode once you install the most recent release of Ubuntu including Ubuntu 14.04 (Trusty) and its predecessor (Ubuntu 13.10 or Saucy).

It turns out that VMWare does not like Ubuntu's default desktop environment called Ubuntu Unity. It could be confusing that the Ubuntu Unity desktop environment and the VMWare Unity mode share the same word "Unity", and it has created a difficulty  for us who try to find an answer  on the web since depending on what search terms you enter, web searches can give you answers related to both and it becomes a diffcult task to find a solution that may help you.

Since VMWare cannot switch to Unity mode is a result that VMWare does not like Ubuntu's default desktop environment called Ubuntu Unity, the solution becomes to find a Desktop Environment that VMWare can work with.

On Ubuntu 13.10 (Saucy), I found that Gnome 3 works with the VMWare Unity mode. Therefore, the solution is to install Gnome 3 and to use Gnome 3. To install Gnome 3, you may issue command below,
sudo apt-get update; sudo apt-get install gnome-session-fallback

I have been happily running Ubuntu 13.10 (Sauncy) as a guest operating system and using it in VMWare Unity mode for a quite while, well, until I upgrade it to Ubuntu 14.04 (Trusty). What is the problem? I checked the versions of Gnome 3 before and after the upgrade from Ubuntu 13.10 (Sauncy) to Ubuntu 14.04 (Trusty), they are the same,

$ gnome-session --version
gnome-session 3.9.90

I believe that it is still the issue with the Desktop environment that Ubuntu is running -- not VMWare tries not to support such a feature. Then, the task is to find out which desktop environment works with the VMWare Unity mode on Ubuntu 14.04 (Trusty). I found the list of Desktop environments that I may try from this post, 
I did not try all of them. However, I am happily to report that the following Desktop environments that work with VMWare Unity mode on Ubuntu 14.04 (Trusty),

  • Xfce
    To install it. Run
          sudo apt-get install xfce4
      
    or if you want more bells & whitsles, 
          apt-get install xubuntu-desktop
          
  • LXDE
    To install it. Run
          sudo apt-get install lxde
      
    or if you want the full desktop environment,
          apt-get install lubuntu-desktop
          
  • Mate
    To install it. Run
    sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
    sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install --no-install-recommends \
                        ubuntu-mate-core ubuntu-mate-desktop
    
    At this point, you can switch to VMware Unity mode. However, the application menu of the VMWare Unity mode is empty. This is the result that the VMware tools at present only recognoizes three desktop environments, Gnome, KDE, and Xfce -- if you run vmware-xdg-detect-de in your Ubuntu guest, you will see that the output of the script is empty. I made one minor change to the script,  and the VMWare Unity mode menu appeared. Below is the diff result on the script before and after the revision.
    diff \
      /usr/bin/vmware-xdg-detect-de \
      $HOME/vmware-tools-distrib/lib/bin32/vmware-xdg-detect-de
    63,67d62
    <   elif `dbus-send --print-reply --dest=org.freedesktop.DBus \
    <       /org/freedesktop/DBus \
    <       org.freedesktop.DBus.GetNameOwner \
    <       string:org.mate.SessionManager > /dev/null 2>&1` ; \
    <       then DE=gnome; # pretent to be gnome
    

    The complete script is at GitHub.
  • GNOME Flashback/Fallback

    As described before, to install it, run,
    sudo apt-get update; sudo apt-get install gnome-session-fallback
        
    Initially, I thought GNOME Flashback/Fallback stopped working with VMware Unity mode on Ubuntu 14.04. However, once I investigated further, I discovered that Ubuntu 14.04 reports the value of environmental variable XDG_CURRENT_DESKTOP as Unity. The solution is still to let vmware-xdg-detect-de return gnome. What I did is shown in this diff result,
    diff /usr/bin/vmware-xdg-detect-de \
         $HOME/vmware-tools-distrib/lib/bin32/vmware-xdg-detect-de
    58,60d57
    < DE=gnome
    < xdgDE=gnome
    

    The complete script using the approach described above (although not identical) is at GitHub. It is worth noting that when I manually set the environmental variable to GNOME in the user profile, e.g., adding the following line to $HOME/.profile, VMware Unity mode remains NOT working. 
    export XDG_CURRENT_DESKTOP=GNOME
    
    It begins to work only after I made the revision to vmware-xdg-detect-de as described above.

    A new problem I have encountered is that once VMware enters the Unity mode, in some of my Ubuntu virtual machines, the application menu is empty -- if you always launch programs from command line, it may not be too much of a problem. A further investigation indicates that this problem only occurs on the Ubuntu virtual machines that are upgraded from previous revision. I reinstalled the gnome-session-flashback and the problem went away. To reinstall the package, do,
    
    sudo apt-get install --reinstall gnome-session-flashback
    

    Just be aware that when you have GNOME Flashback/Fallback installed, you will have two options on the login screen, "GNOME Flashback (compwiz)" and "GNOME Flashback (metacity)". VMware Unity mode only works with the latter. In fact, VMware lists "a modern version of Metacity or KDE" as a prerequist to use the Unity mode on its website.

To conclude, below is what I have tried.


Testing Result of Desktop Environment for VMWare Unity Mode on Ubuntu 14.04 (Trusty)
Desktop EnvironmentDisplay Name in Login ScreenVMWare Unity Mode Works?
Ubuntu UnityUbuntu DefaultNo
GNOME 3GNOMENo
GNOME 3GNOME Flashback (Compwiz)No
GNOME 3GNOME Flashback (Metacity)Yes (See the note on Gnome above and
download vmware-xdg-detect-de)
XfceXfceYes
XfceXUbuntuYes
LXDELXDEYes
LXDELUbuntuYes
MateMateYes (See the note on Mate above and
download vmware-xdg-detect-de)
AwesomeAwesomeNo

However, if you try a different desktop envionment on Ubuntu 14.04 (Trusty) and it works or does not work with the VMWare Unity mode, please share it with me. I will update this post to include your result.


37 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thanks! I find LXDE to be the fastest. Now to figure out why the GUI elements don't refresh.

    ReplyDelete
  3. KDE seems to work fine for me, but I installed the bare build of XFCE to log into if my intention is to only use it in UNITY mode, since you don't get all the distracting transparency effects and artifacts that you do with the Plasma desktop and you can use all the KDE applications just fine under XFEC.

    ReplyDelete
  4. KDE seems to work fine for me, but I installed the bare build of XFCE to log into if my intention is to only use it in UNITY mode, since you don't get all the distracting transparency effects and artifacts that you do with the Plasma desktop and you can use all the KDE applications just fine under XFCE

    ReplyDelete
  5. I submitted a pull request to add in some usage info and notes about how I'm applying this to my virtual machines (and might actually build it into my Vagrant provisioning script).

    ReplyDelete
  6. Still getting an error when running unity mode: guest operating system resolution cannot be change. Using VMware 6 running Lubuntu 14 (LXDE).

    ReplyDelete
    Replies
    1. Have you installed VMware Tools? You may want to update it if you have installed it. Once you are done, reboot the virtual machine and see what it happens.

      Delete
    2. I hope that this VMware page helps you,

      http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1035392

      Delete
  7. It worked even for me. I'm using VMWare player on Windows 8.1 but I can't get it to display the Apps list on the Windows start (ie CTRL+SHIFT+U). I'm using GNOME Flashback (metacity). Any idea to populate the apps bar?

    ReplyDelete
    Replies
    1. What do you see under "/etc/xdg/menus"? Can you post the result of "ls -l /etc/xdg/menus" here?

      Delete
    2. I have the same issue, I am have vmware workstation 11 on windows 7.
      ls -l /etc/xdg/menus:
      -rw-r--r-- 1 root root 19337 Mar 17 2014 gnome-applications.menu
      -rw-r--r-- 1 root root 2827 May 10 2014 gnomecc.menu
      -rw-r--r-- 1 root root 8542 Mar 17 2014 gnome-flashback-applications.menu
      -rw-r--r-- 1 root root 2827 Sep 22 2014 unitycc.menu
      -rw-r--r-- 1 root root 3891 Nov 3 2013 unity-lens-applications.menu

      Delete
    3. The file listing seems to be OK. Can you check if the "Enable Applications Menu" is checked for Unity. In VMWare Player, you access it from the menu, following "Player -> Manager -> Virtual Machine Settings -> Options tab -> Unity". This picture shows the option for VMWare Player. You should find it similarly in VMware Workstation from its menu.

      Delete
  8. I got this to work with ubuntu 14.04 but not with ubuntu 15.04.
    I have the same list in /etc/xdg/menu but the application menu is empty (enable application menu is checked).

    ReplyDelete
    Replies
    1. Perhaps, you can try the following,
      (1) shutdown your Ubuntu guest completely and exit your VMware
      (2) go the Virtual Machine directory on your host, locate and delete the "caches" directory
      (3) start your Ubuntu guest again, log in and enter Unity
      Wait for a few seconds and see if the Application menu appears.

      Script "xdg-find-menus" (/usr/lib/vmware-tools/bin64/xdg-find-menus or /usr/lib/vmware-tools/bin32/xdg-find-menus) is responsible for locating the menu file. If the desktop is detected as "GNOME", then menu file should be /etc/xdg/menus/gnome-applications.menu. Hope this helps.

      Delete
  9. Hello,

    I tried almost everything from your tutorial on Ubuntu 14 guest system with Windows as host system and I didn't manage to get Unity mode working. I tried GNOMe and Xfce, I also tied to change vmware-xdg-detect-de, however nothing worked for me. What's strange, that i have no vmware-xdg-detect-de in /usr/bin, it is located in $HOME/vmWare/vmware-tools-distrib/lib/bin32/. What could be wrong?

    ReplyDelete
    Replies
    1. Have you installed VMWare tool? Is the installation successful? Can you please try "which vmware-xdg-detect-de" and see what comes up?

      Delete
  10. Hello,
    when I first tried your method in July with Ubuntu 14.04.3 LTS and GNOME Flashback (Metacity) it worked (even if there was an empty Application menu). Now after some package upgrades Unity mode does not work anymore and not only with GNOME Flashback (Metacity) but also with LXDE and XFCE (I've tried to install these also to see if was not working at all). I've also reinstalled VMWare tools because of kernel upgrades. I use VMWare Player 7.1.2 build 2780323 on Windows 8.1 64 bit. Please, can you suggest something else to check?

    ReplyDelete
    Replies
    1. I've fixed it myself. For some strange reason VMWare player was showing the Unity button grayed. After upgrading VMWare tools *not on guest Ubuntu* but via VMPlayer->Preferences->Download All Components Now it works as before.

      Delete
    2. I am glad that you fixed it. I am sorry that I could not look at it earlier. What you found is a good tip. Thank you for sharing it.

      Delete
  11. Hi,

    I have host machine, currently running on ubuntu 14.04.3. i'm using vmware 12.0 and installing windows 7 as guest machine.
    after following your tutorial, still no unity mode available.

    ReplyDelete
    Replies
    1. I am sorry that the post is about the Unity Mode for Linux Guest.

      Delete
  12. I also recommend you to watch this ubuntu installation video.
    https://www.youtube.com/watch?v=-DLZETe0onY

    ReplyDelete
  13. I'm running xubuntu desktop 15.04 on VMware Workstation 10.0.7. After reinstalling VMware tools several times it still does not work: desktop does not resize automatically, cannot enter unity mode, clipboards are not synchronized. /usr/bin/vmware-xdg-detect-de returns XFCE. What should I do?

    ReplyDelete
  14. Simply replacing the script with the one in github worked for me on Workstation 11 with Trusty guest. Thanks!

    ReplyDelete
  15. Simply replacing the script worked for me too. Though I ended up with the "empty menu" problem as well. Did some detective work based on Gray's recommendations above:
    "which vmware-xdg-detect-de" told me that system is using the one under /usr/bin/vmware-xdg-detect-de. This file was soft linked to /usr/lib/vmware-tools/bin32/vmware-xdg-detect-de*. Guess what I found when I went to "/usr/lib/vmware-tools/bin32/"? vmware-xdg-detect-de* was missing execute permissions for my account. Added the permission and restarted the VM. Voila - menu is back in Unity. Thanks for the help!

    ReplyDelete
  16. I am trying metacity on Ubuntu 16.04. When I look at the libraries used by metacity, I am seeing libunity-gtk*.so*

    fgrep unity /proc/`pidof metacity`/smaps

    Is an updated gnome flashback now based on Ubuntu unity? If so, that seems to mean even metacity will not work with VMware Unity.

    ReplyDelete
  17. Hello, Mr. Chen, I'm a Chinese student, my name is Liu Kun, English is not good can only use Google translation, please understanding.

    My installation environment:

    Linux d-virtual-machine 4.2.0-27-generic #32~14.04.1-Ubuntu SMP UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

    VMware Tools daemon, version 10.0.6.1643 (build-3595377)

    gnome-session 3.9.90 (Metacity)

    After the execution of your script, there is no successful open vmware unity mode.

    Could you help me? Thanks

    ReplyDelete
    Replies
    1. (1) which version of VMWare are you using?
      (2) can you resize the guest system (virtual machine) window?

      Delete
    2. (1)version : 11.0.0 build-2305329
      (2)yes

      When I use the default Toolkit VMwareTools-9.9.0-2304977.tar.gz ,it worked .

      But the shared folder (/mnt/hgfs) not work.

      So I referred to this method.(Links are as follows)

      URL:https://github.com/rasa/vmware-tools-patches

      And then put the script vmware-xdg-detect-de in vmware-tools-distrib/lib/bin32
      (Note:The VMware Tools version is VMwareTools-10.0.6-3595377.tar.gz rather than VMwareTools-9.9.0-2304977.tar.gz )

      reinstall the vmware-install.pl


      The result is a shared file work, VMware Unity does not work.

      Delete
    3. post the log:

      URL :https://drive.google.com/file/d/0B5g16c2UwEZPa25ZbjdidFVpaVk/view?usp=sharing

      Delete
    4. VMWare has dropped the Linux support of the Unity mode. Try in in older versions, such as, Workstation 10 or VMware Player 7 (https://my.vmware.com/en/web/vmware/free#desktop_end_user_computing/vmware_player/7_0|PLAYER-714|product_downloads).

      Delete
    5. Maybe this is the best way. Thank you very much for your patience.

      Delete
  18. This comment has been removed by the author.

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete