Wednesday, February 18, 2009

A Stick of Mint

One of the neat things about Linux is that you can install an entire operating system on a little USB stick. This allows you to run your personal operating system from just about any computer at any location. As you can imagine, there are many reasons for doing this. I'll explain mine below.

I have access to a laptop with an encrypted hard drive with Windows installed on it. I won't get in to the reasons why, but I should not be installing any programs on it. Use your imagination. If I can't install programs on Windows, I could normally resize the Windows partition and install Linux on the cleared space. However, I can't just resize the partition because the hard drive is encrypted. The one good thing is that the bios is not password protected, so I am free to change the boot order. This allows me to boot the laptop from things other than hard drives, such as CDs or USB drives.

I put an 8GB thumb drive on my Christmas list, and my brother-in-law was kind enough to get me one. Let the experimentation begin!

You can do this with as little as 1GB, but that only leaves you with about 200 MB of extra data storage. 4GB should give you plenty of wiggle room for installing updates, configuration changes, and adding several extra programs. With 8GB, I have plenty of extra room for things like music and videos.

I tried this twice, and I'll explain why later. The first method is simpler but limits your storage space to about 4GB. The second method unlocks all the available space on your USB drive.

Ubuntu has a program called usb-creator, and I used it for both methods. It is installed by default on Ubuntu 8.10, but it also works on Ubuntu 8.04 if you download it. To use it, look for the option to create a USB startup disk under the Administration menu. You might be doing this from a Live CD, which is just fine. I heard that you can even run usb-creator from Windows, so you are free to do this from your Linux or Windows desktop if you wish.

In order to boot from a live CD or a USB drive, you may need to change the boot order in your bios. This method can vary depending on your motherboard, so I won't get into that here.

The First Method:

For my first go, I formatted my entire USB drive with a FAT32 partition before using usb-creator. To do this, you can use the program, GParted, which can be found in the administration menu as "Format Hard Disk." You will need at least one FAT32 partition because the USB drive will be running Linux similar to the way your Live CD does. Don't worry, the program will enable a way to save your files and changes as I mentioned earlier.

When you run usb-creator, the program will ask you to select a .iso file to use for the installation. This can be the same .iso file you used to create your live CD. I used a second thumb drive to hold this .iso file while the program running off the live CD installed to my new thumb drive. I suppose you could copy the .iso file to the home folder of the live CD, which means it would be stored in RAM and erased when you rebooted. That's fine because you only need it once, and it allows you to get away with using only one thumb drive for the entire process.

I used a .iso file for the Ubuntu 8.10 64-bit Desktop version the first time. This worked right "out of the box" with only one small issue that I will discuss later.

One of the other options the program gives you is the ability to enable persistency. This allows your changes to the operating system to be saved, making it much nicer than just running from the Live CD. This option presents you with a slider, allowing you to designate an amount of "persistent space" on your thumb drive. This space can be as small as 128MB or as large as 4GB. Here's what's really happening behind the scenes:

The usb-creator program will copy the Live CD files from the .iso image to your thumb drive just like it does for CDs, and mark the FAT32 partition as bootable. This takes up about 700MB of the parition's space. Then, the program will create what is called a persistency file. This file is named "casper-rw" and is stored on the root of your FAT32 partition right along with the Live CD files. This persistency file is used by your Linux installation to store all the changes you make to the operating system. All your configuration changes, software updates, and added data files such as music or office documents are magically stored inside this persistency file. Think of it as a big, complex .zip file. The FAT32 file system cannot handle files that are larger than 4GB, no matter what operating system you are using. You cannot create a persistency file larger than 4GB, and as a result, you cannot store more than 4GB of extra data in it. There is a way around this, and I used it for my second method which I will discuss later.

Anyway, once you tell the program how large you want the persistency file to be, it's ready for you to click, "Make Startup Disk." Writing to flash isn't exactly speedy, so this may take a few minutes. Once it's finished, shut down operating system, remove the CD when it tells you to, and boot up again with the USB stick in the computer of your choice.

When I did this the first time, I had an almost fully functional Ubuntu operating system. It takes a while to boot up because flash drives are slower than hard drives. However, once the operating system is up and running, most things seem to run quite smoothly. The one thing that did not work right away was the wireless card. All I had to do was connect the laptop to my wired network, go to Hardware Management in the Administration menu, and select the wireless driver I wanted to enable. It downloaded the driver and turned it on after I rebooted. This is a Dell Latitude D630.

