Sunday, September 16, 2007

D@mn Small Linux - RDP Project

Welcome to my DSL project. You are probably here because you have seen the link through the DSL forums.

This is a temporary holder to allow me to create the full documentation associated with my project. I started to document this project so that I wouldn't forget how to do it in future but it occurred to me that others may benefit from my 'learning' as I went along. It is my way of contributing back to the community because I am no programmer!

If you found this article useful - please give generously to the DSL team. They have created a technological marvel and they should have the resources to improve it for ever.

Saturday, September 15, 2007

Objective

To create a DSL thin client for use throughout the house on low powered totally quiet PCs with nothing hanging out of them (USB pens etc.). These clients should be able to:

1. rDesktop / VNC into numerous hosted OS's on server (Windows 2003 SBS) running VMWare Server.
2. Have independent access to multimedia also stored on server to allow for playing of media files. There should be restrictions on permissions to delete / move files from within linux. (I have accidentally deleted many things before in this manner).
3. Have a bespoke Gui (.lua) to go to specific virtual computers via VNC / rDesktop without having to type in computer name / user name / password.

In the process I plan to write astep by step guide to help others to repeat the project and also help others to understand some of the issues associated with a move to Linux from Windows.

Other thoughts:
It has been suggested that I go for a network boot option using pxe. In the past I have tried spectacularly unsuccessfully to do this before and wasted hours and hours trying to resolve hardware issues and Windows Server 2003 (SBS) issues and really got no where fast. Since then, I have been told that it is much easier with recent DSL developments. As such I have added the network boot option onto my project plan.

Friday, September 14, 2007

The Plan

1. Buy Machine - COMPLETE
2.1 Install DSL from LIveCD - COMPLETE
2.2 Install DSL on HD - COMPLETE
3. Understand the filesystem a bit better - COMPLETE
4. Install and configure rDesktop
5. Install and configure VNC (look at all flavours)
6. Compare VNC and RDesktop for ease of use and media streaming etc.
7. With whichever works best, create automatic button based logons for users (.lua manipulation)
8. Connect the media player of choice to the music folder on the server. Set permissions.
9. Back up the iso / remaster ?
10. Push the whole build into Ram at boot (toram)
11. Write idiot guide (for myself and others) how to upgrade Distros in the future.
12. NEW - review intrd version for server pxe distribution(suggested by roberts).

Thursday, September 13, 2007

1. Buy machine - COMPLETE

I have bought this machine from mini-ITX: http://www.mini-itx.com/store/?c=27#m61g.
The M61G Fanless 1Ghz Barebones Thin Client with 256KB Flash IDE Module + 512KB Memory.

Advantages: Small and noiseless.
Disadvantages (potential): Because it is noiseless I may suffer with some decompressions issues on the fly with some media files. There isn't really a lot of guidance in this area so I will report back with some test results later in the project.

Other notes
Because I don't want stuff sticking out of it, I bought Flash IDE. I therefore need to understand how to do a Harddrive install. The memory is of a decent size so that I can run the final operating system completely in RAM.

Wednesday, September 12, 2007

2.1 Run DSL from LiveCD - COMPLETE

Hardware Precursors: Open up box - add RAM, attach CD drive, insert IDE Flash module.

Recipe

1. Download latest version of DSL:http://www.damnsmalllinux.org/download.html
2. Select the 'current' directory
3. download the dsl.[versions_number].iso
4. Burn this to disk. If you have trouble with any of this bit then google 'burning CD-Roms help' and find out how to do it.
5. Stick your CD-Rom into the Drive and start up your machine.
6. If it doesn't boot immediately, you may need to select 'Boot from CD-Rom' in your Bios settings of your computer. To access your Bios settings, hit Delete during the first few seconds after switching on. If Delete doesn't work, try F8, F2 or any of the other 'F's during the first few seconds (pretending you are a jazz pianist can work too by running your fingers up and down the F keys - not so good at identifying the correct F key to press for future though). You may be able to look up some Hardware instructions for your Motherboard if you are still struggling. Again Googling will probably help.
7. Let the whole thing run - when you are asked to enter cheat codes. Just hit return and get the thing installed.
8. Muck about with your very nice new Operating System that took less than 10 minutes to get up and running.
9. Is your computer connected to the internet to the network? Easy: Check by using Mozilla or similar to check your connection to the web. Otherwise, double click Terminal icon in top left hand of screen and type ifconfig (equiv of ipconfig in windoze). This should help you to diagnose problems. I'm not going to spend a lot of time sorting out problems here with this because I never had a problem. One thing I did though is to set a DHCP reservation for the linux box on the Server - this is just to push the linux addresses away from the windows ones. Open up DHCP on the server, select your scope, open reservation and add a reservation as per instructions. Use the MAC address of your linux box (found using ifconfig) and enter in the details without the colons. Reboot.

