Creating images of floppy diskettes with Linux or DOS

If you want to archive floppies–a good idea, since a floppy disk can sit for months unused and go bad between the time you made it and the time you really needed it, and since it’s hard to shuffle through a collection of hundreds of disks and find the one you need–Linux is an ideal environment for it. To create a disk image, use the following command:
dd if=/dev/fd0 of=filename bs=18k

The if parameter tells it the input device or file (the floppy drive, in this case), and the of parameter tells it the output device or filename. The bs parameter is block size. Most people use a block size of 512, since that’s the size of a disk sector, but it’s slightly faster to write an entire track at once. The speed increase is only slight, but I thought you might like to know. Floppies are already slow enough as it is. I’ve also heard allegations that reading and writing entire tracks at once is more reliable, but I can’t substantiate those claims.

To write out a disk image, simply reverse the if and of parameters:

dd if=filename of=/dev/fd0 bs=18k

Disk images in this format are portable; any Unix can rewrite them to disk, as can the DOS/Windows utility rawrite, which you’ll find on virtually every Linux installation CD. Most other popular disk-imaging programs for DOS and Windows can handle this file format as well.

If you want an equivalent DOS/Windows command-line program to create dd/rawrite-compatible disk images, check out fimage. You can even make those images self-extracting executables with sfx144, if you wish.

If I had my own Linux distribution

I found an interesting editorial called If I had my own Linux Distro. He’s got some good ideas but I wish he’d known what he was talking about on some others.
He says it should be based on FreeBSD because it boots faster than Linux. I thought everyone knew that Unix boot time has very little to do with the kernel? A kernel will boot more slowly if it’s trying to detect too much hardware, but the big factor in boot time is init, not the kernel. BSD’s init is much faster than SysV-style init. Linux distros that use BSD-style inits (Slackware, and optionally, Debian, and, as far as I understand, Gentoo) boot much faster than systems that use a traditional System V-style init. I recently converted a Debian box to use runit, and the decrease in boot time and increase in available memory at boot was noticeable. Unfortunately now the system doesn’t shut down properly. But it proves the concept.

He talks about installing every possible library to eliminate dependency problems. Better idea: Scrap RPM and use apt (like Debian and its derivatives) or a ports-style system like Gentoo. The only time I’ve seen dependency issues crop up in Debian was on a system that had an out of date glibc installed, in which case you solve the issue by either keeping the distribution up to date, or updating glibc prior to installing the package that fails. These problems are exceedingly rare, by the way. In systems like Gentoo, they don’t happen because the installation script downloads and compiles everything necessary.

Debian’s and Gentoo’s solution is far more elegant than his proposal: Installing everything possible isn’t going to solve your issue when glibc is the problem. Blindly replacing glibc was a problem in the past. The problems that caused that are hopefully solved now, but they’re beyond the control of any single distribution, and given the choice between having a new install stomp on glibc and break something old or an error message, I’ll take the error message. Especially since I can clear the issue with an apt-get install glibc. (Then when an old application breaks, it’s my fault, not the operating system’s.)

In all fairness, dependency issues crop up in Windows all the time: When people talk about DLL Hell, they’re talking about dependency problems. It’s a different name for the same problem. On Macintoshes, the equivalent problem was extensions conflicts. For some reason, people don’t hold Linux to the same standard they hold Windows and Macs to. People complain, but when was the last time you heard someone say Windows or Mac OS wasn’t ready for the desktop, or the server room, or the enterprise, or your widowed great aunt?

He also talks about not worrying about bloat. I take issue with that. When it’s possible to make a graphical Linux distribution that fits on a handful of floppies, there’s no reason not to make a system smooth and fast. That means you do a lot of things. Compile for an advanced architecture and use the -O3 options. Use an advanced compiler like CGG 3.2 or Intel’s ICC 7.0 while you’re at it. Prelink the binaries. Use a fast-booting init and a high-performance system logger. Mount filesystems with the highest-performing options by default. Partition off /var and /tmp so those directories don’t fragment the rest of your filesystem. Linux can outperform other operating systems on like hardware, so it should.

