Using Ubuntu as a thin client

Over the last few years there have been quite a few articles discussing the uses and advancements of the rdesktop application for Linux users. Rdesktop is an application designed to allow Linux users to access the remote desktop feature of Windows based machines, specifically servers. When my company made the decision to implement a terminal server to ease the network effects of a critical application, I began investigating other practical applications for it's use in a mixed Windows/Linux environment. I set out to determine if a Linux based thin client would be practical. As it turns out, not only was it practical, it was also exceedingly easy.

Recently, my department began paying closer attention to our inter-office bandwidth usage. We began to notice that one of our network applications required its end users to conduct a “push” several times a day, taking up most of our available bandwidth. After implementing QOS style bandwidth throttling, we took the additional step of placing this particular application solely on a terminal server. Our users would log in remotely, do their work, and the data transfer took place locally on that server, with no need for a “push” over the network. Encouraged by the results of this test, I began to explore the possibility of doing this with all of the applications commonly found on our end-users' computers. The result was a completely free (in all senses) thin client.

I took a stock computer from the warehouse that was for most purposes, outdated. Since I was planning to install a thin client version of Linux on the machine, it didn't need much more than a keyboard, mouse, monitor and network access. We rely heavily on CentOS for our server distribution, but I decided to use Ubuntu for my proof of concept thin client. I chose Ubuntu because of its out of box functionality across a number of different components and drivers. I am certain you could use just about any distribution you are comfortable with. Very little is needed to configure a thin client during the default install. The only deviation on this install was that it would login the user automatically without prompting for a password (since nothing would be stored or accessed on this machine, there were few security concerns).

Once the machine was installed, a short script was placed in the home directory containing the following:

!/bin/bash
rdesktop 192.168.???.??? -f    #insert terminal address
sudo /sbin/halt

The script needs to be made executable, which can be chmod'd from the command line, or clicked through Gnome. After that's done, let Gnome's startup program manager know where it is and you're almost done (System → preferences → startup applications). Currently, there is still a bug of sorts in rdesktop that will only connect once before generating errors. To fix this, enter the following at the command line:

# Remove/Delete the ".rdesktop"-directory 
$ rm -rf ~/.rdesktop
# and create a _file_
$ touch ~/.rdesktop

That's it. There's really nothing left to do but reboot. As you can see from the script, a few things are going to happen. First, as soon as the computer boots, you're going to see an Ubuntu splash screen, which is the last time the end user is going to be reminded they're not really using Windows. Second, instead of the Gnome desktop appearing on their screen, they are automatically taken to the terminal server's login screen. After the day is done, logging out of the terminal server shuts the thin client down.

So what do we have, and what does it all mean ? Ultimately, our end-user-turned-test-pilot has a Linux machine on what is now considered sub standard hardware that normally would have been thrown out. The computer boots, and takes her directly to the Windows based terminal server, completely eliminating any learning curve whatsoever. When she logs off, the computer turns off. Total cost to company: nothing. If the thin client burns down tomorrow, the unit can be replaced in minutes, and the end-user's loss is non-existent. All of this is accessable via VPN, making the entire desktop more freely accessable should she find herself at home, or on the road. We haven't spent a dime, and in the same we have managed to recycle a machine that would otherwise have been land fill bound. We've struck a blow for open source, one for Mother Earth, kept our money where it belongs and had a blast doing it.

While it is unlikely that this is the killer-concept that will change the way we do business, it did help us to think outside the digital box of sorts. It pointed us in other directions, and I'm sure that some project in the future is going to benefit from what we've learned here. Either way, we continue to discover new ways to implement open source solutions. Each step we take produces it's successes, and sometimes not so successful results. Building a thin client from a linux box can hardly be called a monumental achievement, but each small step forward leads us to the bigger solution around the corner, and is ultimately why I love my job as much as I do.

______________________

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

halt command

cj1234's picture

sudo /sbin/halt

this command shuts down my computer before I am done in my terminal session...any suggestions would be greatly appreciated. .

LTSP Tips?

Bob Briddly's picture

I'm a noob who has been running separate laptops on Ubuntu netbook distros for 2+ years now, and my family can't tell the difference from their old M$ machines. With Restricted packages, Firefox, Evince, Evolution, OpenOffice and Rhythmbox most of their needs are taken care of. I've added a NAS box to give everybody a common store, but I really want to use an older dual-core machine as an LTSP server to PXE boot these same laptops. Any Comments or Suggestions about using Debianedu//Edubuntu//SkoleLinux ??
Any Issues with Sound?, Video?, Media playback?

Sweet Solution

Brandon Reese's picture

