Using VIX and vmrun with VMPlayer 5.0.0 on linux

November 1, 2012

I’ve been having problems with VMWare on a Linux host. I have a guest OS of Windows 7 Pro 64 bit. After running for a day or so it will usually get into a state where something is going crazy with the video driver and Linux appears to be unresponsive.  I can remotely log into the linux box and see that VMWare is using a lot of resources, but there should be plenty of memory still. Hopefully I can figure out why this is happening, but until then, I’d like to be able to shut down the VMWare guest gracefully without having to kill the app.

I am using the free VMPlayer 5.0.0 which does not come with any command line tools for control of guest VMs. However, VIX tools are available as a separate download. (You will need a My VMware account to download the package.)

Once I downloaded and installed the package I tried using the vmrun tool, but was running into some issues.

$ vmrun -T player list
Unable to connect to host.
Error: The specified version was not found

This page pointed my in the right direction. For VMPlayer 5.0.0 I had to add this line to the file /usr/lib/vmware-vix/viwrapper-config.txt

player   14  vmdb  5.0.0 Workstation-8.0.0-and-vSphere-5.0.0

Add that line below the last player line.

Now I was able to see my running guest VM and shut it down gracefully.

$ vmrun -T player list
Total running VMs: 1
$ vmrun -T player stop /VM/Windows7x64/Windows7x64.vmx soft

Documentation on VIX tools can be found here.
Also useful was this link.

Multicast over Linux bridge

July 9, 2012

Lately I’ve been working on testing multicast functionality. The quickest way to set up a multicast network has been to create several VMs and hook them together via private bridges. I’ll give a brief outline of the setup to provide some clarity, though what I should really do is provide some nice diagrams. Maybe later…

My setup consists of host A which is the VM host and the multicast sender. Hosts B and C are multicast routers with Xorp PIM router running. A, B and C are all connected to bridge br01. Hosts D and E are listeners to the multicast stream. D is connected to eth1 of B over bridge br02. E is connected to eth1 of C over bridge br03. So there is a bit of a tree being created.

Initially multicast is received properly by hosts D and E. But after 5 minutes E stops receiving any multicast data. The PIM router on C needs to be restarted to recover. After much debugging I found that multicast traffic on br01 was no longer being forwarded on to host C. The solution to this issue is detailed here. Essentially, multicast snooping needs to be disabled because PIM is not supported in the snooping.

gitk broken on cygwin

June 6, 2012

After recently updating cygwin I found that gitk no longer would launch.

$ gitk
Application initialization failed: couldn't connect to display ":0"
Error in startup script: couldn't connect to display ":0"
   while executing
"load /usr/lib/tk8.5/../../bin/libtk8.5.dll Tk"
   ("package ifneeded Tk 8.5.11" script)
   invoked from within
"package require Tk"
   (file "/usr/bin/gitk" line 10)

Turns out that Tk has switched to using X11, so to keep using up to date Tcl/Tk code cygwin had to make the switch. Here’s some details.

To get gitk working again I had to install the cygwin packages xorg-server and xinit.
Then I started the X server (I recommend using startxwin)

$ startxwin


Some old gitk settings caused this error:

unknown color name "SystemButtonFace"


So I had to remove the gitk config file

$ rm ~/.gitk


Back up and running again, if a little heavier weight. If you don’t use a lot of the other cygwin features I would recommend using MsysGit or GitExtensions for git on Windows. I like the linux style interface so I will stick with cygwin.

Non-root wireshark capturing in Linux

May 29, 2012

 On Debian-based platforms (such as Ubuntu) by default you can’t capture data unless you are root. Some information about this is given here. However you can change this so anyone in the wireshark group can capture.  There is a security concern in this but it seems to me not much worse than starting a root shell to do the capture.

First reconfigure the wireshark install.

$ sudo dpkg-reconfigure wireshark-common

Select ‘Yes’ to enable SUID in wireshark.

Now add the users you want to the wireshark group.

$ sudo adduser user1 wireshark

You may also need to set caps.

$ sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap

Before you are able to capture you will need to log out and log back in again for the groups change to take effect.

More info on capture priviledges.

Extracting contents of an RPM without installing it

May 9, 2012

How to extract the contents of an rpm without installing it.

Cygwin sshd CYGWIN environment variable

March 21, 2012

I usually follow this howto to setting up an sshd server on Windows through cygwin, ’cause I can never remember all the gotchas. Unfortunately there is one item out of date. The CYGWIN environment variable should be set to ntsec only.

To fix this I followed the instructions in this useful post. Involves changing registry settings.


KDE Debugging / Synergy Plasmoid

March 2, 2012