But when you do those things, then it necessarily follows that people are going to want to run your distribution on marginal hardware, and you can’t count on marginal hardware having a 20-gig hard drive. It’s possible to give people the basic utilities, XFree86, a reasonably slick window manager or environment, and the apps everyone wants (word processing, e-mail, personal finance, a web browser, instant messaging, a media player, a graphics viewer, a few card games, and–I’ll say it–file sharing) in a few hundred megabytes. So why not give it to them?

I guess all of this brings up the nicest thing about Linux. All the source code to anything desirable and all the tools are out there, so a person with vision can take them and build the ultimate distribution with it.

Yes, the idea is tempting.

How to determine which device drivers to use in Linux

A question came up in the comments of one of my past entries that raised a good question: When you can’t get a device to work, how do you determine which kernel module (Unix-speak that roughly translates to “device driver”) to use to get the hardware working?
Linux has a virtual file at /proc/pci that lists every PCI device it finds in the system. So you can just more /proc/pci to page through a system inventory and find out what video card, NIC, motherboard chipset, IDE and/or SCSI controller, and other devices are in the system.

If you’re in the process of installing when you need this information (highly likely), use ALT-F2 to get to a text console–or CTRL-ALT-F2 to get to a text console from a GUI installer–and issue the commands.

To get back to your installer, hit ALT-F1 to get back to a text-based installer, or CTRL-ALT-F7 to get back to a GUI installer. If CTRL-ALT-F7 doesn’t get you back to the GUI, try the other CTRL-ALT-function combinations.

What large market for x86 Unix?

What large market for x86 Unix?

In a bizarre turn of events, SCO has sued IBM for not less than $1 billion, claiming IBM willfully destroyed SCO’s business by handing its intellectual property over to the Linux movement.

Read more

How DOS came to be IBM’s choice of operating system

The urban legend says Gary Kildall snubbed the IBM suits by making them wait in his living room for hours while he flew around in his airplane, and the suits, not taking it well, decided to cut him out of the deal and opted to do business with Bill Gates and Microsoft, thus ending Digital Research’s short reign as the biggest manufacturer of software for small computers.

Read more

Finally–GPL antivirus for Linux

Clamav is a free (GPL) virus scanner for Linux and other Unix systems. It seems to work well. The price is right.
There are very few viruses for Linux, so few that most people don’t waste their time with virus scanning. But if the machine is acting as a server for clients that are vulnerable to viruses–cough–Windows–cough–it’s a good idea to have antivirus software on your server, just so you know your clients are safe.

Debian packages are in Sarge and Sid. Source can be downloaded and built from the link above. Once it becomes better known, it should appear in RPM distributions such as Red Hat in time.

It’s just a scanner, but if it finds an infected file, you can clean it manually with free tools you download elsewhere. Clamav will take care of alerting you, the price is right, and the platform’s right. It’s always been hard to find antivirus software for Linux of any sort, so Clamav is a welcome addition to the family.

We’ll talk a lot more about servers in the coming days.

Disadvantages of Windows 3.1

Note: I wrote this way back in 2003, so my advice as far as replacing Windows 3.1 is a bit dated, but the strengths and weaknesses remain valid. If you’re thinking of a new computer, please don’t run anything older than Windows 10.

I found a search in my log analysis for “disadvantages of windows 3.1,” which I found interesting. I can talk about that. Someone asked for it, and I aim to please. So let’s head down memory lane.

Read more

Roll your own news aggregator in PHP

M.Kelley: I’m also wondering how hard would it be to pull a PHP/MySQL (or .Net like BH uses) tool to scrape the syndicated feeds off of websites and put together a dynamic, constantly updated website.
It’s almost trivial. So simple that I hesitate to even call it “programming.” And there’s no need for MySQL at all–it can be done with a tiny bit of PHP. Since it’s so simple, and potentially so useful, it’s a great first project in PHP.

It’s also terribly addictive–I quickly found myself assembling my favorite news sources and creating my own online newspaper. To a former newspaper editor (hey, they were student papers, but one of them was at Mizzou, and in my book, if you can be sued for libel and anyone will care, it counts), it’s great fun.

All you need is a little web space and a writable directory. If you administer your own Linux webserver, you’re golden. If you have a shell account on a Unix system somewhere, you’re golden.

