Twitter Updates

12/6/2006

Hello, Linux (Part 2)

Filed under: — AlienMind @ 9:06 pm

In Part One of “Hello, Linux” I described the basic machine and setup I use with Knoppix.

Knoppix runs off of a CD-ROM; simply pop in the CD, boot the machine and you’ll have a fully running Knoppix Linux system in a few minutes, and no need for a hard drive.

As my machine has 2 gigabytes of RAM, I can afford to lose some – I won’t be using nearly that amount during normal operations under Knoppix.

There is a downside to loading the whole CD into RAM - this increases the boot time from about a minute to about 8 minutes as it takes a while to read all of that data. However, the advantage is that you won’t have to wait for the CD to spin up when you type command or run programs on the system – all of the executables will be in RAM. It very much depends on what you are doing – for quick system recovery tasks I don’t bother loading things to RAM. For long-term login sessions I almost always do load it into RAM. YMMV

When the boot screen comes up it prompts you for any startup options you wish to give the system. In my case I want to make sure that the system will copy the entire contents of the CD-ROM into RAM (faster, and no disk to spin up and spin down wasting battery life). Also, I want to make sure the system uses the correct screen resolution. Knoppix is pretty good about guessing, but it can be conservative in the guesses and you often end up with a resolution of 800×600 – not bad, but a waste on a machine that can do 1280×1024.

So, my startup arguments to the boot prompt are:

knoppix toram screen=1280×1024 depth=24

This copies Knoppix to the system RAM (“toram”), sets my resolution to 1280×1024 (screen=1280×1024) and sets my screen color depth to 24 bit (depth=24). The options you need to use may vary; simply hit F3 on your keyboard while the boot prompt is displayed to see the various options, or consult the Knoppix Cheat Sheet.

Also, keep in mind that if you don’t type anything for a small period of time (usually 30 seconds) the system will automatically boot.

The biggest disadvantage of Knoppix is the very thing that makes it attractive; it is run off of a CDROM. This means that, with the exception of areas that are layered by a Union Filesystem (more on that later), the entire system is read-only. No changes possible.

That’s nice for making sure that no one can alter your system, but if you want to have persistent data across boots then something has to be done.

Enter the idea of a “persistent home image”. In my case, I have a 100Mb persistant home directory and system setting image on a removable SanDisk thumb drive. This stores all of my settings for various programs (like X-Chat, and IRC client) and also saves all of the system settings for my desktop, such as the placement of icons and the system settings that control my screen resolution.

Creating this is very easy.

  • Insert your thumbdrive – no need to mount it explicity, the system will find it
  • Make any changes to the system you may need to keep permanently
  • Find this entry in the system menus and choose it (click for larger image):

  • Answer this dialog correctly:

At this point the system will ask you where you want to put your persistant image. In my case I chose the thumbdrive I had inserted into the system:

You will then be asked if you want to encrypt the thumbdrive image. As I am on the road and don’t want anyone reading my files, I answered yes. Keep in mind that they system will want a 20 character password so start thinking of that password now, and don’t forget it.

Finally, the system will prompt you for how large you want your persistant home directory to be. 100Mb is the default, but you can have a much larger one if you need it; it all depends on available space.

After this the system will proceed to create your persistant directory and populate it and, optionally, ask you to type in your initial password.

Once you’ve done this it is best to reboot to check out the persistant storage to make sure it works. Do this by logging out of Knoppix and choosing to restart – don’t forget to have your thumbdrive plugged into the machine during boot. . Once the boot prompt comes back up you only need to type “knoppix” or, if you want to run from RAM, “knoppix toram”. Your home directory and settings should be found automatically; if they aren’t, use the additional boot parameters of “home=scan” and/or “config=scan” so they system will search for them.

If the system finds your persistant home it will prompt you, asking if you want to use it. If so, hit the Left arrow key and hit return, accepting the defaults. Also, if you encrypted your persistant home then you will be prompted for your (at least) 20 character password. I hope you haven’t forgotten it…

One additional caveat; once you’ve set up a persistant home the settings contained therein will override the screen resolution you specify in your boot line; so, if you booted with 800×600 and saved your persistant home with that resolution, booting later with “screen=1280×1024” will not do what you want; you will still boot into 800×600 configuration because that is what you have saved on your persistant storage. You will need to change the screen resolution while running Knoppix, then reboot. This will save the new resolution settings to your persistant storage and make sure your boot resolution is what you want it to be.