I noticed that whenever I would boot off the thumb drive, it would come up with a menu similar to the one you see on the Live CD. If you just select the default or let it timeout to the default for you, it will continue to boot to your persistent Ubuntu installation. I also noticed that Ubuntu did not require any login credentials by default, just like the Live CD. You can enable this if you want, and I did the first time, but I won't get into that right now.

One of the most fun things about having Linux on the laptop was that I was able to install Adobe Flash and watch TV shows on Hulu.com via my 32" LCD TV. I didn't have to worry about hauling a larger, noisier desktop machine over by the TV and running network cables to the family room. There were two drawbacks to this, however. First, the only sound output on the laptop is meant for microphones. In order to hear the shows we had to turn the volume all the way up on the TV and computer. I am sure a desktop or other laptop with standard sound output would not have this problem. Second, the laptop doesn't like displaying at full resolution on my TV, so the picture is smaller than it could be if the show is in widescreen. I also think that a desktop would fix this issue, because the operating system won't have to worry about the laptop's built-in display. I may still figure out how to get this to work.

Anyway, I did have one small problem when I tried installing updates from Synaptic Package Manager. I selected "Mark All Upgrades" and let it do its thing, as usual. However, when it was done, it gave me an error about a broken symbolic link. This error would pop up every time I did an update in the future. After a bit of research, I found out that it was because of an issue downloading Linux kernel updates onto Live CD types of installations. Remember, the usb-creator method of making a bootable thumb drive treats your installation much like a Live CD. The update that caused the bug wasn't really necessary, and the bug itself seemed to be harmless. I also discovered a way to fix it, but I won't go into that here.

Remember that my persistency file was only about 4GB in size. The core Linux installation was about 700MB. This left me with around 3.5GB of wasted space. I used GParted to turn that extra space into a separate FAT32 partition so I could store other files on it and access them while Linux was running. However, in the end I decided I really wanted to have all of my storage space on a single partition so I could install as many programs as I wanted in the future. This brings me to...

The Second Method:

I also had recently done some research on another popular Linux distribution called Linux Mint. According to DistroWatch.com, it is the third most popular Linux distro after Ubuntu and openSUSE. Linux Mint is based off of Ubuntu similar to the way Ubuntu is based off of Debian. However, they seem to focus on a much more user friendly experience (though I would definitely not complain about Ubuntu being unfriendly) and a better "out of the box" experience. The primary version of the operating system comes with media codecs and other free proprietary software (such as Adobe Flash) preinstalled. It also comes with some applications called Mint Tools, which have been added to make life a little easier. The graphical interface is also attractive, and more familiar to people who are used to Windows.

Since changing how persistent data was stored on my thumb drive would require me to basically start over from the beginning anyway, I decided to use Linux Mint 6 64-bit for my .iso this time. But why did I need to start over?

I found out that instead of using the casper-rw persistence file, it is also possible to simply create a separate partition with the label "casper-rw" and it will store all of the persistent data. You just need to delete the casper-rw file so Linux knows to use the partition instead.

The recommended file system for this partition is ext2. Why not ext3? Well, ext3 does a lot of extra writing to the drive for things like indexing, which isn't necessary and will actually wear out your flash drive faster. (Flash drives are supposed to have a more limited lifespan than hard drives, so keep this in mind if you ever use them for important data.) Also, it is my understanding that some of the features of ext3 aren't even enabled when running like a Live CD, so much of the benefit of ext3 is wasted anyway. So, I used GParted to make a 900MB FAT32 partition for the Live CD portion of the operating system combined with a temporary minimal casper-rw file, and used the rest of the space for ext2.

After the partitions were set up, I went to usb-creator and had it make my Linux Mint bootable drive with a minimum persistence file of 128MB. After that was finished, I deleted the casper-rw file from the FAT32 partition. In order to make use of that extra space, I went back to GParted and resized the FAT partition to 700MB and added the extra to my ext2 partition. Then, I had to label the ext2 partition as "casper-rw" by using the following command in the terminal:

e2label /dev/ casper-rw