First, grab ShowRDF.php by Ian Monroe, a simple GPL-licensed PHP script that does all the work of grabbing and decoding an RDF or RSS file. There are tons of tutorials online that tell you how to code your own solution to do this, but I like this one because you can pass options to it to limit the number of entries, and the length of time to cache the feed. Many RDF decoders fetch the file every time you call them, and some feeds impose a once-an-hour limit and yell at you (or just flat ban you) if you go over. Using existing code is a good way to get started; you can write your own decoder that works the way you want at some later date.

ShowRDF includes a PHP function called InsertRDF that uses the following syntax:
InsertRDF("feed URL", "name of file to cache to", TRUE, number of entries to show, number of seconds to cache feed);

Given that, here’s a simple PHP page that grabs my newsfeed:


<html><body>

<?php include("showrdf.php"); ?>

<?php

// Gimme 5 entries and update once an hour (3600 seconds)

InsertRDF("https://dfarq.homeip.net/b2rss.xml", "~/farquhar.cache", TRUE, 5, 3600);

?>

</body></html>

And that’s literally all there is to it. That’ll give you a very simple HTML page with a bulleted list of my five most recent entries. Unfortunately it gives you the entries in their entirety, but that’s b2’s fault, and my fault for not modifying it. I’ll be doing that soon.

You can see the script in action by copying and pasting it into your Web server. It’s not very impressive, but it also wasn’t any effort either.

You can pretty it up by making yourself a nice table, or you can grab a nice CSS layout from glish.com.

I can actually code tables without stealing even more code, so here’s an example of a fluid three-column layout using tables that’ll make a CSS advocate’s skin crawl. But this’ll get you started, even if that’s the only useful purpose it serves.


<html><body>

<?php include("showrdf.php"); ?>

<table width="99%" border="0" cellpadding="6">

<tr>

<td colspan="3" align="left">
<h1>My personal newspaper</h1>
</td>

</tr>

<tr>

<td width="25%">

<!--- This is the leftmost column's contents -->

<!--- Hey, how about a navigation bar? -->

<?php include("navigationbar.html"); ?>

</td>

<!--- Middle column -->

<td width="50%">

<p><h1>Dave Farquhar</h1></p>

<?php

// Gimme 5 entries and update once an hour (3600 seconds)

InsertRDF("https://dfarq.homeip.net/b2rss.xml", "~/farquhar.cache", TRUE, 5, 3600);

?>

</td>

<!--- Right sidebar column -->

<td width="25%">

<p><h2>Freshmeat</h2></p>

<?php

InsertRDF("http://www.freshmeat.net/backend/fm-releases-software.rdf", "~/fm.cache", TRUE, 10, 3600);

?>

<p><h2>Slashdot</h2></p>

<?php

InsertRDF("http://slashdot.org/developers.rdf", "~/slash.cache", TRUE, 10, 3600);

?>

</td>

</tr>

</table>

</body></html>

Pretty it up to suit your tastes by adding color elements to the <td> tags and using font tags. Better yet, use the knowledge you just gained to sprinkle PHP statements into a pleasing CSS layout you find somewhere.

Finding newsfeeds is easy. You can find everything you ever wanted and then some at Newsisfree.com.

Using something like this, you can create multiple pages, just like a newspaper, and put links to each of your files in a file called navigationbar.html. Every time you create a new page containing a set of feeds, link to it in navigationbar.html, and all of your other pages will reflect the change. This shows another nice, novel use of PHP’s niceties–managing things like navigation bars is one of the worst things about static HTML pages. PHP makes it very convenient.

Why I dislike Microsoft

“Windows 2000,” I muttered as one of my computers fired up so my girlfriend could use it. “Must mean something about the number of bugs that’ll be discovered tomorrow.”
She told me she liked Windows and asked me why I hated Microsoft so much.

It’s been a while since I thought about that. She speculated that I was annoyed that Bill Gates is smarter than me. (Which he probably is, but aside from a couple more books in print, it hasn’t gotten him anything I don’t have that I want.) There’s more to it than that.

I’m still annoyed about the foundation Microsoft built its evil empire upon. In the ’70s, Microsoft was a languages company, and they specialized in the language Basic. Microsoft Basic wasn’t the best Basic on the market, but it was the standard. And when IBM decided it wanted to enter the personal computer market, IBM wanted Microsoft Basic because nobody would take them seriously if they didn’t. So they started talking to Microsoft.