Next for Part 3: Ok, but my thumbdrive isn’t big enough – I need more space! How to create an encrypted space on the hard drive.

12/3/2006

Hello Linux (Part 1)

Filed under: — AlienMind @ 9:09 pm

For reasons I will not go into here I am going to be using Linux for the next week. Here is a picture of my desktop (click for gigantic-sized image):

I’m running Knoppix 5.01 on an IBM T43 Laptop. The T43 is a Pentium “M” based laptop running at 2.0Ghz, with 2GB of RAM and an 80GB hard disk. The maximum screen resolution is 1280×1024, and it has built-in WiFi and a CD Burner/DVD reader.

So, as Non-Apple Intel hardware goes, it’s not too bad. I will admit to being an Apple bigot, and as I have a MacBook I have noticed a few things that drive me crazy. Let’s get those out of the way right now:

  • It feels big and clunky
  • The screen hinges on top of the body, making the screen very tall. So, it feels… big and clunky
  • The fan runs all the time. It hardly ever shuts off. This may be partly due to the Linux distro I’m running, but it hardly ever shut off when using Windows, either. It certainly puts a lot of heat out of the exhaust port – don’t sit this on your lap
  • The fan issues contribute greatly to the not-so-great battery life – about 2 hours
  • The plastic feels cheap and flimsy
  • The screen is a 4×3 arrangement instead of a 16×9 – I’m surprised at how much this bothers me

Ok, that’s out of the way. None of this is a manufacturing flaw; it’s just me whining because it isn’t what I would buy… but I didn’t buy this machine. So I’ll quit whining now.

On to the operating system.

The machine originally came with – of course – Microsoft Windows XP. I actually used it that way for a while. I have a license for VMWare under Windows, and at that time the only free VMWare product was VMWare Player. As I needed to be able to create and snapshot the virtual machines I had to use the pay-for product, and the only license I had for that only ran under Windows. So, Windows it was. And this worked just fine for me for about 3 months – I ran two virtual Linux machines under Windows and it only locked up twice. Not bad for 24×7 service – which simply backs up my assertion that XP was the first Windows OS that was “good enough”. (This makes me wonder what the incentive is for upgrading to Vista.)

Eventually I wanted to have a base OS that was actually useful for other Linux-oriented tasks, so I put Fedora Core 5 on the machine as a base OS. This worked fine, and although I’ve never managed to get the WiFi drivers to work, it does a very good job. Like the previous Windows install, it serves as a host for virtual machines – in this case, using Parallels Workstation for Linux instead of VMWare.

  1. Yes, I am aware the VMWare server is now free. I bought Parallels before that happened. VMWare server is a very good product.
  2. Yes, I am aware that we are up to Fedora Core 6. Please don’t write me about this.

So, what I have now is:

  • An IBM laptop that runs Fedora Core 5 and Parallels Workstation
  • It is specially configured to run my companies product in virtual machines
  • It really isn’t designed – or hardened – to run on public networks
  • It is the machine I have to attach to various public networks

In light of this I decided to use Knoppix on this machine. Knoppix is normally a “Live CD” based Linux distribution – you use the CD to boot the system and all of the system binaries are run off of the CD - without touching the hard drive on the computer. You can store your private files on a thumb drive, so all you really need to have a computer is an Intel-compatible machine, your thumb drive and the Knoppix boot disk. Almost any machine will do.

This gives me the best of both worlds; I can boot Fedore Core whenever I need to use that setup, but otherwise I can run Knoppix off of a read-only CD-ROM… which means the boot disk is read-only and cannot be altered no matter what happens on a public network. Add to that the ability to have a permanent, encrypted home directory and you’ve got a winning combination.

Next: Knoppix boot options and creating a portable, permanent home directory.

12/3/2005

Sed - An Introduction and Tutorial

Filed under: — AlienMind @ 12:29 pm

Sed (or “sed”, the UNIX stream editor) can be used to edit things as they go through a pipe.

In UNIX parlance, that is one program that feeds it’s output directly to another program. It’s common for UNIX programs to do one thing, and (hopefully) do it well.

An example:

cat mywords.txt | sort | uniq | wc -l