The exact location of the ext2 partition should be listed in GParted, so be sure to use that in the command.

I rebooted, took out the CD, booted from the thumb drive, and had Linux Mint running. There was just one problem: no persistence. Of course, it was the first thing I tested. I did some research and learned a little about the Live CD menu that pops up before you actually boot into Linux. On the Live CD, and on the thumb drive, there is a file that tells the menu what options to display and how to behave. This file is /syslinux/syslinux.cfg. This file needs to tell Linux to boot into persistent mode, not just normal Live mode. I am assuming that for whatever reason, usb-creator was able to properly modify this file for Ubuntu but not for Mint, so I had to do it myself. Here's how:

Above the line that says "label live" you need to insert the lines:

label custom
menu label Start Linux Mint in ^persistent mode
kernel /casper/vmlinuz
append file=/cdrom/preseed/mint.seed boot=casper persistent initrd=/casper/initrd.gz quiet splash --

You'll notice that the only difference between the custom section and the live section is the word "persistent." After you insert those lines, you need to go to the top line and change it to say:

default custom

I guess this tells the menu to use the information in the "custom" label as the default option. For the heck of it, I also changed the "timeout 100" line to say:

timeout 50

After doing this, two things happened. First, I noticed that I no longer got the boot menu at all! The thumb drive just went straight into Linux Mint. I'm not sure why this happened, but I might have messed up the syntax in the config file. After all, this was all new to me. I actually thought this was a good thing, however, because I really don't need that menu anyway. The other thing that happened: persistent mode was now working. I guess I killed two birds with one stone.

After I installed the wireless driver exactly as before, everything worked perfectly. I didn't have to install Adobe Flash because it was already installed, and Hulu worked the same as before. I also heard that DVDs play just fine right out of the box.

Instead of using Synaptic Package Manager for my updates, I used mintUpdate, which was located in the lower right corner of the tray. One of the neat things about mintUpdate is that it ranks each update on a scale of 1 to 5. If something is very important and/or very safe to install, it gets a 1. If something is unnecessary and/or unstable, it gets a 5. I've heard that these ranks can change based on user feedback, so even if a package gets through initial testing but causes problems later, it can be moved down the list. By default, mintUpdate only displays and installs updates with a rank of 1 to 3. I changed it to display all five ranks, but only install 1 to 3. Guess what package showed up in the list of unsafe updates? The kernel update that gave me that error under Ubuntu. One of Linux Mint's tools just prevented me from getting an unnecessary error that Ubuntu would have given me (and did). I am a happy camper.

Linux Mint looks like the best option for Windows users that want to get away from Windows. I'm already talking it up to my friends. It's free, easy to use, and has a nice graphical interface that feels a bit more like what we're used to under Windows. (As with most Linux distros, you customize the GUI to look very different if you wish.) It comes with a complete office suite and e-mail client among other useful software, and it's completely free. Check it out at http://www.linuxmint.com/.

Friday, November 14, 2008

Brain Drain

In the technology industry, we understand that outsourcing is a growing problem for the American worker. However, we don't always understand why this problem is growing. If someone tells you, "It's just because they work for cheap over there," he could probably use a lesson in taxation. A family member e-mailed me the following:


Bar Stool Economics

Suppose that every day, ten men go out for beer and the bill for all ten comes to $100. If they paid their bill the way we pay our taxes, it would go something like this:

The first four men (the poorest) would pay nothing.
The fifth would pay $1.
The sixth would pay $3.
The seventh would pay $7.
The eighth would pay $12.
The ninth would pay $18.
The tenth man (the richest) would pay $59.

So, that's what they decided to do. The ten men drank in the bar everyday and seemed quite happy with the arrangement, until one day, the owner threw them a curve. 'Since you are all such good customers, he said, 'I'm going to reduce the cost of your daily beer by $20. Drinks for the ten now cost just $80.

The group still wanted to pay their bill the way we pay our taxes so the first four men were unaffected. They would still drink for free. But what about the other six men - the paying customers? How could they divide the $20 windfall so that everyone would get his 'fair share'? They realized that $20 divided by six is $3.33. But if they subtracted that from everybody's share, then the fifth man and the sixth man would each end up being paid to drink his beer. So, the bar owner suggested that it would be fair to reduce each man's bill by roughly the same amount, and he proceeded to work out the amounts each should pay.