IBM also wanted the CP/M operating system. CP/M wasn’t the best operating system either, but it was the standard. IBM was getting ready to negotiate with Gary Kildall, owner of Digital Research and primary author of the OS, and ran into snags. Gates’ account was that Kildall went flying and kept the IBM suits waiting and then refused to work with them. More likely, the free-spirited and rebellious Kildall didn’t want to sign all the NDAs IBM wanted him to sign.

Microsoft was, at the time, a CP/M subcontractor. Microsoft sold a plug-in board for Apple II computers that made them CP/M-compatible. So IBM approached Microsoft about re-selling CP/M. Microsoft couldn’t do it. And that bothered Gates.

But another Microsoft employee had a friend named Tim Patterson. Tim Patterson was an employee of Seattle Computer Products, a company that sold an 8086-based personal computer similar to the computer IBM was developing. CP/M was designed for computers based on the earlier 8080 and 8085 CPUs. Patterson, tired of waiting for a version of CP/M for the 8086, cloned it.

So Seattle Computer Products had something IBM wanted, and Microsoft was the only one who knew it. So Microsoft worked out a secret deal. For $50,000, they got Patterson and his operating system, which they then licensed to IBM. Patterson’s operating system became PC DOS 1.0.

Back in the mid-1990s, PC Magazine columnist John C. Dvorak wrote something curious about this operating system. He said he knew of an easter egg present in CP/M in the late 1970s that caused Kildall’s name and a copyright notice to be printed. Very early versions (presumably before the 1.0 release) of DOS had this same easter egg. This of course screams copyright violation.

Copyright violation or none, Kildall was enraged the first time he saw DOS 1.0 because it was little more than a second-rate copy of his life’s work. And while Digital Research easily could have taken on Microsoft (it was the bigger company at the time), the company didn’t stand a prayer in court against the mighty IBM. So the three companies made some secret deals. The big winner was Microsoft, who got to keep its (possibly illegal) operating system.

Digital Research eventually released CP/M-86, but since IBM sold CP/M-86 for $240 and DOS for $60, it’s easy to see which one gained marketshare, especially since the two systems weren’t completely compatible. Digital Research even added multiuser and multitasking abilities to it, but they were ignored. In 1988, DR-DOS was released. It was nearly 100% compatible with MS-DOS, faster, less expensive, and had more features. Microsoft strong-armed computer manufacturers into not using it and even put cryptic error messages in Windows to discourage the end users who had purchased DR-DOS as an upgrade from using it. During 1992, DR-DOS lost nearly 90% of its marketshare, declining from $15.5 million in sales in the first quarter to just $1.4 million in the fourth quarter.

Digital Research atrophied away and was eventually bought out by Novell in 1991. Novell, although the larger company, fared no better in the DOS battle. They released Novell DOS 7, based on DR-DOS, in 1993, but it was mostly ignored. Novell pulled it from the market within months. Novell eventually sold the remnants of Digital Research to Caldera Inc., who created a spinoff company with the primary purpose of suing Microsoft for predatory behavior that locked a potential competitor out of the marketplace.

Caldera and Microsoft settled out of court in January 2000. The exact terms were never disclosed.

Interestingly, even though it was its partnership with IBM that protected Microsoft from the wrath of Gary Kildall in 1981, Microsoft didn’t hesitate to backstab IBM when it got the chance. By 1982, clones of IBM’s PC were beginning to appear on the market. Microsoft sold the companies MS-DOS, and even developed a custom version of Basic for them that worked around a ROM compatibility issue. While there was nothing illegal about turning around and selling DOS to its partner’s competitors, it’s certainly nobody’s idea of a thank-you.

Microsoft’s predatory behavior in the 1980s and early ’90s wasn’t limited to DOS. History is littered with other operating systems that tried to take on DOS and Windows and lost: GeoWorks. BeOS. OS/2. GeoWorks was an early GUI programmed in assembly language by a bunch of former videogame programmers. It was lightning fast and multitasked, even on 10 MHz XTs and 286s. It was the most successful of the bunch in getting OEM deals, but you’ve probably never heard of it. OS/2 was a superfast and stable 32-bit operating system that ran DOS and Windows software as well as its own, a lot like Windows NT. By Gates’ own admission it was better than anything Microsoft had in the 1990s. But it never really took off, partly because of IBM’s terrible marketing, but partly because Microsoft’s strong-arm tactics kept even IBM’s PC division from shipping PCs with it much of the time. BeOS was a completely new operating system, written from scratch, that was highly regarded for its speed. It never got off the ground because Microsoft completely locked it out of new computer bundles.