The above example sends the file “mywords.txt” to the sort utility (which sorts the words in alphabetical order), then through “uniq” (which only leaves one instance of any word) and then to the “wc” utility which does a word count. This gives me a unique word count (in a case sensitive way), and uses pipes to communicate between the programs.

Well, if I had done this:

cat mywords.txt | sort | uniq | sed 's/A/x/g'

the last step would have, after sorting and uniqing, replaced all capital “A” characters with a lower case “x”. A simple – and useless – example, but it does illustrate what sed is for.

On digg I came across a link to this Sed introduction and tutorial. Useful if this sort of thing interests you.

11/12/2005

Linux Sysadmin Magic

Filed under: — AlienMind @ 3:28 pm

Here are a bunch of useful tips on how to do various Sysadmin-y actions on a Linux system.

I don’t know if any of these will be directly applicable to my readers, but there are a number of interesting solutions to problems. Think of it as a somewhat unfocused Linux cookbook.

Tweaky User- & Sysadmin

HTMLtoRSS

Filed under: — AlienMind @ 3:24 pm

I’ll admit that I’ve really started to enjoy the whole RSS capabilities of blogs; I get notified only when a page changes.

But this is a problem for other things… like straight HTML pages that have no RSS capabilities and are only updated very, very infrequently. Pages like some people’s “journals”.

Since I can’t go and fix the problem (no periodic updating notification) and it is too costly in time to check it manually, I use the HTMLtoRSS script to change the HTML into an RSS feed and then subscribe to that feed. Then, if there is a change, I get notified in an asynchronous manner. Yay!

Below is the link to the script. Works with NetNewsWire (Mac only), but uses Ruby and can easily be hacked to work with Linux. Maybe I’ll do that and post the diffs.

HTMLtoRSS

gumstix - teeny, tiny computers

Filed under: — AlienMind @ 3:10 pm

Hey, considering the size of these machines maybe I can afford to buy them at will. Power won’t be a problem.

Actually, I have no need for a gumstick-sized Linux box, but maybe you do:

gumstix – all things small

Xen virtual machine monitor

Filed under: — AlienMind @ 3:01 pm

Why, yes, today is computer link day!

I tend to run a lot of test scenarios on the machines here at Chez Templin. My last one was setting up a 4 machine cluster for a demonstration during a presentation. (On a side note, setting up the cluster took an hour. ONE HOUR TO SET UP A 4 NODE CLUSTER. I would not have believed it if I hadn’t seen it.)

Anyway, I do, at times, run out of machines. I can’t just go out and buy new ones at the drop of a hat, and I don’t have the room (or power budget) for them anyway.

This is where virtual machines come in. I’ve done this before; when I worked at Sendmail I had a license for VMware; it’s a very nice product, and I also had a license for it when I worked at Bank of America.

VMware is very nice… if you can afford it. I cannot. Lucky for me, Linux has some built-in abilities to do multiple virtual machines on the same system, and this is taken advantage of by the Xen Virtual Machine.

Computer Laboratory – Xen virtual machine monitor – the actual project itself.

An Introduction to the Xen virtual machine

10/9/2005

Safe from financial ruin

Filed under: — AlienMind @ 12:34 am

One of the big worries I have had since I colocated this machine is the fear of doing something that will get noticed. You know, something cool that might get noticed on /. (yeah, right) or someone else putting up something for download that gets popular.

I only pay for 256kbps (kiloBYTES per second, not bits) of bandwidth, and I am charged accordingly. If I go over that amount for any significant amount of time then the bandwidth bills will add up very, very quickly. We have friends in Santa Monica that learned that lesson the hard way.

So, tonight I finally got around to implementing traffic shaping on this machine. My bandwidth is burstable, so short bursts over 256kbps are ok, but long amounts of traffic above that speed are not. Using the /sbin/tc command on my machine I’m managed to make it so that bursting traffic (images, etc.) are sent very quickly, but larger files are not. Now I can finally do backups without worrying that I’ll bankrupt myself.

In case you are interested, the /sbin/tc command was put into /etc/rc.d/rc.local, and it is:

/sbin/tc qdisc add dev eth0 root tbf rate 235kbps latency 50ms burst 15400

So, all you people whom I host, you need no longer fear bankrupting me with your digital ways.

As if you were worrying in the first place.

  22 queries. 6.042 seconds. Powered by WordPress