| « Fantasy book: Storm Glass | Book: Virginia Woolf: To the Lighthouse » |
Neatx is the new black
Needing a Gui remote login for the students
When I started working here at BINF, we were located in an old building and we had our entirely own rather primitive network. But the classrooms and our servers were on the same net - our net. And when our teachers wanted the students to connect to a KDE session on one of our Linux machines, they just told them to install an X server on their Windows or Mac laptop, and connect to one of our workstations, which had all the right programs installed.
It didn't work right out of the box for everybody but that was the situation I inherited, though only for one semester.
We have about 30 students needing to connect at the same time during our courses.
When we moved to a grand new building where the network in the class rooms are in the hands of the IT department of our institute - now our faculty - we had to find another solution.
The first year we taught people to login to one of our workstations with ssh via our login server, start a vnc server on some port, set up an ssh tunnel via our login server, and then connect with vnc. While this worked, it was complex and required a lot of support.
FreeNX nightmare
So last year we heard about FreeNX and decided to try to go with that. This was in one way a success and in one way a nightmare. It was much simpler to set up than the VNC thing since we could use the ssh port and the ssh protocol directly, and let people run on our login server.
The FreeNX server, however, was a nightmare to setup. We did manual little hacked bug fixes in the scripts, we had character set problems we couldn't resolve, but the real problem was that suspend/restore of sessions didn't work and a dead session would clutter people's home directories with large hidden files and at some point we would have to log in to the server and kill sessions manually because it couldn't handle more dead sessions.
Neatx
So this year, we wanted a solution that was basically the same but actually worked. Luckily my student aid came over Google's neatx project. It looks like those people weren't happy with FreeNX either, so they made their own implementation, in a much nicer, cleaner way.
It is not a polished, packaged easy to install project, and there are some things they haven't implemented. But it works. Now I'm risking this claim a bit early, after only 2 days with the new students on the servers, but it actually seems to work. It can suspend and resume sessions. It stores them locally on the server (this can probably be configured).
People can log in, they can work, they can log out. No nightmare at all. And after finding the trick, installing the server is not very complicated at all.
Here is my installation notes and links to documentation.
It is worth mentioning that this year, we are running on a much bigger server. This year we use our 8 core 32 GB RAM server, but it get a load of approx 1.78 at most with 30 users connected, and with a few local users, too.
When they start running heavier programs on it, off course it will be more loaded, but not because of Neatx in itself.
Installing neatx on Debian Lenny
Project page: http://code.google.com/p/neatx/
Download it by checking it out from svn:
svn checkout http://neatx.googlecode.com/svn/trunk/ neatx-read-only
Then follow the instructions in the INSTALL file for installing dependencies. Most of the dependencies comes with Debian and can be installed with apt-get / aptitude:
apt-get install python-pexpect python-simplejson python-gtk2 python-docutils python-gobject python openssh make automake autoconf gcc xauth xrdb netcat
Also install KDE and/or GNOME so people have a GUI to run with neatx.
Now comes the hard part: Install nxagent from http://www.nomachine.com/sources and get it to run.
Documentation: http://www.nomachine.com/documentation/building-components.php
Get the following packages:
- nxcompext-3.3.0-4.tar.gz
- nxcompshad-3.3.0-3.tar.gz
- nxproxy-3.3.0-2.tar.gz
- nxagent-3.3.0-13.tar.gz
- nx-X11-3.3.0-6.tar.gz
- nxauth-3.3.0-1.tar.gz
- nxcomp-3.3.0-4.tar.gz
mkdir NX
cd NX
tar xvzf ../*.tar.gz
cd nx-X11
make World
make install
Now the trick: You actually need to do with your LD_LIBRARY_PATH as it says in the documentation. Not add to your LD_LIBRARY_PATH, but replace your LD_LIBRARY_PATH. Which you would not want to do globally. So you can test by setting a new LD_LIBRARY_PATH in a shell, and start nxagent.
Now install neatx:
neatx-read-only/neatx/
./autogen.sh
./configure
make
make install
useradd --system -m -d /usr/local/var/lib/neatx/home -s /usr/local/lib/neatx/nxserver-login-wrapper nx
install -D -m 600 -o nx /usr/local/share/neatx/authorized_keys.nomachine ~nx/.ssh/authorized_keys
cp /usr/local/share/doc/neatx/neatx.conf.example /usr/local/etc/neatx.conf
In my case I set the export LD_LIBRARY_PATH="/usr/local/src/NX/nxcomp:/usr/local/src/NX/nxcompext:/usr/local/src/NX/nx-X11/exports/lib" in
/usr/local/lib/neatx/nxnode-wrapper and /usr/local/lib/neatx/nxserver-login-wrapper.
It might be smarter to do it somewhere else but this works.
After reboot of the server after a cooling system outage I had a problem: The old sessions were not deleted and NX tried to resume them instead of creating new ones. Users got “Internal error” when they tried to reconnect to a session.
Solution: Put this line in /etc/rc.local:
# Delete all NX sessions after a reboot, they're dead anyway
rm -rf /usr/local/var/lib/neatx/sessions/*
Client
Download the newest client from http://www.nomachine.com/select-package-client.php .
Starting the nx server
You don't have to start anything. If nxagent works and you have followed the instructions, and you have ssh access to the machine, it should work now.
Troubleshooting: Try to login with ssh manually and get rid of any hostkey issues in advance.
5 comments
as there isn't very much documentation on the neatx project, your post greatly helped.
neatnx runs fine... and seems to be lot easier to set up than my already running freenx.
thx
garfield
It's fast (I'm in the U.S., typing this up via NX to a UK machine), and works great.
I did have to futz around with the LD_LIBRARY_PATH a bit.
I think the problem arises when people try to be good and log out of KDE or GNOME from the K / Gnome menu, whereas if they click the x in the corner, they get to choose "Terminate", which terminates the session, or "Disconnect" which gives them a session they can restore.
Disconnect works. (And reconnecting).
Terminate does not delete the session directory, but it does kill the process, and the leftover directory is not a big problem.
Logging out from the GUI via the menu leaves the neatx related processes running. One can easily avoid making this mistake oneself, but it is difficult to prevent the students from doing it.
I don't have a solution to this problem, but I can imagine that one could perhaps modify either some neatx terminate script or some KDE and GNOME script on the machine to send some termination message to neatx. If one could bother to find out exactly which scripts are called in which order. Any suggestions are welcome.