Microsoft used its leverage in operating systems to help it gain ground in applications as well. In the 1980s, the market-leading spreadsheet was Lotus 1-2-3. There was an alleged saying inside Microsoft’s DOS development group: DOS ain’t done ’til Lotus won’t run. Each new DOS revision, from version 3 onward, broke third-party applications. Lotus 1-2-3, although once highly regarded, is a noncontender in today’s marketplace.

Once Windows came into being, things only got worse. Microsoft’s treatment of Netscape was deplorable. For all intents and purposes, Microsoft had a monopoly on operating systems by 1996, and Netscape had a monopoly on Web browsers. Netscape was a commercial product, sold in retail stores for about $40, but most of its distribution came through ISPs, who bought it at a reduced rate and provided it to their subscribers. Students could use it for free. Since the Web was becoming a killer app, Netscape had a booming business. Microsoft saw this as a threat to its Windows franchise, since Netscape ran well not only on Windows, but also on the Mac, OS/2 and on a number of flavors of Unix. So Microsoft started bunding Internet Explorer with Windows and offering it as a free download for those who already had Windows, or had an operating system other than Windows, such as Mac OS. In other industries, this is called tying or dumping, and it’s illegal. Netscape, once the darling of Wall Street, was bought for pennies on the dollar by AOL, and AOL-Time Warner is still trying to figure out what to do with it. Once Microsoft attained a monopoly on Web browsers, innovation in that space stopped. Internet Explorer has gotten a little bit faster and more standards compliant since IE4, but Microsoft hasn’t put any innovation in the browser for five years. Want popup blocking or tabs? You won’t find either in IE. All of the innovation in that space has come in browsers with a tiny piece of the market.

One could argue that consumers now get Web browsers for free, where they didn’t before. Except every new computer came with a Web browser, and most ISPs provided a browser when you signed up. So there were lots of ways to get a Web browser for free in the mid-’90s.

And when it came to the excesses of the dotcom era, Netscape was among the worst. But whether Netscape could have kept up its perks given its business model is irrelevant when a predator comes in and overnight renders unsalable the product that accounts for 90% of your revenue.

Allegations popped up again after Windows 95’s release that Win95 sabotoged competitors’ office software, such as WordPerfect and Lotus 1-2-3. Within a couple of years, Microsoft Office was a virtual monopoly, with Lotus SmartSuite existing almost exclusively as a budget throw-in with new PCs and WordPerfect Office being slightly more common on new PCs and an also-ran in the marketplace. It’s been five years since any compelling new feature has appeared in Microsoft Office. The most glaring example of this is spam filtering. Innovative e-mail clients today have some form of automatic spam filtering, either present or in development. Outlook doesn’t. “Microsoft Innovation” today means cartoon characters telling you how to indent paragraphs.

And the pricing hasn’t really come down either. When office suites first appeared in 1994, they cost around $500. A complete, non-upgrade retail copy of Microsoft Office XP still costs about $500.

Pricing hasn’t come down on Windows either. In the early 90s, the DOS/Windows bundle cost PC manufacturers about $75. Today, Windows XP Home costs PC manufacturers about $100. The justification is that Windows XP Home is more stable and has more features than Windows 3.1. Of course, the Pentium 4 is faster and less buggy than the original Pentium of 1994, but it costs a lot less. Neither chip can touch Windows’ 85% profit margin.

And when Microsoft wasn’t busy sabotaging competitors’ apps, it was raiding its personnel. Microsoft’s only really big rival in the languages business in the ’80s and early ’90s was Borland, a company founded by the flambouyant Phillippe Kahn. Gates had a nasty habit of raiding Borland’s staff and picking off their stars. It didn’t go both ways. If a Microsoft employee defected, the employee could expect a lawsuit.

