Jeff Duntemann's Contrapositive Diary Rotating Header Image

linux

An Embarrassment of Riches

I’m hard at the rewrite of my assembly book, and in going over the chapters closely I realize that I have a lot to do, significantly more than I thought going in. Parts of this book date back to 1988, and the work as a whole was not organized back then the way I would organize it today. So I’m doing more to it than I thought I would, and although that will make for a better book, it’s also eating more of my time. (Expect a few fewer Contra posts over coming months, and perhaps shorter ones.)

I’ve also been using Ubuntu a lot more than I ordinarily do, since the rewrite finally exiles DOS from the discussion except as a historical footnote. I find myself surfacing for a breath now and then, and realizing, I haven’t been in Windows for almost six hours! Crossover Linux has made this possible, since I have Office 2000 and Visio 2000 installed under Ubuntu now, and don’t have to be bouncing between two machines or two partitions to write code and then write about the code.

In the process, I’ve been using Ubuntu more and at more depth than I ever have before. One thing I’m beginning to appreciate is just how easy it is to get software and keep it current, and just how good the software that’s out there really is. That’s changed in ten years. Back in 1999, in order to run NASM under Red Hat I had to download a tar file full of source, unzip it somewhere, and then recompile the whole damned thing. I had no intention of changing the assembler and would have been more than happy with binaries.

It’s different now. With Ubuntu (and I assume most modern distros) you go up to a software repository through a package manager utility, cruise an enormous list of free packages that are available, and check off the stuff you want. Then you click Apply and stand back: The package manager downloads the package and anything that the package depends on, checking first to see if you’ve got any of the prerequisites installed already. Only the stuff you need comes down, and when the smoke clears you have new apps on your app menu, or new libraries tucked in where they’re supposed to go. (Or both.) Wow.

Ubuntu periodically checks to see if updates are available for anything you have installed, and a couple of clicks brings them down and installs them.

I’m sure that not everything that exists is up there, but what’s up there is extremely impressive. If I allowed myself to get distracted, I’d be playing with Gambas and Boa Constructor rather than writing. The Nemiver debugger front end didn’t exist ten years ago, and it will star in the new edition of Assembly Language Step By Step. Most of all, I want to play with Lazarus (the GUI IDE for Free Pascal) and have to slap my hands periodically, or I’d get nothing else done.

The primary barrier to the adoption of the Linux Desktop is unlearning old habits, followed as a distant second by conversion of existing Windows-centric files. There may have been a third barrier somewhere, but I’ve forgotten what it was. There is certainly no shortage of software to get the jobs done.

Ncurses! Firehosed Again!

I’ve mentioned here that I’ve got a contract and have begun work on the third edition of my book Assembly Language Step By Step. The second edition was written almost exactly ten years ago, and I had mostly given up on the book as obsolete and out of print forever. My publisher most sensibly wants me to get rid of all the DOS material and rewrite the book entirely for Linux in general, and Ubuntu Linux for the sake of the screen shots. The second edition did address Linux assembly with NASM, but almost as an afterthought, having first taught the concepts of assembly using DOS as a tutorial platform.

So I got to work. And as I soon discovered, whew! A lot of things have changed in the last ten years. Ubuntu didn’t exist, and the notion of not having root at all would have been thought absurd in most Linux geek circles. But so it is, and I’ve had to become intimately familiar with sudo in all its forms and wrappers. Ten years ago, I just worked in root and was careful–if you were going to work in assembly, there was really no other way.

KDE was brand-new in 1999, and GNOME wasn’t even in general release. I worked in the console and mostly hated it, and when the book was done, I mostly forgot it. That’s easy enough to do across ten very busy years, and the console does not help you remember anything. One way to look at a GUI is as graphical short-term memory reminding you what options exist and what their parameters are, just in case you don’t use a command often enough for it to rise above the brain sludge in your head. Essentially all of the work I’ve done in Linux in the ensuing ten years has been in the GUI desktops, and it’s all been user stuff, largely to get a sense for how readily Linux (Ubuntu especially) might replace Windows. On the programming side I’ve played mostly with Gambas and Lazarus, which correspond (roughly) to VB and Delphi.