I set this up at work today and it worked exactly as you described it.

Awesome ! We've taken it to

chasecrum's picture

Awesome ! We've taken it to the next level a few times since I wrote this article. I'm going to have to come back and post a follow-up to this with all the new things we've learned !

Yay follow-up

Gene Liverman's picture

I would love to see how you all have expanded on this :)

Gene Liverman is a Systems Administrator of *nix and VMware at a university.

Excellent

the_madman's picture

I'm planning on doing something similar for a college course, but with an Ubuntu server. I was planning on using the alternate CD to install a command-line system, then install Fluxbox and GDM, and similar to how you've done it, write an autostart script for when Fluxbox starts-up.

What I would PREFER, though, is to not start up GDM locally at all and have the local user automatically log-in to a command line, access the server via SSH and automatically run GDM on the server on the local X server. Any chance you have any idea how to do that?

Gotta run X locally

Michael T. Babcock's picture

You have to execute an X server locally on the machine for it to have a GUI. Otherwise there is no GUI server for the remote sessions to connect to. You can use PXE for network booting off a server, but that will still launch GDM locally on the machine (simply downloading it before presenting the user with the login prompt).

The local X server however must exist on each client. It handles keyboard and mouse interaction as well as graphics drivers and the like.

windows for thin client

Anonymous's picture

hello
I have a fujitsu thin client.and it doesn't have a windows.
I dont know how can I instal a windows on my thin client?
thank you.

servver side- more info

Anonymous's picture

How can this be configures to work against a MacOS X serving or a Linux serving the client?

What about the WIn side

Anonymous's picture

What needs to be done on the Windos side to have a terminal server?

you need to have a server

Chase Crum's picture

you need to have a server edition that supports the terminal server feature. Feature being the key word, which carries as much weight as the word service. We're using '08 here.
Hope that helps.

-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

One word: Power.

Will Sheldon's picture

Using an old machine as a thin client (esp with HDD) will cost you about 100Watts (actually between 60-120 for your average P4), excluding the monitor.

Using a SOC ARM or MIPS board will cost you 5-7Watts (loads of these designs about, mostly used in smartphones)

Let's keep tings simple and assume that you are saving 100Watts. in the UK power costs between 10-15p/kwh, so you are saving about a penny an hour.

These soc's can be had for as little as £80, suggesting a ROI of about 3.8 years, with a lifetime of over ten. This assumes 8hrs a day, 5 days a week.

You may have to take into account the increased power in the datacenter, but in terms of cost at least this can be offset by the fact that your terminals have no moving parts (therefore exceptionally low maintainance).

This design also works well if you have old or flaky power, you only need a UPS in the datacenter.

Your carbon emissions will obviously also be positively impacted too :-)

OK. I will completely concede

Chase Crum's picture

OK. I will completely concede at this time that my "save mother Earth" comment might have been mis-spoken/read/received...

You make a great point about the power savings and I'm sure overall that it probably is more "green" to use a machine like you have suggested. I think what I was really trying to imply is that we had a very old and somewhat unusable computer collecting dust and dreaming of a future at the landfill. now it's in service again.

All that being said, I would now like to rephrase the concept. I have instead, kept an aging machine employed in a workforce full of youthful peers, adverted age discrimination, and made an older machine a useful part of society again and thus kept our economy going. I'm doin' my part.. one senior at a time....

-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

Agreed

Will Sheldon's picture

I agree, no matter what the long term savings are, sometimes it's just not possible to spend on new machines, even if they are cheap. We are still swapping out CRT's for flat screens (saving about 60 watts a pop for a 19").

I'd recommend looking into TFTP booting the clients though, & if that 's not an option perhaps booting from CF with a PATA adapter to save power (£2.50 for the adapter, £3 for a 1GB CF card), or even just turn off logging in ubuntu and enable hard disk spindown (using hdparm). Also, check that ACPI is working, and enable S3 suspend in the BIOS.

:-)

Ubuntu desktop loading on top of fullscreen terminal

Anonymous's picture

The terminal comes up but before you can log in the Ubuntu desktop loads over the top. This is further confirmed by the terminal showing up for seconds when logging out of the Ubuntu desktop. Any thoughts?

When I set this up I turned

Chase Crum's picture

When I set this up I turned off password logins for the Ubuntu machine. It should automaticaly load into the OS and the go directly into the rdesktop script.
-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

We still had the same problem

Anonymous's picture

We still had the same problem when we turned off the login screen, so it may be a Ubuntu 10.4 thing. We resolved the problem by adding "sleep 10" before the rdesktop line. That allowed the Gnome desktop to load before the terminal. Thanks again for the great article.