Well, Kahn decided to play the game once. He warmed up to a Microsoft staffer whose talents he believed weren’t being fully utilized. The employee didn’t want to jump ship because Microsoft would sue him. Kahn said fine, let Microsoft sue, and Borland would pay whatever was necessary. So he defected. As expected, Gates was enraged and Microsoft sued.

Soon afterward, Kahn and his new hire were in an airport when a Hare Krishna solicited a donation. Kahn handed him $100 on the spot and told him there was a whole lot more in it for him if he’d deliver a message to Bill Gates: “Phillippe just gave us $100 for hot food because he suspects after this lawsuit, your employees are going to need it.”

He delivered the message. Gates wasn’t amused.

It was a bold, brash move. And I think it was pretty darn funny too. But smart? Not really. Borland’s glory days were pretty much over 10 years ago. For every star Borland could lure away, Microsoft could lure away three. Borland’s still in business today, which makes it fairly unique among companies that have taken on Microsoft head-on, but only after several reorganizations and major asset selloffs.

The only notable company that’s taken on Microsoft in the marketplace directly and won has been Intuit, the makers of Quicken. Microsoft even gave away its Quicken competitor, Microsoft Money, for a time, a la Internet Explorer, in an effort to gain market share. When that failed, Microsoft bought Intuit outright. The FTC stepped in and axed the deal.

The thanks Microsoft has given the world for making it the world’s largest software company has been to sell buggy software and do everything it could to force companies and individuals to buy upgrades every couple of years, even when existing software is adequate for the task. While hardware manufacturers scrape for tiny margins, Microsoft enjoys 85% profit margins on its product. But Microsoft mostly sits on its cash, or uses it to buy companies or products since it has a terrible track record of coming up with ideas on its own. The company has never paid dividends, so it’s not even all that much of a friend to its own investors.

For me, the question isn’t why I dislike Microsoft. The question for me is why Microsoft has any friends left.

News flash: Windows is cheaper than Linux!

Lots of people asked me today what I thought about the IDC study that says Windows is cheaper than Linux. I yawned.
Consider the source. Microsoft paid for the thing. You think IDC was going to come back and say Linux is cheaper all around if Microsoft was paying the bill?

Yes, sometimes it’s cheaper. If all your sysadmins know NT and don’t know Unix well, then yes, Windows is going to be cheaper.

But I can think of some times when it’s not. Like if downtime means anything to you at all. My clients scream when I have to reboot an NT server. But I can count on having to reboot a busy NT server once a year due to a lockup or general server stupidity. And virtually every security update is going to require a reboot. I can slipstream a Linux security update almost every time without a reboot–unless it’s a patch to the kernel, which is rare. With the right distribution, I can even upgrade distributions without a reboot. Try that when going from Windows NT or 2000 to something else.

I saw a story on DebianPlanet today about someone bragging he’d done a server migration in 3 hours. You’ll never do that with Windows. But you can do a migration even faster than that–copy everything over somehow to the new server, either through a tape backup or disk cloning, then adjust /etc/fstab as necessary, plop down a generic kernel straight from a distribution, configure the NIC if it’s not a close relative of the old one, and reboot. If you want to get fancy, compile a custom kernel tuned to the new server’s hardware. You can do it all in an hour. We dread the day any of our Windows servers is destroyed by some kind of accident and we can’t find an identical replacement. It’ll take us a minimum of 5 hours to install and update the OS and re-install whatever apps are on it and re-create whatever shares are on it, because that’s how long it takes us to set up a new one out of the box.

And maybe you’ve got picky clients like some of mine. One of them decided out of the blue that they didn’t like how their network shares were named. Never mind that everyone just calls it “the O drive.” Yes, they’re anal-retentive morons, but the client is always right. So one of my coworkers spent a thrilling Saturday un-sharing folders and re-sharing them with new names. On a Samba server, you can just load a text file, change some names, and restart the daemon. Done. The job that took 6 hours and was full of potential for human error is reduced to a few minutes. There’s still potential for human error, but it’s much less because the job isn’t as tedious and boring. And it’s much quicker to fix.

And don’t even get me started on tracking server licenses and CALs. Many organizations, when faced with a Microsoft audit, find it cheaper to just re-buy all of them than to spend the time tracking down the documentation that proves they’re honest. With Linux and open source, there’s no danger of having to pay for something twice, not counting the upgrades. (Those are free too, if you want them.)