Faced with a console again, I remembered about four commands: ls, cd, pwd, and cat. I remembered that ./ specifies the working directory. I knew that there was a way to add the working directory to the search path, but I had to look it up. Fainter still were memories of console control codes: ESC [2J…or was it ESC [1J…or ESC [1H? More looking up. More printing of Web pages, more sitting in my big chair, drinking from an increasingly familiar firehose. Eight years or so ago, I got ncurses installed on the Xeon under Red Hat and figured out how to call it from NASM. Alas, I cannot find any least traces of my playing-around code, and so I have to learn it all over again, and re-create the nascent example programs I had written against the possibility that I might revise the book someday. Someday didn’t come until I was certain that it never would. Then…wham!

Someday is here.

I’m not adding material to the end of the book, except a chapter section on how to call ncurses. The first three chapters won’t change much either. (Foobidity!) Mostly I’m rewriting the initial steps in actual coding, and the distressing thing is that my elaborate memory-mapped text output library, which taught so much of basic assembly so well, simply won’t work in protected mode. So I need to look at what will demonstrate the same principles and not talk to video memory. A CPUID utility suggests itself, so I’ve connected the CPUID instruction to the firehose.

And I’m writing C code again. God help us, I feel like I want to wash my hands every fifteen lines–but that’s just the nature of the job. Like I’ve said many times, when you work outside your preferences you broaden your horizons. This doesn’t mean you shouldn’t bring soap. (At least I’ve got the firehose…)

Kubuntu on Painkillers

A quick update on my mouth rehab, though it borders on TMI: About two weeks ago I had 30 new crowns installed, after fussing with a mouthful of temps for most of a month, one of which had a bad habit of coming loose while I was doing something innocuous, like chewing a chicken leg. That operation was not bad, though my gums got a little beat up from the sterilizing agent and dental pick work to remove excess adhesive. So now I have 30 brilliant white porcelain crowns, and if all you look at are my teeth, well, I look like a TV anchorman.

But that leaves two to go. One of them was so badly damaged by six years under my previous horseshoe of connected crowns that it had to come out. The other is a healthy tooth but needed crown lengthening and a post in the middle of it, because it had gotten whittled down so far in 2001. Alas, a post requires a root canal, because the post has to go somewhere. Yesterday I went back and had the lower molar pulled, and crown lengthening (warning: NSFS) done on its opposing number in my upper jaw. That involved some bone scraping, which was one of the ugliest sounds I've ever heard, given that I could feel it in my…bones.

Everything becomes quiet for about six months now. My empty socket has to heal and fill in with bone, after which the surgeon will install an implant post to hold a porcelain molar. At about the same time, I'll have a root canal done on the upper and a post installed in the middle of that tooth to hold the opposing porcelain molar. And then—egad, I hope!—the whole thing will be finished.

On the other hand, I thought I was finished in 2001. Silly boy.

So I'm back on painkillers, though I don't need as many this time as when I had my gums reworked along the entire perimeter of my lower jaw back in January. And last night I did an interesting experiment: I installed Hardy Heron not once but twice, all while in a codeine fog.

Results: It went flawlessly. Linux has clearly arrived. A week or so back I downloaded and burned the ISOs for both Ubuntu and Kubuntu 8.04, the Kubuntu distro with KDE 4. I like KDE more than Gnome, because it reminds me more of Windows, and I've been looking forward to seeing V4 for several months. Both Ubuntu and Kubuntu installed without incident, each in its own 30 GB partition on my lab SX270 3.2 GHz box. I did not have the display glitches I had back in October, (even though the hardware has not changed at all) and both distros saw my network immediately.

I installed a bunch of things with the Adept installer, including some games, Boa Constructor (a vaguely Delphi-ish RAD environment for Python) and some office apps. No problems there, and Boa Constructor is worth a little experimenting and some description as time allows. My only complaint so far is a minor one: GRUB is ugly, and needlessly so. Suse and Fedora (I think) already have a graphical GRUB OS selection screen. Given the importance Ubuntu places on nontechnical users, I think it would be worthwhile to budget a little work for creating one and including it in the default distros.

The reasons are not entirely esthetic. Nontechnical people almost never see text screens anymore (except for a vanishingly quick appearance while BIOS POST does its thing) and when they do, it almost always means that something is wrong. Leaving a general good impression of desktop Linux is vital right now, as from what I can see, the OS itself is ready.

A quick skim of the Ubuntu forums online indicates that it's possible to install a graphical GRUB display in Ubuntu, and I'm going to give it a shot today or tomorrow, when the codeine is no longer necessary and I can run my brain on all cylinders. In the meantime, if any of you have any experiences (good or bad) with graphical GRUB displays, I'd appreciate hearing them.

Odd Lots

  • Bob Halloran wrote to remind me that dual-booting Windows and Linux on a single hard drive is easy—but you have to install Windows first. When you install Linux it will see the Windows partition and configure grub so that grub will allow you to choose either OS when the hard drive's MBR gets control. If you install Linux and then Windows, Windows will overwrite the MBR with its own stuff, and grub will be gone. I'm going to try this with a couple of Linux installs alongside Windows (I want both Ubuntu and Kubuntu on that drive, at minimum) and will report back here in detail as to how it goes.
  • From Engadget comes a report of a prototype ebook reader (including handwriting recognition) shown without any explanation at the recent CES. This looks damned good to me, and is worth watching, at least in part because it's not tiny. I do not want a tiny ebook reader. I want something that shows an 8 1/2″ X 11″ page full-size. The dimensions on this gizmo are unclear, but it's sure as hell bigger than a cell phone. I'll trade a keyboard for a stylus, but I want the display to be at least letter-sized. (And I want a photovoltaic panel on the back to charge it when I'm not using it!)
  • There's nothing whatsoever preventing a piece of software from rendering a PDF ebook as reflowable text, and we're starting to get hints that Adobe may provide that ability, at least for the Sony Reader. This will allow people with big displays to read an ebook as pages, and people going crosseyed on small displays to read an ebook five words at a time. It should be the reader's choice, and I'm annoyed that that ability was not there from the beginning of PDF time.
  • Finally, I'm going in for serious gum surgery tomorrow morning, and I do not plan to be fully present intellectually for a couple of days. Do not look for a Contra entry before Thursday, but if you see one, it means I'm in better shape than I expected to be.

Booting Kubuntu from a Removable Drive

Pete and I discovered something interesting recently, almost by accident. Ok, it was almost entirely by accident. But it's useful nonetheless: We figured out how to install and boot Kubuntu on a removable hard drive after Kubuntu's installer failed to see the removable drive.

I've written about Dell's SX260/270 small form factor desktop here a number of times. It's a tiny little micro-tower made from laptop parts, especially Dell's Inspiron line. Its single most useful feature is its “media bay,” a front-panel slot that accepts several different kind of removable drives, including floppies, Zip 100s and 250s, CD and DVD drives of all stripes, and hard drives in appropriate cartridges. These cartridges are available empty, and Pete and I each bought such a cartridge plus an 80 GB notebook drive to install in it. The idea was to install Kubuntu on the cartridge drive, and then figure out how to dual-boot between Windows on the main hard drive and Kubuntu in the cartridge drive.

Except that I couldn't get Kubuntu's installer to see the cartridge drive, and thus couldn't do the install. Oh, well. We were interested enough in configuring Kubuntu and experimenting with some OSS titles accessible by KDE package manager Adept to pull the main Windows hard drive out of my SX270 lab machine and drop the new, empty hard drive into the main internal drive slot in its place. From there it was a typical and easy Kubuntu install, and we spent an afternoon trying things out. (Adept is a marvelous thing!) The next day I wanted to use my scanner downstairs, but the scanner software was installed under Windows, and HP infamously does not provide Linux drivers for its products. So I pulled the Kubuntu drive out of the SX270 and put the Windows drive back in. On a whim I installed the Kubuntu drive in my empty media bay cartridge and plugged the cartridge in to the machine's media bay to see what the boot process would do. I restarted the SX270, and wham! Kubuntu booted.

It's obvious in hindsight: The BIOS lists the CD drive ahead of the internal hard drive in boot order, and the CD drive lives in the media bay. In fact, anything with a master boot record plugged into the media bay will boot (or try to boot) before the internal hard drive.

There is a downside to using Kubuntu from the SX260/270 media bay: There's only one media bay, so with the Kubuntu hard drive cartridge plugged in, there's nowhere to put my media bay optical drives. (I could buy a USB optical drive, but that's yet another piece of hardware to keep track of.) The real solution is to figure out how to make grub dual-boot Windows and Kubuntu from separate partitions on the 120 GB internal hard drive. Remarkably, O'Reilly does not have a book on grub, even though they have whole books on numerous deep-geek software packages with user bases (barely) in double digits. (There are millions of grub installs. Maybe tens of millions.) So I've been reading the scraps posted here and there online and will figure it out eventually.

I guess I should have known that anything in the media bay would boot before the main hard drive. I freely admit that I didn't. Sometimes, well, you just get lucky.