And so:

The fifth man, like the first four, now paid nothing (100% savings).
The sixth now paid $2 instead of $3 (33%savings).
The seventh now pay $5 instead of $7 (28%savings).
The eighth now paid $9 instead of $12 (25% savings).
The ninth now paid $14 instead of $18 (22% savings).
The tenth now paid $49 instead of $59 (16% savings).

Each of the six was better off than before. And the first four continued to drink for free. But once outside the restaurant, the men began to compare their savings.

'I only got a dollar out of the $20,'declared the sixth man. He pointed to the tenth man,' but he got $10!'

'Yeah, that's right,' exclaimed the fifth man. 'I only saved a dollar, too. It's unfair that he got ten times more than I!'

'That's true!!' shouted the seventh man. 'Why should he get $10 back when I got only two? The wealthy get all the breaks!'

'Wait a minute,' yelled the first four men in unison. 'We didn't get anything at all. The system exploits the poor!'

The nine men surrounded the tenth and beat him up.

The next night the tenth man didn't show up for drinks, so the nine sat down and had beers without him. But when it came time to pay the bill, they discovered something important. They didn't have enough money between all of them for even half of the bill!

And that, boys and girls, journalists and college professors, is how our tax system works. The people who pay the highest taxes get the most benefit from a tax reduction. Tax them too much, attack them for being wealthy, and they just may not show up anymore. In fact, they might start drinking overseas where the atmosphere is somewhat friendlier.

David R. Kamerschen, Ph.D. Professor of Economics, University of Georgia

For those who understand, no explanation is needed.
For those who do not understand, no explanation is possible.


This is one of the reasons why socialism sounds nice and fair, but is actually impractical. Other countries such as France are starting to realize that different forms of wealth tax are actually losing the country tax dollars. Also, before you criticize a politician because he provided a tax cut you don't agree with, look up the actual results of that tax cut and how it affected overall tax revenue. You may be in for a shocker.

Here's something to ponder: how do you think the FairTax would affect the customers at the bar?

Tuesday, September 30, 2008

Operating Systems

A few months ago, an acquaintance brought an essay to my attention. It is titled, "In the Beginning was the Command Line," by Neal Stephenson, and it is available on his website. It is a long but informative and entertaining piece about operating systems and their history. I recommend it to anyone interested in the subject. Here is a famous excerpt:


MGBs, TANKS, AND BATMOBILES

Around the time that Jobs, Wozniak, Gates, and Allen were dreaming up these unlikely schemes, I was a teenager living in Ames, Iowa. One of my friends' dads had an old MGB sports car rusting away in his garage. Sometimes he would actually manage to get it running and then he would take us for a spin around the block, with a memorable look of wild youthful exhiliration on his face; to his worried passengers, he was a madman, stalling and backfiring around Ames, Iowa and eating the dust of rusty Gremlins and Pintos, but in his own mind he was Dustin Hoffman tooling across the Bay Bridge with the wind in his hair.

In retrospect, this was telling me two things about people's relationship to technology. One was that romance and image go a long way towards shaping their opinions. If you doubt it (and if you have a lot of spare time on your hands) just ask anyone who owns a Macintosh and who, on those grounds, imagines him- or herself to be a member of an oppressed minority group.

The other, somewhat subtler point, was that interface is very important. Sure, the MGB was a lousy car in almost every way that counted: balky, unreliable, underpowered. But it was fun to drive. It was responsive. Every pebble on the road was felt in the bones, every nuance in the pavement transmitted instantly to the driver's hands. He could listen to the engine and tell what was wrong with it. The steering responded immediately to commands from his hands. To us passengers it was a pointless exercise in going nowhere--about as interesting as peering over someone's shoulder while he punches numbers into a spreadsheet. But to the driver it was an experience. For a short time he was extending his body and his senses into a larger realm, and doing things that he couldn't do unassisted.

The analogy between cars and operating systems is not half bad, and so let me run with it for a moment, as a way of giving an executive summary of our situation today.

Imagine a crossroads where four competing auto dealerships are situated. One of them (Microsoft) is much, much bigger than the others. It started out years ago selling three-speed bicycles (MS-DOS); these were not perfect, but they worked, and when they broke you could easily fix them.

