Archive for the ‘mac’ Category

A hard drive crash with a happy ending

Monday, November 26th, 2007

Bad Drive
Yesterday afternoon, I returned to my desk to find my Mac frozen. When I rebooted, the hard drive started making horrible noises, so there was no question that my 200GB Hitachi drive had crapped out. Fortunately, Time Machine had my back, and the good news is that I dusted off the 250GB HM250JI Samsung drive I had written off a while back. I had installed it in my MacBook, but it was slow to the point of being unusable. And as it turns out, this was a bug. I wouldn’t have known this if my hard drive hadn’t crashed, because I’d been using the 250GB drive in an external enclosure, where it behaved fine, if a little slow. Well, one firmware update later, and this drive is zipping along. It’s not a blazing speed demon, but it’s in the sweet spot for performance/capacity that I had hoped for when I bought it!

What’s in the Mac OS X version of Silverlight 1.1 Alpha?

Tuesday, May 1st, 2007

I downloaded Silverlight 1.1 Alpha and poked around until I found out where the .NET stuff lives. Here’s what’s in the bundle:

$ cd /Library/Internet\ Plug-Ins/Silverlight.plugin/Contents/MacOS/
$ ls
  CoreCLR.bundle                          System.Core.dll
  IronPython.Modules.dll                  System.SilverLight.dll
  IronPython.dll                          System.Xml.Core.dll
  Microsoft.JScript.Compiler.dll          System.dll
  Microsoft.JScript.Runtime.dll           agclr.dll
  Microsoft.Scripting.SilverLight.dll     agcore
  Microsoft.Scripting.Vestigial.dll       slr.dll
  Microsoft.Scripting.dll                 slr.dll.managed_manifest
  Microsoft.VisualBasic.dll

And check out what those DLLs are made of:

$ file System.dll
  System.dll: MS Windows PE 32-bit Intel 80386 console DLL

But what’s this thing? Man, that’s big!

$ file agcore
  agcore: Mach-O universal binary with 2 architectures
  agcore (for architecture i386): Mach-O bundle i386
  agcore (for architecture ppc):  Mach-O bundle ppc
$ ls -l agcore
  -rwxr-xr-x   1 502  admin  16083600 Apr 26 03:16 agcore

So how much of those DLLs are managed code? Do they contain Win32 code, and does agcore have some magic in it for bootstrapping Win32 code?

Note to Future Self: Causes are Never Obvious

Friday, March 30th, 2007

I installed Vista under Boot Camp today, and my Mac wouldn’t boot into Mac OS X afterwards. It was sitting there on the blue screen with the mouse cursor. Of course I blamed it on boot camp at first. I plugged it into Ethernet (wasn’t getting an Airport connection at this point) and ssh’d into it from another machine. Turns out it was hanging on this umount /Volumes/Foo that I had stuck into rc.local a long time ago. I have no idea why installing Vista would trigger that behavior, but it’s gone from that file now and boots up fine. Who do I talk to about getting that hour of my life back? :-)

Remove Boot Camp Partitions from a Three Partition Setup

Tuesday, January 2nd, 2007

A while back, I split my MacBook Pro hard drive into three partitions so I could have a small FAT32 partition for sharing files between Windows and Mac OS X. After getting a dedicated Vista system, I wanted to delete the extra partitions I created and get all my disk space back. The only problem is that Boot Camp refuses to work on a disk that is partitioned this way, and the command-line tools are complex. I finally got up enough courage to give them a whirl.

This stuff is tricky, and I expected there was a very good chance I’d make a mistake that would force me to restore from backups. If you decide to give this a try, be careful.

I used SuperDuper to clone my Mac hard drive (in case I screwed up big time) onto an external disk drive, booted into the cloned operating system (your Mac OS X install disc should work too), and got a list of gpt partitions:

$ sudo gpt show rdisk0
gpt show: /dev/rdisk0: Suspicious MBR at sector 0
    start      size index  contents
        0         1        MBR
        1         1        Pri GPT header
        2        32        Pri GPT table
       34         6
       40    409600     1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
   409640 142270944     2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