Persistence
OK - you have installed DSL - well done! You can do all sorts of things with this now. This includes downloading DSL add-ons etc. The changes you make are not PERSISTENT! This means that the next time you load up the DSL from the CD-Rom the preferences and changes that you have made will not have been saved. More about this later.

Tuesday, September 11, 2007

2.2 Install DSL on HD
The Website says:

##Quote

A "frugal" type install mirrors the operation of the LiveCD. It installs the compressed filesystem and associated boot files onto a pre-prepared partition of your choice on your hard drive.
The frugal install offers you a choice of two bootloaders, lilo or grub.
This method offers many benefits to you over the typical linux hard drive install.
Use of the extension repository for adding applications, which are designed to run in the frugal/liveCD environment. Much easier upgrade path, without needing to reinstall from scratch. Use of the 'toram' option, while still operating from a hard drive type device. This offers you the maximum performance in DSL, by running your entire OS in ramspace, but getting the load performance and speed the hard drive offers.(requires 128MB ram) Most all other boottime options are available to you, like persistant home and opt directories, autoloading of applications, setting fresh passwords, encrypting/decrypting your backups, unique hostname, and autorestore/backup of your personal files and settings at boottime and shutdown. You can easily revert back to a pristine install condition, and extend this feature to uninstall any extension. Steps needed:
Create a 50MB Linux partition with cfdisk (ex. hda2 ) Right-click on the desktop, navigate to Apps>>Tools>>Frugal Install, and select your choice of Frugal-Grub or Frugal-Lilo. This will make a ext2 file system and copies the necessary portions of the cd to it. You can also bootup the DSL CD with the bootcode option " install " , and you will be presented with all the install options in a menu format.


##End Quote


Just for those of you who are like me who don't know what a frugal install is let alone a grub or lilo install then read this bit:
Frugal: The ability to boot up your computer with a method that isn't the liveCD.

Lilo vs. Grub install: Apparently Grub is a bit more future proof in that you don't need to upgrade it if you change operating systems and you can use network booting too. I will be using Grub therefore. I've no idea why anyone would want to use Lilo. None seems to mention it anwhere.


In this case we will set up the following drives:
hda1: This drive holds your DSL image (size: 60Mb)

hda2: This holds your persistent changes as and when you make changes that you wish to be remembered - (size: the rest)



Depending on what your requirments are - you may need a swap drive. There is plenty of advice on how to create one if you need it. Basically it will become apparent once up and running - the nice thing about DSL is that it shows you on the dashboard (top right) what memory usage you have. If you are maxing out either upgrade your memory or introdcue a swap drive. I have 512Mb RAM which is running at 36% at the moment so I won't use one just for the moment.


Recipe


1. Boot from CD

2. At the cheatcode option type: dsl 2 (this just goes into the command prompt mode)

3. At the command prompt type: cfdisk

4. Create the partitions as you see fit. I have sized them as above (60MB : the rest). I have not made them bootable at this stage. This is pretty straight forward. If you are unsure use the help. Once done, remember to write your changes and then exit.

5. Format the partitions:

at the pompt: mke2fs /dev/hda1

and then: mke2fs /dev/hda2

