Tuesday, 7 July 2009

To Wine, or not to Wine, that is the Question?

Wine (Windows is Not Emulated) is a very cleverly engineered tool; it allows one to run Windows applications natively on Intel based Linux systems, to different degrees of success depending on what underlying Windows APIs are used by the application.

I never know what to think about using Wine. Part of me wants to just refuse to use any Windows application because it's "tainting" my system - I want to have 100% GPL'd Open Source based code running on my machine. Using this argument I should not be using apps like Skype or Flash and hence the BBC iPlayer and I should therefore refuse to use any close proprietary drivers, like the broadcom wl.ko driver module. Where does one draw the line?

Perhaps my machine should be a totally Windows free zone - that's one line I could draw. Alternatively, if I have to run Windows code, maybe it should be just inside a Virtual Machine just to contain it, rather than using apps in Wine.

It's a interesting debate - my current approach is go for as much GPL'd Open Source code I can, and be pragmatic - use some propriety apps like Skype only when I need to, and try to avoid any Windows code on my machine at all possible. So, sorry Wine, your technology is very powerful and enabling, but I don't think I will be using you for the moment.

Faster ssh X11 Forwarding

I use ssh daily to connect to my servers and laptops around my home office. Most of the time I'm using ssh to login and build software, so it's plain and simple command line activity. However, sometimes I need to run an X11 application on a remote machine, in which case I use X forwarding to display the remote X application on my laptop. However, this can be slow. Today I stumbled on the following incantation to speed up X11 forwarding over ssh:

ssh -c arcfour,blowfish-cbc -X -C user@remotehost

Thanks to Samat Jain for this info.

The choice of cipher is based on some performance benchmarks as noted in LaunchPad bug #54180

Monday, 6 July 2009

Authorising USB devices for access

Normally when a USB device is connected to a Linux system it is automatically configured and then the device's interfaces become ready for users to access. While this is useful on most desktops use cases, there are situations where you may not want this, for example on Linux kiosks or servers where access must be limited.

Each USB device has an authorized file in the /sys interface, by writing "0" to this one disables authorization, and conversley writing a "1" to this authorizes a device to connect.

For example, to disable authorization:

echo 0 > /sys/devices/pci0000:00/0000:00:1a.7/usb1/authorized

Also, one can enable/disable authorisation on an entire USB hosts by writing to the authorized_default file:

echo 0 > devices/pci0000:00/0000:00:1d.0/usb5/authorized_default

By default, the authorized and authorized_default settings are set to 1, enabled.

Sunday, 5 July 2009

atop - AT Computing's top

Last month I blogged about htop, a process monitoring tool. Today, while I was searching for a way of monitoring disk activity, I stumbled across atop (AT Computing's top). While it shares a lot of similarity with top, it is distinct enough to be useful in it's own rights. Because it is an interactive text based tool, it is driven by simple key presses, for example, pressing 'h' brings up a help page showing how to drive the tool.

Some useful key commands are as follows:

g - generic info (default)
m - memory details
d - disk details
n - network details
s - scheduling and thread-group info
v - various info (ppid, user/group, date/time, status, exitcode)
c - full command-line per process

..to name but a few.

One feature I especially like is atop highlights in red colour the processes that may be misbehaving, such as CPU, memory or disk I/O hoggers; very helpful when a rogue program is killing your machine or sucking away power or I/O.

To install atop, simply use:

sudo apt-get install atop

Below are some screen shots:


atop highlighting CPU hogging


atop highlighting I/O hogging

So, while I may always turn to ps,top or vmstat as my first port of call when I want to check my systems activity, atop is another very useful utility in my toolkit that comes in useful in seeking and resolving misbehaving systems. Check it out and let me know what you think!