Wednesday, November 07, 2007

The Adventures of Leopard: Upgrading 3 machines to 10.5

Well, I finally got the Leopard upgrade, and I was really excited! The system works great, and I'm really excited to be using leopard (I've missed my virtual desktops!). But the upgrade wasn't all candy and roses. Let me spin my tale of woe, heartbreak, anxiety, and final triumph.

The Powerbook G4
I first installed the upgrade on a Powerbook G4 because I was impatient. This old machine has been my pride and joy for years, works like a horse, and takes a beating like an old Model T Ford. Well, at least it did before I updated. ^_^ My son has had this habit of finding something on a chair or bed, and pulling it off. The one time I forgot to leave the computer bag on the floor, he pulled it off the bed for me.

The fall must have done something to the drive, because when Leopard tried to upgrade, it couldn't read the drive. I no longer could read it in Target Disk Mode either. So, I ended up running a full install. Most everything was already backed up (except for the second draft of my book, but it was crap anyway), so I didn't lose anything important.

The install was clean, cleared out a lot of libraries of failed attempts by me to compile things, and I came up with the leopard setup wizard. It is an easier setup than Tiger, but only because it doesn't ask you as many questions.

The Mac Pro
The Mac Pro was a different situation all together. This is my work machine, and when I tried to install the update, the disk I had was bad. So I got just so far, and it died on me. No longer able to boot, but the files staying in tact, I tried another install disc from our IT guys. The install failed again, but why I don't know, and so I tried a third time. This time it finished, and started logging into the GUI. I was excited, until I saw the login window: no accounts. My entire NetInfo directory of two accounts was completely gone.

Not wanting to believe it, I booted up into the install DVD again, and tried to change the password. It let me, so I thought I could try booting again. No go, it still didn't have any users. Argh! I was afraid I would have to do a full install, and this time the IT guys took the disk back. So, I tried some things in the Command Line. After all, it's based on BSD, right?

Well, the only way to add a user that I could see was to add them in Open Directory. To do that, I needed access to the command dscl. I booted up into Single User Mode, and gave it a try. It wouldn't run without a particular library setting executed first. It even told me the command to run. So I did, and it still didn't work. Argh! What was going on? I was worried I would have to run a full install on the machine.

The next day, I checked online again, looking for anything that would give me some sort of access to the machine. Then I came across two articles, Here, explaining the issue I was experiencing, and here, outlining how to add a new user.

Now, I tried the first fix, but the original user was completely gone. My guess is that when it was importing the new account information from NetInfo (no longer used in Leopard) to the LDAP system in Open Directory, the system failed. The original NetInfo information was still there, but wasn't imported properly. So, I needed to create a new account.

Once the new account was created, it worked like a charm! Because I had to search for the fix for two days, here are the steps that I took, should anyone else need to perform the same fix:

1. Restart in Single User mode (hold Command-S during startup)
2. At the prompt, type: mount -uw /
3. Press Return
4. Type:
launchctl load /System/Library/LaunchDaemons/
Press Return
5. Create a new entry in the local (/) domain under the category /users.
dscl . -create /Users/[username]

6. Create and set the shell property to bash.
dscl . -create /Users/[username] UserShell /bin/bash

7. Create and set the user’s full name.
dscl . -create /Users/[username] RealName "Real Name"

8. Create and set the user’s ID.
dscl . -create /Users/[username] UniqueID 501 (default System Admin for Mac OS X)

9. Create and set the user’s group ID property.
dscl . -create /Users/[username] PrimaryGroupID 1000

10. Create and set the user home directory.
dscl . -create /Users/[username] NFSHomeDirectory /Users/[username]

11. Set the password.
dscl . -passwd /Users/[username] PASSWORD


passwd [username]

12. If you would like Dr. Harris to be able to perform administrative functions:
dscl . -append /Groups/admin GroupMembership [username]

This worked just fine for me. Hopefully it would be helpful to someone else, if nothing else then to find it easier. ^_^

The iMac
My wife's computer worked without a hitch, which was good because I didn't have time to back up everything, just the images. I was hurt, because her machine didn't have a problem. What's wrong with me? ^_^

Anyway, I hope this helps those of you upgrading to Leopard, and have trouble with missing accounts.


Anonymous said...

I ran into the similar need to change the passwd from single user command line. For some reason with Mac OS X Server 10.5 (leopard server) the launchctl load command did not work.

Jeremy Robb said...

Thanks for posting! I hope you gave the instructions above a try. It finally got launchctl to load, and allowed me into dscl.

Anonymous said...

I had a similar problem too where a leopard install would fail on me by not creating a user after setup completion. I've tried everything including re-running the wizard again by removing .AppleSetupDone in /var/db and tried running the dscl tool which wouldn't want to run in singleuser mode no matter what so I had to type >console win no password into the login box to run it in multiuser mode and then it failed because it couldn't find its root. But I needed access desperately so in one last desperate attempt I've set a password for the root user in single mode, booted into GUI and was able to login as root. No luck in creating a new user even via GUI. But that's okay since I got something running anyway. I suspect this was because the machine got a name with international characters and something went wrong during OD initialisatiom. That is only a guess though.

Anonymous said...

Dude, it looks like you've been hacked. All your "create" statements are reading "delete." Anybody reading this post take note. Using delete will delete a user.