Ubuntu

Seth Brown's picture

Congrats on getting it working.

I thought I'd point you in the direction of 2 interesting projects I've come across.

Thinstation - http://www.thinstation.org/

Fog Project - http://www.fogproject.org/

Thinstation does everything you probably want to do with a thin client. I used it for some years with an installed base of 45 clients.

Fog - manages disk images of computers over a LAN. You manage known good disk images instead of running around fixing PCs. Fog's a well thought out implementation of the concept.

If you have some time, they might be interesting to look at.

Seth

Add PXE boot

Anonymous's picture

Add PXE boot with a tftp server and a bit of dhcp tweaking (Linux based, of course!), and you've got a diskless solution that will rid your desktop group of ever setting up a desktop again.
We added the Citrix receiver to an Ubuntu image to access our Citrix farm.
This is a very cool solution!

Great concept and idea. I am

Anonymous's picture

Great concept and idea. I am going to setup one up in my environment today. That said, how in does a tech article/discussion morph into talk about the greatest scam in the world (global warming)? Good grief!

Ubuntu as thin client

steven Sira's picture

I have been using rdesktop to gain access to our office servers from my Ubuntu box at home. I would really wish to know the bug the writer is talking about as i have not seen any. Nevertheless, open source once again proves to be quite flexible and the best way to go!

regards,
Steven

The bug has everything to do

Chase Crum's picture

The bug has everything to do with launching rdesktop itself. for some reason, on most installs, you can launch it once, and only once. Once you reboot, you can use it once, and again, only once. If you got by without that problem, consider yourself lucky.
-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

I guess I'm lucky too

Anonymous's picture

I too have not had any problem like that in any version of ubuntu since I started using rdesktop to connect to my work desktop 5 or so years ago. I connect to that windows machine several times a week.

Using Ubuntu as a thin client

steven Sira's picture

I have been using Ubuntu at Home to access our servers and in turn to access user boxes in the office which are entirely on a windows environment. In essence its just a concept proof that Open source software is indeed the way to go with regard to cost and flexibility!

regards,

Steven

Eco Friendly

Evan Plaice's picture

I think, the fact that it isn't dedicated (running 24/7) makes the power consumption part of the equation less of an issue.

OTOH, if for some reason that computer crashes and there are no more leftover machines to replace it. Replacing it with a mini-itx form factor computer with atom processor would make a significant difference in power consumption.

Here's what I mean:
http://www.mini-box.com/M300-Enclosure-w-Bootable-CF-Reader_2
http://www.mini-box.com/Intel-D410PT-Packton-Mini-ITX-Motherboard
http://www.mini-box.com/picoPSU-80

The enclosure even has a bootable CF drive accessible from the front so cloning configurations is as easy as copying a CF drive.

To top it off, copy the os to ram on boot and run it directly from memory. That way, programs will start instantly (no HW bottleneck), and, if the system is compromised, a restart will restore it back to a fresh state.

Check this out:
http://forums.gentoo.org/viewtopic-t-296892-highlight-ramdisk+copy.html

Very Good

Imoel's picture

it's very good article for using ubuntu thin client..
next time i hope be good

Thin client?

_Eric_'s picture

Not really what I'd call a thin client, more like a remote access machine. I mean, with a thin client, isn't the operating system stored on one central location so that each of the client machines runs one configuration? With this set up, you'd have to go round and manually update each machine when updates are posted. You might want to check out LTSP instead.

While you do make a good,

Chase Crum's picture

While you do make a good, point, I would offer this: once this machine was working, we never planned to update it. Ever. not a great policy, but this was proof of concept, and once it was working, there was no need to ever update it...
-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

Security

Tim's picture

This is an interesting comment “since nothing would be stored or accessed on this machine, there were few security concerns” and heavily debated in some discussions. I would agree in some instances especially if the system did not contain a Hard- drive, however there are still a laundry list of security settings that still must be applied on the system itself, grub password - single user mode, , BIOS password, Etc…

Shutdown

Robert Aldridge's picture

I haven't tried this, but intend to. Thanks for the write-up.

One question popped up as I read through it...