142680584    262144
142942728  10485760     3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
153428488  41680896     4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
195109384    262151
195371535        32        Sec GPT table
195371567         1        Sec GPT header

To delete the 5GB and 20GB partition, I used this command:

$ sudo gpt remove -i 4 rdisk0
gpt remove: /dev/rdisk0: Suspicious MBR at sector 0
gpt remove: /dev/rdisk0: 1 partition(s) removed

$ sudo gpt remove -i 3 rdisk0
gpt remove: /dev/rdisk0: Suspicious MBR at sector 0
gpt remove: /dev/rdisk0: 1 partition(s) removed

Using the original output of gpt, I calculated the disk space I had to work with (10485760+41680896)/2=26083328K and restored my original bootcamp config:

$ sudo diskutil resizeVolume disk0s2 72842723328B \
  "MS-DOS FAT32" Windows 26083328K
Started resizing on disk disk0s2 Macintosh HD
Verifying
Resizing Volume
Adjusting Partitions
Formatting new partitions
Formatting Disk
100% ..
Finished resizing on disk disk0

Then I rebooted from my internal hard drive, used Boot Camp Assistant to restore the Mac to a single partition, and it reclaimed all that disk space.

Connecting to Samba from Vista RC1

Thursday, September 21st, 2006

One of the things that is annoying me about Vista is that I can’t
connect to my SMB shares on my Mac. When I try to log in, it rejects my
password. I looked at /var/log/samba/log.smbd on my Mac, and here’s
what I saw:

[2006/09/21 13:55:45, 1] auth_ods.c:opendirectory_ntlmv2_auth_user(312)
  User "bjepson" failed to authenticate with
