Wednesday, 17 March 2010

Remote-desktops with NX. And how to delete old sessions.

I use NoMachine's (free) NX server on my Ubuntu server to allow me to remote-desktop to Ubunutu from my Windows laptop (where I use the NoMachine's (free) NX client). It's dead clever and well thought out technology, much quicker than VNC or using an X-server (e.g. Xming) and tunnelling through putty. The best feature, however, is that it allows you suspend sessions and resume them later (from a different machine even), it's kind of a GUI version GNU screen for your desktop. Google liked NX so much they wrote their own server!

Note that the free (as in beer) version of the NoMachine server only allows you to have two sessions running concurrently. That's fine for me, but if you want something unrestricted and free (as in speech) try Google's NeatNX or FreeNX. When I tried, neither was particularly simple to get going (though I'm sure this bound to improve, at least for NeatNX if not FreeNX).

That said, one downside of the NoMachine NX server is that if you don't cleanly shut down your server you can leave hanging sessions which can prevent you from logging in. If you get errors like this do the following:

NX> 596 NX> 596 ERROR: NXNODE Ver. 3.4.0-6 (Error id ...)
NX> 596 NX> 596 ERROR: resume session: make commands
NX> 596 NX> 596 ERROR: NXNODE: ERROR: cannot get property monitor.pid for session ...

Log in to your server and look at the /usr/NX/var/db/running directory. If there are files present, delete them, then try reconnecting with your client. That should do the trick!

Saturday, 13 March 2010

Reducing Memory Usage in Ubuntu (9.10 Karmic)

I run Ubuntu on a super-efficient (and thus pretty low spec) machine. I finally got round to installing Ubuntu 9.10 (Karmic Koala) over 8.10 (Intrepid Ibex). The install went smoothly but I straight away noticed the memory usage had gone up by about 15-20% (at a rough guess, and to be fair I only have 256MB to play with). This put me at near 100% memory usage (without even opening any apps) giving increased swapping and a huge decrease in performance.

My first thought was to get rid of any unwanted startups & daemons/services. I installed & started BootUp-Manager (named "bum" ho ho) with:
sudo aptitude install bum
sudo bum

This is what I deactivated:
  • apmd
  • speech-dispatcher
  • winbind
  • hotkey-setup
  • exim4
  • powernowd
  • nullmailer
  • kerneloops
  • bluetooth
  • cups
  • rsync
  • saned
  • pppd-dns
  • dns-clean
  • laptop-mode
  • acpi-support
Hit apply, and then rebooted the machine...

And wow - what a difference! Memory usage is down 25% and performance is better than with 8.10! Makes me think there was a issue with one of the items I removed, but for whatever reason it's done the trick.