I’m setting up a new laptop and trying out Kubuntu 11.10 (Oneiric Ocelot). KDE 4 has a nice widget for easily turning Synergy on and off. I was able to get the widget by going through the Add Widgets menu and clicking on Get New Widgets, then Download New Plasma Widgets. There I searched for synergy and it was the first result. I installed it with no issues. However, when I went to add it to my desktop I got the following error.

Could not create a ruby-script scriptengine for the Synergy widget

I figured this was a dependency issue and did some searching for the packages I would need. Then I installed these.

$ sudo apt-get install ruby-kde4 ruby-plasma korundum4 ruby plasma-scriptengine-ruby

This automatically installed a lot of other packages too. I removed the widget and added it again, but now I got a different error.

Script initialization failed.

Starting to dig a little deeper I found out about a useful tool kdebugdialog that allows enabling debugging on different levels of KDE components. However, I also found that I could launch the plasmoid from a shell and see the debug output directly.

$ plasmoidviewer /home/user/.kde/share/apps/plasma/plasmoids/synergy

This started the plasmoid and I saw an error in the logs

in ‘const missing’: uninitialized constant KDE::UrlRequester (NameError)

I tried some other packages but was unable to avoid the error. I finally found the official page for the Synergy plasmoid and saw that it appears to be broken as of KDE 4.5.

So no solution, but maybe the troubleshooting steps will be helpful elsewhere.

Heroku on Ubuntu 10.04 (Lucid)

February 10, 2012

I was setting up my laptop for development and production on Heroku. I followed the guide for ubuntu linux and ran the installer, but when I tried

heroku login

I got this error

/usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/restclient.rb:9:in `rescue in ': no such file to load -- net/https. Try running apt-get install libopenssl-ruby (LoadError)
from /usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/restclient.rb:5:in `'
from /usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/rest_client.rb:2:in `require'
from /usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/rest_client.rb:2:in `'
from /usr/local/heroku/lib/heroku/client.rb:2:in `require'
from /usr/local/heroku/lib/heroku/client.rb:2:in `'
from /usr/local/heroku/lib/heroku.rb:3:in `require'
from /usr/local/heroku/lib/heroku.rb:3:in `'
from /usr/local/heroku/lib/heroku/cli.rb:1:in `require'
from /usr/local/heroku/lib/heroku/cli.rb:1:in `'
from /usr/bin/heroku:29:in `require'
from /usr/bin/heroku:29:in `'

Installing libopenssl-ruby didn’t help. It turns out that the heroku binary depends on ruby 1.9.1. The default ruby on Lucid is 1.8. So I did

apt-get install libopenssl-ruby1.9.1

Running heroku login again got this error

/usr/local/heroku/lib/heroku/command/run.rb:1:in `require': no such file to load -- readline (LoadError)
from /usr/local/heroku/lib/heroku/command/run.rb:1:in `'
from /usr/local/heroku/lib/heroku/command.rb:14:in `require'
from /usr/local/heroku/lib/heroku/command.rb:14:in `block in load'
from /usr/local/heroku/lib/heroku/command.rb:13:in `each'
from /usr/local/heroku/lib/heroku/command.rb:13:in `load'
from /usr/local/heroku/lib/heroku/cli.rb:8:in `start'
from /usr/bin/heroku:30:in `'

I installed libreadline to resolve it.

apt-get install libreadline-ruby1.9.1

Now all the heroku getting started steps work.

Thanks to this post for giving me some insight.

GNU Makefile if problems

January 24, 2011

Adding functionality into a makefile can be a very frustrating process. I was recently trying to add a check for modified files before compiling.  Here’s how the rule looked:

ifneq ( $(shell git ls-files -m | wc -l), 0 )
    @echo Detected modifed files.
    @exit 2 ;

Basically, if any files were found changed the error would be printed. However, this would never work. I verified that git ls-files -m | wc -l returned 0 but the code would always execute. I eventually found the solution in the GNU Make documentation. From the page

Conditional directives are parsed immediately. This means, for example, that automatic variables cannot be used in conditional directives, as automatic variables are not set until the recipe for that rule is invoked. If you need to use automatic variables in a conditional directive you must move the condition into the recipe and use shell conditional syntax instead.

So essentially the shell command was never run when the ifneq was being parsed. I assume the strings were being compared which would explain always failing the equal test. The correct way to implement this test is then:

    @if [ $(shell git ls-files -m | wc -l) -ne 0 ] ; \
    then \
        echo Detected modifed files. \
        exit 2 ; \

KDE Hex Editor

October 7, 2010

Took me a while to find the name of the Graphical hex editor for KDE.