(You don't have to do this bit but it is a way to ensure that your drives are picked up)

6. Shutdown the machine to get the partitions changes to happen. Type: shutdown -r now

7. Reboot into dsl 28. type at prompt: /usr/sbin/frugal_grub.sh9. Follow these commands:
Harddisk: hda1
Install from: [L] Live CD
Format?: yes & yes
10 Installed! Well done, reboot and take the CD out this time.
11. The grub loader now shows up and you can select which monitor resololution you want to go for at this time.

Monday, September 10, 2007

3. Understanding the filesystem - COMPLETE

It took me a while to understand how the files system works with DSL. To get a grip on it you need to understand the boot process too which is not clear to a Windows user. It is much more technical than we are used to. Here's my way of explaining it...

If you go into emel-fm (a file manager that takes a bit of getting used to is you are familiar with Explorer) you will see that in the root directory (/..) there are a bunch of folders. They are NOT a consistent set of folders / files that you might see in Windows explorer. Don't think of them as such. Here are the varieties you get:

1. Some are symlinks (shortcuts) to regularly used folders. (They can be recognised as light blue folders in EmelFM)
2. Some are real but transient folders set up at boot time within RAM.
3. Some are mounted drives. Drives don't appear in the same way in DSL - they are mounted as folders.
4. Mounted images - the main Knoppix file is treated in this way.

When booting up, there is a bunch of primordial stuff that happens at low level that is handled by the loader (grub in our case). During that phase, it loads what is known as the kernel. This is the shell or environment that allows everything to start to talk to each other. The programs can interface with the hardware and different bits of hardware can talk to each other and so on.

Once the kernel is loaded, the main operating system files (/Knoppix) are hunted down on the system. In our case, these are on hda1. The basic DSL files stored in this image are then installed into RAM at /KNOPPIX. These files allow the Operating system to run. A bunch of shortcuts to commonly used folders are also set up for ease of use.

In addition, the orginal KNOPPIX image that was found is mounted for its own purposes (you could say that a shortcut to the main file is setup) under the /cdrom folder. Hence the Operating system can call on the other stuff it needs whenever and you can access the files / folders you are most likely to need quickly. This is all very sensible when you think about it.

Back to persistence again:
As discussed, some of the files are in RAM. The ones that are in RAM can be changed for the most part - some are actually in use so can't be changed. When you start to change these files - nothing will last until you backup your changes. To do this:
1: Click System > Backup/Restore (if it does not default to your 2nd drive then select type the name of the drive e.g. hda2) and
2: Introduce the cheatcode: restore=hda2. This restores your settings that you have just backedup. More about this later!

N.B. The KNOPPIX image loaded at /cdrom is not writable either because it is in constant use by the OS. Hence - at a later stage we may need to remaster the image. I am not sure just yet if I can get away with this project in backups only.

I began to write in some depth at this point about what all the individual folders do. It seemed very peculiar that there was a 'lost & found' folder nearly everywhere I looked.Rather than go into real detail about what individual folders and files do and how they work. You can have a pretty good guess what each of them does and you'll probably be right. To find out more specifically about what is happening where. You can go and read The Linux Documentation Project (http://www.tldp.org/) and click on Guides and find the one on Linux Filesystem Hierarchy. This will explain everything in a lot more depth.

For now, I think we have enough to go on with, incidentally the 'lost & found' folder is found on all partitions for lost files / part files during system failures. That's why you see it around a lot!

Sunday, September 9, 2007

4. Using RDesktop - COMPLETE

rDesktop is a thin client for viewing other computers / applications that utilises RDP. Just so that you understand, RDP is a protocol for tranferring information across a network. VNC uses the RFB protocol. The VNC route basically splits the screen up into boxes and then transmits video changes as they occur. RDP on the other hand is a bit more integrated and will redraw things according to actions from the user. Apparently RDP is meant to be better but we will soon see!

If you haven't already done so, click the Rdesktop icon on the screen and type in the IP or the name of the computer on the network. If this doesn't work, then you will have to check to see if you have the correct premissions at the server. Refer to your server documentation for this (in fact, stop with DSL until you have managed to get 2 x PCs talking to each other within Windoes with no problems). Again, I haven't had any problems in this area.

If you are using rDesktop - three things will occur to you...
1. Annoyingly "dsl" is entered as the user name & there is no option to automate
2. If you have used the fullscreen mode, there is no apparent way out (CTRL+ALT+Return sorts it but be aware that the box that it converts to is right on the periphery of the screen so it doens't look as if it has worked!).
3. The colour depth is rubbish.

To deal with these issues...Rather than using the icon on the desktop (X), open up a terminal screen. At the prompt type the following:
Things in brackets need to be replaced completely with the description in the brackets and the brackets themselves.

rdesktop -u [username] -p [password] -d [domain] -a [8 or 16 according to your system] -f [targetname]

Explaination
Apart from the obvious ones -a sets the colour depth of the connection which is set at 8 or 16 bit and -f is the switch for fullscreen mode.

For more about the other options you can use you can type just rdesktop at the prompt and the list of switches is shown.

Example
rdesktop -u dogeatdog -p crumpet -d nicefriedeggs.local -a 16 -f flowerxppc

You can't specify all of this using the rdesktop GUI interface which isn't very surprising. The problems should now have dissappeared to some extent and it should look a whole lot better. I think it does look better but it is a fair bit away from the RDP client supplied with Windows (which was recently updated).

Now I am going to setup and run VNC to compare them both...