"dsAuthMethodStandard:dsAuthNodeNTLMv2" (-14090)  :( 

So I poked around the Group Policy Edit (type gpedit.msc into the
search or address box and press enter). I drilled down into:

Local Computer Policy
  -> Computer Configuration
    -> Windows Settings
      -> Security Settings
        -> Local Policies
          -> Security Options

and I changed “Network security: LAN Manager authentication level” to
“Send LM & NTLM - use NTLMv2 session security if negotiated” and it
seems to work.

Vista Pre-RC1 on MacBook

Wednesday, August 30th, 2006

There’s been a lot of buzz about the Pre-RC1 build of Vista working with Boot Camp. I decided to give it a try, and it was pretty easy. You’ll want to perform a full backup before you try this!!!

  1. First, run the BootCamp Assistant and delete your Windows installation. This will wipe out all your data, but will restore your Mac to a single partition. You only need to do this if you want to perform the next step.
  2. I’m pretty sure Vista won’t run on a FAT32 file system, so you need some way to exchange files between Mac OS X and Windows. I think the best way to do this is to create a third partition. This post (read it all) has lots of details on this. On my MacBook with a 100GB drive, I used this command to shrink my Mac partition and create a 5GB partition for shared data and a 20GB partition for Vista:
    sudo diskutil resizeVolume disk0s2 72842723328B \
    "MS-DOS FAT32" Data 5368709120B  \
    "MS-DOS FAT32" Windows 21474836480B
    
  3. Next, I rebooted, opened a Terminal, and ran this command to create a FAT32 file system on the Data partition (please check the output of diskutil list /dev/disk0 to be sure you are operating on the right partition first or you may wipe out important data!!!):
    sudo newfs_msdos /dev/disk0s3
    
  4. Once I finished these steps, I inserted the Vista DVD, and rebooted the Mac. I held down the Option key as it was starting, and selected the Vista DVD as the boot media.
  5. I went through the Vista installer as normal, and all was fine. The only oddity was that when it rebooted, it went into Mac OS X. I opened up System Preferences/Startup Disk and told it to boot from the new Windows partition.
  6. I rebooted and setup continued as normal.

One drawback of this is that Bootcamp Assistant won’t run if you have these three partitions, which make it hard for you to burn new driver CDs. However, you should be able to Control-Click on the BootCamp Assistant app, choose Show Package Contents, and find the driver disk .img file that way. I’m sure there will be other annoyances involved with using a non-standard configuration, so I’m prepared to have to delete these partitions and start anew at least a few more times…

Exposé, SmackBook Pro style

Thursday, May 25th, 2006

Erling Ellingsen has written an awesome toolset for smacking your Mac to switch desktops. Here’s a modified version for those of us who are using Exposé instead of virtual desktops. You can smack the MacBook Pro to trigger Exposé. Because all I’m doing is firing up Exposé, you only need this script and Amit Singh’s AMSTracker.

Update: A slightly simpler version is available here. The only difference is that it lets you put AMSTracker and smaxpose.command in the same directory rather than having to put AMSTracker in your PATH.

Note that if you are using something other than F9 for Expose, you’ll need to change the key code from 101 to whatever works.

Fedora Core 5 on Virtual PC 7 for Macintosh

Thursday, April 13th, 2006

I posted an entry a while back about getting this to work under an earlier beta of Fedora Core 5. I think these instructions are much more straightforward. You’ll need to go through the installation. I suggest using text mode if you can (I specified “text expert” when I was installing).

When installation is finished, and you are prompted to reboot, use Alt-F2 to switch to a virtual console (Ctrl-Alt-F2 if you are in X11). Then, mount the install media:

# cd /tmp
# mknod hdc b 22 0
# mkdir /mnt/cdrom
# mount /tmp/hdc /mnt/cdrom

Copy the i586 kernel over to root’s home directory on the new system:

# cp /mnt/cdrom/Fedora/RPMS/kernel-*i586* /mnt/sysimage/root

Unmount and eject the install media and chroot into the new system:

# umount /mnt/cdrom/
# eject /tmp/hdc
# chroot /mnt/sysimage/

Install the kernel and exit the chroot:

chroot# cd root/
chroot# rpm --force -Uvh kernel-*i586.rpm
chroot# exit

Use Alt-F1 (or Alt-F7 if you were in X11) to return to the installer, and
reboot as prompted.

Encrypted Disk Images? Never Mind.

Tuesday, February 21st, 2006

jwz asks: “FileVault: good idea, or performance killer?” I’m not ready to turn my whole home directory over to FileVault, but I love using TrueCrypt on my Windows machines, so I figured I’d try putting some of my files on an encrypted sparse disk image.

It worked great, but then I left it mounted while I was trying to copy some files between FireWire drives, and my machine locked hard (it turns out I needed a firmware update for my Oxford 922-powered FireWire 800 drive).

Well, when I rebooted and tried to mount my disk image, I got “Disk image failed to mount/Corrupt image,” so I’m tossing this experiment down the drain (FWIW, I’ve put TrueCrypt through plenty of crashes, and it never has a problem). I’m glad I use Unison to keep my Mac in sync with several other computers at home, because restoring the files was quick and painless.

MacBook Pro or Last Year’s Model?

Thursday, January 26th, 2006

Derrick has a great post that sums up my feelings about whether it’s time to buy a new Mac notebook: buy what you need when it’s available. I’ve been growing unhappy with my 12″ PowerBook, which is still pretty new, actually (99 days left on its 1-year warranty). Unlike Derrick, it’s not disk space, memory, or graphics speed that are troubling me. I’m mostly bothered by the limited resolution on my Mac. I keep my PowerBook plugged into a 20″ LCD panel most of the time.

So, a 15″ Mac is pretty tempting. After I read Derrick’s post, I wondered whether it might be a great time to buy a 15″ G4. After all, the latest model will pretty much be, by definition, the best 15″ G4 PowerBook ever made. And refurbs of those models are starting to appear on the Apple Store: 1.67GHz, 1440×960 resolution, $1,699.

I can’t say for sure, but I suspect that a refurb might be less likely to suffer from the latest PowerBook defect. After all, a refurb has left the factory twice (sort of).