Archives January 2010

HowTo: Fix Virtualbox not allowing you to attach USB devices to your virtual machines.

Virtualbox is a great desktop virtualisation tool, but one of its annoying installation niggles is that when you setup and run a virtual machine you can’t attach any USB devices to it at all because all your USB options in Virtualbox are greyed out.

There are a raft of different solutions to this problem out there ranging from adding an extra line to the /etc/fstab file to modifying your udev rules, but the real cause of this problem is simply that your login name does not have permission to access Virtualbox’s USB driver which interfaces itself between the VM’s virtual USB hardware and your real USB stack.

During the initial installation process, Virtualbox sets up a new group called vboxusers, but it doesn’t put your login name into it. Since using USB in Virtualbox occurs at the device level, your normal user permissions that allow you to run up virtual machines in general are not enough to manipulate Virtualbox’s USB driver. As a result, you cannot tell Virtualbox to attach a given USB device to your virtual machine.

Like most things, this is easily fixed of course.

  1. If your login name is johndoe, all you need to do is jump into a terminal and type in:

    $ sudo adduser johndoe vboxusers

    …which will add the user johndoe to the vboxusers group.
  2. Now close all applications and windows, and log yourself out of Ubuntu. You don’t need to reboot, but you can if you’re the kind of person who enjoys the subtle pleasures of watching your PC start up.
  3. Log yourself back in again as normal. This will read in your new group membership.
  4. Fire up Virtualbox and start your virtual machine(s) as normal. You will now find that you can attach USB devices to all your VM’s via the Virtualbox Devices menu without any further ado.
  5. Pat yourself on the back – you’re done. Smilie: :)

Until Sun Microsystems modify the deb installer to add the current login to the vboxusers group during install, these instructions should apply to just about any version of Virtualbox sporting the problem, on any Linux distro. 

HowTo: Fix being unable to click in Flash applications in Ubuntu 64-bit

Ubuntu 9.10 (Karmic Koala) has a curious bug on the 64-bit Intel/AMD version whereby on some systems you can play Flash perfectly, but the Flash application does not recognise any mouse clicks in it. This means in sites such as YouTube, you can’t click the mouse to play and pause, or seek in a video – you’re forced to use the keyboard.

This is a known bug with the flashplugin-installer package and is currently being worked on by Canonical. In the meantime, if you wish to fix the problem yourself now rather than wait for the official fix, just follow these instructions…

  1. After you have installed Flash in the usual manner, open a terminal and type in the following:

    $ sudo gedit /usr/lib/nspluginwrapper/i386/linux/npviewer
  2. Once the GEdit text editor (or substitute your favourite) opens, insert the following line just before the last line (should appear in most installations as the fourth line out of a total of five lines):

    export GDK_NATIVE_WINDOWS=1
  3. Save your changes and exit your text editor.
  4. Now restart any applications that use Flash, such as Firefox.
  5. In the case of Firefox, go and visit a page that uses Flash. You should now find that you can now click in Flash without a problem.
  6. Pat yourself on the back. You’re done.

HowTo: Remotely collaborate with another user in a terminal

You do remote tech support for clients. One client calls you up needing assistance. You SSH into their machine as usual to check out the problem. You probably also have them on the phone so you can walk them through what you are doing or ask them questions, but making long support phone calls can be expensive if you’re doing it via a mobile phone or internationally and it’s tiresome to switch to an IM client window all the time to write comments, especially if the client is not running a graphical session and only has a text server console to look at.

Sometimes actions speak much louder than words, and it would be great for the client to be able to see what you are doing without cumbersome and bandwidth-hogging remote screen tools like VNC. Is there an easy way to collaborate in a terminal?

There certainly is…

  1. First up, login to the client’s remote machine in question using their login, eg: login to the PC at 192.168.0.27 with the username “fred”:

    $ ssh fred@192.168.0.27
  2. Once logged in, we need to create a screen session. It needs a name, so I’ll call mine “blah”, but you can make it any name you want. Type in the following (note that the “-S” parameter is uppercase):

    $ screen -S blah
  3. Now instruct the client to open a terminal locally and attach themselves to your screen session by typing in the following command (note that the “-x” parameter is lowercase):

    $ screen -x blah
  4. You are now both looking at a common screen session. Anything that either of you type along with any command output will be automatically and immediately seen by the other person in real-time!
  5. Once you’ve finished sorting out the client’s problem, terminate the screen session with:

    $ exit
  6. You and the client will be both returned to your regular local terminal sessions which you can now close with the “exit” command again.

If you don’t have another machine to try this with, you can try it using two terminal windows on your own local machine. You don’t need to SSH in since you’re already logged in, just run both screen commands in their own respective windows and watch as any new information entered, including command output, appears in both terminals simultaneously.

You are not limited to only having two terminals sharing a screen session – you can have an unlimited number of terminals, remote or local, share one screen session.

Note that the shared screen session only works with the same user login. You cannot have two separate users share a screen, hence the need to login using the client’s username before setting up the screen session. If the client’s username does not have sudo rights, once inside the screen session, simply su to your admin login and then do the administrative work you require, all while your client watches on in amazement. Of course, be aware that the client can also start typing in commands whilst you are su’ed into your admin login as well, so don’t leave your terminal unattended.

Enjoy. Smilie: :)