There was a competing bicycle dealership next door (Apple) that one day began selling motorized vehicles--expensive but attractively styled cars with their innards hermetically sealed, so that how they worked was something of a mystery.

The big dealership responded by rushing a moped upgrade kit (the original Windows) onto the market. This was a Rube Goldberg contraption that, when bolted onto a three-speed bicycle, enabled it to keep up, just barely, with Apple-cars. The users had to wear goggles and were always picking bugs out of their teeth while Apple owners sped along in hermetically sealed comfort, sneering out the windows. But the Micro-mopeds were cheap, and easy to fix compared with the Apple-cars, and their market share waxed.

Eventually the big dealership came out with a full-fledged car: a colossal station wagon (Windows 95). It had all the aesthetic appeal of a Soviet worker housing block, it leaked oil and blew gaskets, and it was an enormous success. A little later, they also came out with a hulking off-road vehicle intended for industrial users (Windows NT) which was no more beautiful than the station wagon, and only a little more reliable.

Since then there has been a lot of noise and shouting, but little has changed. The smaller dealership continues to sell sleek Euro-styled sedans and to spend a lot of money on advertising campaigns. They have had GOING OUT OF BUSINESS! signs taped up in their windows for so long that they have gotten all yellow and curly. The big one keeps making bigger and bigger station wagons and ORVs.

On the other side of the road are two competitors that have come along more recently.

One of them (Be, Inc.) is selling fully operational Batmobiles (the BeOS). They are more beautiful and stylish even than the Euro-sedans, better designed, more technologically advanced, and at least as reliable as anything else on the market--and yet cheaper than the others.

With one exception, that is: Linux, which is right next door, and which is not a business at all. It's a bunch of RVs, yurts, tepees, and geodesic domes set up in a field and organized by consensus. The people who live there are making tanks. These are not old-fashioned, cast-iron Soviet tanks; these are more like the M1 tanks of the U.S. Army, made of space-age materials and jammed with sophisticated technology from one end to the other. But they are better than Army tanks. They've been modified in such a way that they never, ever break down, are light and maneuverable enough to use on ordinary streets, and use no more fuel than a subcompact car. These tanks are being cranked out, on the spot, at a terrific pace, and a vast number of them are lined up along the edge of the road with keys in the ignition. Anyone who wants can simply climb into one and drive it away for free.

Customers come to this crossroads in throngs, day and night. Ninety percent of them go straight to the biggest dealership and buy station wagons or off-road vehicles. They do not even look at the other dealerships.

Of the remaining ten percent, most go and buy a sleek Euro-sedan, pausing only to turn up their noses at the philistines going to buy the station wagons and ORVs. If they even notice the people on the opposite side of the road, selling the cheaper, technically superior vehicles, these customers deride them cranks and half-wits.

The Batmobile outlet sells a few vehicles to the occasional car nut who wants a second vehicle to go with his station wagon, but seems to accept, at least for now, that it's a fringe player.

The group giving away the free tanks only stays alive because it is staffed by volunteers, who are lined up at the edge of the street with bullhorns, trying to draw customers' attention to this incredible situation. A typical conversation goes something like this:

Hacker with bullhorn: "Save your money! Accept one of our free tanks! It is invulnerable, and can drive across rocks and swamps at ninety miles an hour while getting a hundred miles to the gallon!"

Prospective station wagon buyer: "I know what you say is true...but...er...I don't know how to maintain a tank!"

Bullhorn: "You don't know how to maintain a station wagon either!"

Buyer: "But this dealership has mechanics on staff. If something goes wrong with my station wagon, I can take a day off work, bring it here, and pay them to work on it while I sit in the waiting room for hours, listening to elevator music."

Bullhorn: "But if you accept one of our free tanks we will send volunteers to your house to fix it for free while you sleep!"

Buyer: "Stay away from my house, you freak!"

Bullhorn: "But..."

Buyer: "Can't you see that everyone is buying station wagons?"


My favorite line from this snippet is, "You don't know how to maintain a station wagon either!" Seriously, if familiarity is the only thing stopping you from trying something new, you are cheating yourself out of many greater advantages. Suck it up. You may even find that a tank is easier to drive and repair despite your limited experience. I did.