Does the 'sudo /sbin/halt' actually work to shut the machine down? I figured it would wait for the user to enter their password before running this command (and, I'm assuming that the user is in the sudoers list).

Regardless, I'm going to give it a try...

Thanks,

Robert

This is my favorite question

Chase Crum's picture

This is my favorite question so far.

Keep in mind, the entire idea was to have a linux machine, that the user would never see, and thus never need to learn how to use.

The halt command was absolutely necessary. While on the M$ screen of the terminal server, she would click start -> logout. This would end her terminal service connection, and would then execute the halt command, shutting down the machine. She literally, NEVER, touched the linux side of the machine.

-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

Re: sudo /sbin/halt

mwallette's picture

sudo visudo, then add the following line:
%users localhost=NOPASSWD: /sbin/halt

That will let anyone in the %users group run /sbin/halt as root without a password.

On an off-topic note, I am curious what bug the author noted in rdesktop. I've been using the program on a number of distros (Slackware, Knoppix, Debian, Gentoo and Ubuntu) for about seven years, and never had to delete or recreate any .rdesktop/* files. OTOH, I am using different flags than the author.

Actually, I created a bash wrapper to run rdesktop with the flags for the options I typically use:

#!/bin/bash

Date=`date +%Y%m%d`
#substitute your user name for myusername here (leave the quotes)
UserName="myusername"
#and replace the.ip.address.ofmyserver with the IP address of your terminal server
ServerIP="the.ip.address.ofmyserver"
rdesktop -u ${UserName} -d unicom -n "${Date}${UserName}" -g 1024x768 -x b -5 ${ServerIP}

This all looks fine, but I

Chase Crum's picture

This all looks fine, but I would recommend adding a -f at the end, which would make it fullscreen...
-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

one step further

Anonymous's picture

Interesting, and nice how cleanly it fits together for the end user. I'd like to see this taken one or two steps further.

Ideas:
- Boot your linux terminal from the network, via PXE or something similar. Then you can do-away with HDD's, making this even more eco/cost friendly, and very easy to maintain the master image, etc. It would be ideal to keep this image size to a minimum. If b/w is a major concern, even booting from USB flash (provided bios supports it) would provide better results than booting from HDD (in terms of power).

- It'd also be interesting to see this same setup without windows. Use NX or something similar to boot a linux terminal connected to a linux terminal server. Combine this with the PXE option and as light weight as possible image would be nice.

I think the key thing for this article is how nicely the linux client fits it all together. It's important that the whole boot/shutdown process be seamless.

Slick

David Lane's picture

I am going to start playing with this today...now where is my Ubuntu disk...

David Lane, KG4GIY is a member of Linux Journal's Editorial Advisory Panel and the Control Op for Linux Journal's Virtual Ham Shack

First and foremost, I

Chase Crum's picture

First and foremost, I wouldn't suggest this as a green effort of any sense. I can totaly agree with the carbon footprint concept. I think I was more trying to imply that I was able to keep an older piece of hardware in service, and not to the landfill.

This server release has five cals pre-packaged. We did in fact have to buy cals for the server above that. one can struggle with the question of whether you save money or not as you are paying for a license on one end or another. I'd like to believe it is cheaper to buy the cals and use a terminal server, as We are not puchasing multiple copies of service software like antivirus and things of that nature (although you should read any licensing VERY carefully). Ultimately, this project resulted more out of need as it related to a databse connection (comes in very handy if a user gets diconnected). Personaly it was fun for me. I got to re-use old holdware (he shoots), put another Linux box into service (he scores), and most of all, I dont have half of the headaches that come with the more commercial alternative (you know who you are...)

-Chase

Chase Crum is the IT Infrastructure Manager for Voicenation and a self-proclaimed Linux FANATIC.

Great article!

virtualdisaster's picture

I've been meaning to do something nearly identical to your setup for years however I haven't had the hardware nor time to do it. Wonderful proof of concept.

TS CAL's

Gene Liverman's picture

Just wondering if you all had to buy CAL's for your Windows terminal server or if that was something you already had. I know all Windows servers come with a few TS licenses but was thinking beyond that.

Gene Liverman is a Systems Administrator of *nix and VMware at a university.

> We've struck a blow for

Anonymous's picture

> We've struck a blow for open source, one for Mother Earth

What about the power-efficiency of modern computers? I would bet my lunch that any modern thin terminal (without fan, without hard disks, with a low consumption CPU) draw much less electricity than an old computer.

I haven't done the numbers...

Shawn Powers's picture

It's important to keep in mind that there is a significant carbon footprint in producing computers, energy efficient or not. And keeping old computers in use, while it uses more electricity, keeps them out of landfills.

Proper recycling may be the best way to get rid of old computers, but if they're still functional, thin clients are a great alternative. Especially considering how few of the old computers actually get recycled. Most just end up in the trash.

Like with most things, there are good and bad attributes to both reusing AND recycling. :)

Shawn Powers is an Associate Editor for Linux Journal. You might find him chatting on the IRC channel, or Twitter

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState