Windows ‘Hives’–Beware of Stings

Picture this scenario:   a typical family on a Friday evening, Dad relaxing before tackling those term papers for college classes, oldest son on the computer, Mom finishing up in the kitchen, the toddlers fussily wearing down into that cranky, tired but not yet bedtime limbo.  Then…

“Mom, there’s something wrong with the computer.”   Mom picks up the youngest and looks over Junior’s shoulder.  There’s browser windows all over the screen.  Nothing is happening.  Junior clicks on the corner of one.  Nothing.  It’s frozen.

“Just shut it off,” she says.  He clicks on the Start icon.  Nothing.  So, she reaches down and unplugs the computer.  She plugs it back in, and it boots up. To a blank desktop.  The on-line tickets she purchased a few days ago, Dad’s college term papers, all the familiar icons, gone…  This is not good.

She calls her aunt, who is always on the computer.  She’ll know what to do.  “Ah, that sounds bad,” says her aunt.  ” Maybe you should call your grandfather.  He’s a real computer expert.”   Now, you don’t hear that very often: usually it’s the grandkids helping grandma with her email.  But, she does, anyway.  Call her grandfather, that is.

The phone rings, and I pick up.  It takes a bit to connect the dots, because she’s in a panic, and I have to switch from my business voice to my “papa” voice.  The kids and grandkids hardly ever call–mostly we email and exchange pictures on Facebook, that sort of thing.  After a few niceties, she relates this tale of woe.  The “user-friendly” computer has turned nasty.

Like a lot of Unix users and system administrators, I dread these calls. Oh, don’t get me wrong, I love hearing from kids and grandkids, but I don’t do Windows.  Our relatives know we speak in binary to our computers, and will just gesture hypnotically at the recalcitrant machine and it will suddenly behave.  Clarke’s Law at work, I suppose–“Any technology sufficiently different from your own is indistinguishable from magic.”  And computers are just, well, computers, aren’t they?  Windows is the computer as far as they know.

After I get her calmed down a bit, I explain I really don’t do Windows, but I’ll think about it, meanwhile remotely booting up a copy of Windows XP in a virtual machine on a server somewhere else in Chaos Central, so I can remember what Windows looks like and where things are.  The usual and customary assumption when someone’s computer “goes south” is that it has picked up a virus or has gotten so loaded with spyware it can’t function anymore.  But this doesn’t sound like the issue.

The computer seems to be running normally.  I think about having her boot up in Safe mode, but the F8 key is marked “Terra Incognita” on her mental map of the keyboard, and you have to be fast.  She relates an error message that flashes on the screen, to the effect something can’t be loaded, whatever.  Aha, I think, this sounds more like it.  I ask her to open the “My Computer” icon, open the “Hard Drive C:” and burrow down into the Documents and Settings and look through the Desktop folders in each user.  Like a lot of Windows families, the concept of separate user spaces is lost on them: it’s just “the computer” and everyone uses it just the way it is, is defaults to the “Owner” account.

The panic strain in her voice disappears and turns to joy–she’s found the files.  They’re all there.  I’m not sure I can explain more over the phone, so we talk a bit about how her husband’s schooling is going–he’s got one more semester to finish his degree at long last and fulfill his dream of becoming a teacher.  The great-grandkids are growing, too.  the oldest girl is going to be three.  The baby is whining for attention and obviously walking, I can hear her in the background.   We’ll be down to visit before they go on the vacation she thought she lost the tickets for…

Later, I send her the “official” solution from the Microsoft Knowledge Base, so she can clean up the mess if she can wade through the arcane kludge.  Otherwise, it may just have to wait a couple months until we visit, though that’s the other pet peeve of Unix admins everywhere.  We didn’t go on vacation to visit your Windows computer, we came to see you.  And, we have our own Linux computer in the car, thanks.

And, the winning answer, from Microsoft?  The gist of it is, when this happens: create a new user account and copy all the files from the old account into it.

What?  You’re saying it actually can’t be fixed?

Yup, that’s right.  You have to start over.  But your files are still there…

So, how does this happen, that the biggest computer software company on the planet has a feature built into the very fabric of their system, one that controls the user’s view of the system, that every so often just crashes and can’t be fixed?

Well, boys and girls, once upon a time, the designers of what came to be known as Windows New Technology, or Windows NT, desiring to enter the world of corporate computing and take on the “big iron” contenders like IBM, DEC, and all the Unix vendors, built a system configuration structure in which to keep all the important information about the installed software, current state of the system.  The structure was a convoluted, distributed set of databases.  Although the organization of it was tree-like, they didn’t want it to be confused with the also-tree-like file system, so they invented a new term.  The named this structure The Registry (with capitals so we would know it was important), and called it a “hive.”  Apparently the diagrams used by the designers to describe it to the programmers looked like beehives, so the name stuck.

It is probably appropriate, then, that, when you mess with the hive, you get stung.  Now, most Windows users are blissfully unaware of the Registry and its hive-like structure, but it is there.  It turns out that one of the components of this hive is a database for each user account, a file called NTUSER.DAT (Windows has never gotten over its humble origins in MS-DOS, and still uses all-caps, 8-character plus three-character file extension names for really important files) and its associated log file.  It’s right there, in your home folder, when you logon, but you don’t see it, because it is “hidden” from the directory view.  Besides, it’s a system file, so you can’t mess with it anyway, at least not on purpose.

What users also don’t know is that the Registry, of which their very own personal NTUSER.DAT file is part, has a finite size, defaulted to some fairly low value, deemed to be sufficient until the next upgrade of Windows, or your next computer purchase, both of which happen on average every two or three years, in the minds of the marketeers, anyway.  There’s a couple things wrong with that.  Most home users keep their computers until the machine dies a natural death, which is anywhere from five to eight years, and keep the original software, and then you have those predictable delays when it takes Microsoft five years to come out with an unusable replacement that nobody is willing to replace their computer to get.

So, over that long period of time, a time bomb is slowly ticking inside the machine.  As you use your machine, that NTUSER.DAT file grows.  And grows.  When you drop things on your desktop, it gets bigger. When you move them somewhere else, or delete them, it gets bigger.  There is no way to shrink it.  Now, if you really, really know what you are doing, you can give the Registry more space, but your computer’s performance will suffer, so that’s not a satisfactory solution either (one of the signs that your NTUSER.DAT file is getting too big is that your computer is getting slower and slower).  Eventually, the sum total of the Registry files reaches the magic limit, and you can’t write any more data into it.  Usually, this happens in the middle of some transaction, which just stops, leaving the file in an ambiguous state, which means, in plain English, it is broken.  When you logon, Windows complains, and then your desktop is blank.  Game over.

In the Windows game,  you don’t get a new life, you have to get a new character, so to speak.  This is just so wrong on so many levels I don’t know where to start.  The Windows configuration is so complex that even highly experienced, certified Windows administrators and engineers have trouble dealing with it.   Some parts of The Registry can be edited, with special tools, but there are no checks and balances, so it is really easy to turn your computer into an expensive doorstop with one errant keystroke.  Oh, you do have one chance to recover, by using Safe Mode (which, as we explained earlier, is difficult or incomprehensible for the average user to do), but don’t count on it.  Windows administrators have this secret mantra they chant when users are not listening:  “Reboot often, and, when in doubt, reinstall.”  Well, most users don’t back up their files regularly, so reinstalling is just like getting a new computer, minus all your music, photos, games, term papers due next week, and financial records.

So, when us crusty old Unix curmudgeons say, “I don’t do Windows,” we mean it.  We know it wasn’t your fault that your computer came with this abomination installed on it, so we sometimes take pity on you.  But, we believe that Windows is broken “out of the box,” and the only way to fix the computer is to replace Windows with something else.  If we get our hands on your broken Windows installation, don’t be surprised if it has Linux on it instead when you get it back.