Installing Windows 7 on an iMac 12,1 in 2022
I've had this iMac 12,1 sitting around for a few years unused. The iMac was released in 2011 with a Sandy Bridge i5, a big, beautiful monitor, 12 GB of RAM or so, and an integrated, laptop-grade Radeon 6750M graphics card. I thought it might make a good web browsing appliance but I didn't realistically see it getting much use in this household. At the same time, though, I don't play games released in the past decade. So maybe I can throw Windows 7 on it, have a stable Windows machine around for once, and have an actual gaming PC? I went for it.
Backing up the old hard drive
The old hard drive had a still working but slow spinning disk drive full of personal documents and photos from my family. I use s3ql and Google Cloud Storage for my cloud backups and wanted to do a complete backup of this drive. It was easy to get the iMac to boot off of a Debian live USB, install s3ql and its dependencies on that, and do rsync to backup the whole drive. However, if you read the patch notes, s3ql had some serious sounding data corruption bugs and I needed to fsck the backup volume and also run a special data verification tool related to the data corruption issue. Furthermore, that tool worked by fetching the entire GCS blob to just to verify its size. I am not positive why they couldn't just get the size from the GCS metadata but it may have been related to the on-the-fly compression they do to your blobs. At any rate my volume is huge and it'll take forever to download and validate all these blobs so I have to spin up a one-off VM in the cloud just to do this fsck stuff and it still costs me like $40+ and a few days of VM time to do the entire fsck. s3ql's been an OK tool but its maintainership has not been great and it's had a few of these unfortunate bugs, enough to give me pause and question whether I should be using it for backups. Stay tuned, maybe I'll have the time to write my replacement for cloud backup some day.
Replacing the hard drive
To make the machine usable I wanted to replace the old spinning disk with a modern but cheap SSD. I think the machine was originally disused because the disk was just so slow, making the machine a chore to use. I grabbed a $60 internal SSD from a big box store and went to work.
This is one of those all-in-one iMacs where they've got the entire PC behind the LCD. It looks stunning now and was revolutionary when it first came out. The front of the iMac is actually a big slab of glass/plastic held in place with strong magnets. So to start any sort of internal repair you have to start with popping this plastic off without snapping it. Online videos recommended using suction cups like you'd do with a piece of sheet glass but I was able to get it with fingernails, shims and some patience.
Once the front plastic is off you can start with unscrewing the LCD which is sitting on top of everything. And it only gets weirder from there: the LCD is attached with several tiny cords, and in order to get to the spare drive bay (they have space for a spinning disk drive and a modern SSD) you have to disassemble nearly everything, as the spare drive bay is buried underneath the CD drive and against the back of the case. So I didn't do that. Instead, after sweating bullets just getting the monitor off and disassembled, I decided to just put the SSD in the space of the main drive bay and just sort of let it dangle there because I don't have any sort of tray or insert. It'll work out OK.
This machine is a work of art, inside and out. Apple really is the master of hardware design. But damn, this was one of the trickiest things I've had to do with electronics and it had me on edge the whole time. I wouldn't fault anyone for getting a third party to do this sort of maintenance for them.
Installing Windows 7 from a flash drive
Everything is put back together and it's time to install Windows. I have an ISO, I can just clone it to the flash drive with
dd and tell the Mac to boot from it, right? That worked just fine with a Debian ISO on this exact same machine. Unfortunately Microsoft wasn't as thorough with their installer design as Debian is and the Mac wouldn't boot it. At this point, things start getting ugly:
- I grab one of those free Windows VMs for testing Internet Explorer and use Rufus to create a NTFS-formatted Windows installer disk. Doesn't work.
- Apple's Boot Camp Assistant supports creating Rufus-esque boot USB drives with the correct partitioning and drivers to boot on a Mac. I do this on my daily driver Mac, running macOS 10.15, and it doesn't work, because Apple has dropped support for Windows 7.
- I create a High Sierra VM from scratch as that was the last release of MacOS X to support creating a Windows 7 boot USB drive. This does not work.
- Thinking it was something about the virtual machine USB passthrough or something I copy the Boot Camp Assistant out of the High Sierra VM and run it under Catalina to format the USB drive. This does not work.
- At this point I am desperate. I wasn't planning on putting MacOS on the new SSD, but while trying to boot all of these USB drives I notice that Apple's firmware has a "Network Recovery" option to download the MacOS X installer and boot without any operating system or installation CDs. I give that a shot, and it downloads the venerable MacOS X 10.7 Lion onto my SSD. That works fine.
- Lion ships with a Boot Camp Assistant that supports Windows 7! Hooray! However, it doesn't support creating USB installers. You have to feed it an installation DVD, it formats the disk to leave a Windows partition and puts Apple drivers on it, and then boots off of the DVD. Luckily the iMac 12,1 shipped with a DVD burner and I have a very old stack of blank DVDs somewhere so I start burning my ISO to disk.
- I have to burn two DVDs because they're old and rickety and a teeny bit scratched but eventually I get a good one. Boot Camp successfully partitions the disk and gets the Mac to boot into the Windows installer. Finally, we're making some progress!
- Windows can't figure out what Boot Camp was trying to do with Windows partitions so I have to tell it to wipe the partition Apple made for it and install Windows into an empty filesystem. So, no Apple drivers on first boot. The DVD is also slightly damaged, preventing me from installing Windows 7 Enterprise, so I have to settle for Windows 7 Ultimate. But that installs and works fine.
Installing Windows drivers for the iMac 12,1
After the last installer reboot I am greeted by the Windows 7 desktop but with absolutely no drivers - no network card, no WiFi, no video card, no sound, nothing. I am so close but still so far from a functioning machine.
Boot Camp provides a standalone download of ~500 MB worth of Windows drivers for 64-bit Windows 7. This includes Apple-proprietary drivers for parts of the hardware but also the third-party stuff like the graphics card and network cards. I kept those on a USB drive and figured it would be one quick install to get everything working, right? Well, Apple's installers really didn't like my machine, for whatever reason. The installers didn't think I was running Windows on an iMac and wouldn't even attempt to install any drivers. I figured it was some sort of chicken and egg thing: because the drivers left by Boot Camp before Windows was installed got wiped, there must be some key drivers that I missed out on that allow the other driver installers to recognize that this was a Mac. Either way, I now have to bootstrap this entire machine's drivers from scratch.
First, I load up the driver for the Ethernet card. I figure with just that one I can use Window's driver discovery and update functionality to fetch the rest of the drivers for my hardware. I forget where I got this driver - it may have been shipped with Windows, it may have been pulled out of the Boot Camp package above. Boot Camp ships a top-level installer that was giving me errors, but that installer calls several sub-installers to handle each driver. Many of those sub-installers were also giving errors but I believe the Ethernet driver ran fine when ran independently of everything else and brought the card up right away.
Now that I have internet access I kick off Windows Update to download the inevitable patches but also hoping to get all of the drivers I need. However, Windows Update simply doesn't work. My Windows 7 ISO had SP1 slipstreamed into it, and it dates from 2012-2013 so it may even have more updates included. But at some point either a certificate expired or SSL settings changed or something and Windows 7 can't even communicate with Windows Update to get the list of available updates. Some quick Googling turns out I need a special KB update to get around this hitch. But even then I am having trouble - the old Internet Explorer lacks the certs/SSL support to view the installer page on Microsoft's website! I install modern Chrome, which of course ships with modern SSL and certificates, and Chrome will display the download page for me. But there's something about the installer download itself it doesn't like - another cert error or malware detection or something - and it won't allow you to download the installer and gives me no opportunity to override it. So I wind up having to browse to the update's web page in Chrome, copy the URL for the installer off of there, and paste it into Internet Explorer which will gladly let me download the installer. The patch works and we're back at it - Windows Update is working.
Upon reboot I am greeted with 163 urgent updates. This was the start of 3-4 hours of downloading, patching, and rebooting. There's detours in there to install some more KB updates to get around further issues with deprecated/changing security code (something about SHA2 hashes of update packages?) and fully download and install every single update it wants. The SSD is a lifesaver here but I'm still stuck on the wonderfully CPU-bound and single-threaded Windows Update.
I had hoped to be greeted by a fully functioning PC with drivers after finishing all of the updates. But that was not the case - Windows was unable to find any of the drivers for whatever reason, even when instructed to do so manually. It is now on me to find the rest of the drivers and bring them all up.
Drivers, part two
Although the Boot Camp driver installer isn't working I find a sub-installer at
BootCamp\Drivers\Apple\BootCamp.msi. I believe I have to run this one from the command line to get around hardware checks. it installs most of Apple's Boot Camp drivers, especially the one-off ones provided by Apple directly, but I'm still left without a graphics card driver and WiFi driver, which are actually the only two I need to use this for gaming. Darn.
AMD still distributes old Radeon drivers for all of its graphics cards. I download a few versions but none of them are letting me install - they don't think I have a Radeon! This is troubling. Ultimately, I go to a somewhat-sketchy bootcampdrivers.com and get their patched driver which installs smoothly and brings up a working graphics card. I'm OK with leaving theirs installed as that driver is probably as modern as I'll get.
There's a Broadcom WiFi driver in the Boot Camp driver package and I am able to install it. However, it can't enable the WiFi chip once installed. I try using the generic Broadcom driver that ships with Windows (via the obscure "Install drivers on my own machine" dialog, which seems to be a relic from Windows 98 and incredibly can't be resized to show more than four of the hundreds of drivers available at a time) but this Broadcom driver does not work either. This is really unfortunate - I am incredibly close to a working system! Why won't the WiFi work, did I damage it or not reconnect it properly when putting the machine back together?
There's yet another sub-installer in the Boot Camp package that I try out, this one at
BootCamp\Drivers\Apple\AppleSoftwareUpdate.msi. My hope is that this thing, once installed, will be able to detect my hardware and pull the appropriate drivers from Apple. And at first it seems promising - I think I did get some updated drivers, and I did see an installer package for WiFi support. But at the end of the day, even after installing Apple's own WiFi driver updates, I still didn't have a driver that could turn on my WiFi card!
Well, the answer turns out to be that I didn't have a Broadcom WiFi chip. After Googling the hardware identifier string I found that I had a Qualcomm Atheros AR938X. What the heck, man. I don't know if Apple even shipped drivers for this in the Boot Camp driver package. The best source for the driver online appears to be the incredibly sketchy ath-drivers.eu. Hopefully none of this stuff is compromised, but if it is - hey, it's a gaming PC.
Once that is installed the WiFi hardware comes up perfectly. Windows 7 does not yet support emoji and UTF-8-encoded WiFi network names so I have to join a mojibake SSID. This does not seem to impact the performance of the driver.
To test the hardware out I install Overwatch which is probably the most modern game I play. It defaults to the lowest graphics settings but appears to be getting a stable 30 FPS on the practice levels. It seems like my mission is a success!