cos

Unix

(or: running SunOS 4 on an emulated SPARCstation in 2025 with QEMU 10.1.)

A colleague from one of my previous jobs recently wrote about running VMS on an emulated VAX 11/780. I figured I'd give it a go, as I'd passed up the opportunity early in my career to spend more time with VMS (twice, in fact). I didn't get very far, but something caught my eye at the end of his blog post – he'd also been playing with emulating a SPARCstation. Ooh. That thoroughly nerd-sniped me for the weekend.

Why?

At my first job, in the early 1990s, I found myself working on a SPARCstation 10 writing software in C for a project our company did with a local telco. It was my first time using SunOS, as my university was a DEC shop. Over time, I took it upon myself to maintain the fleet of SPARCstations and its surrounding network – keeping the software on them in sync, introducing new, useful open source software, and solving problems our developers had while using them. I just couldn't help myself – it needed doing, so I did it. The company eventually noticed, so one day our boss asked me, “How about you focus on just doing this? We'll call you a System Administrator.”

So, then – SunOS has a very special place in my heart as the first Unix I used for work. Running actual old hardware is something I don't have enough room for, though. So emulation it is!

Aren't there already instructions to do this?

Blog posts about stuff like this seem to age like milk – inevitably different things go wrong as the years progress and emulators get tweaked. There was nothing out there that just worked in this, the year of 2025.

Here's what I've discovered in order to get it working, then, building on posts from nonspecialist and a few others.

While my final instructions focus on macOS, I'd also experimented with running QEMU on Ubuntu 24.04 and 25.10 VMs, just in case it helped. You should be fine with them too, keeping in mind the tweaks around display and network connectivity.

Getting to the initial installation

John Millikin's post is probably the most useful one I've found across the internet. Among other things, it reminds us about keeping the RAM sized under 100MB unless you can be bothered tweaking the size of the swap partition on disk. 96MB of RAM works fine, for instance.

I had trouble using QEMU's default OpenBIOS to try and boot off the CD image – it said No valid state has been set by load or init-program.

nonspecialist's second post covers getting it to use the Sun ROM. I also had that emotional feeling of seeing that font and that Sun logo popping up on a white screen. Woah.

Since 2023, though, something has changed in QEMU and you won't see that “Wrong packet length” error in his screenshots – instead, you'll see a “Timeout waiting for ARP/RARP packet” message repeating.

If you've used Sun hardware in the past, you'll remember being able to press Stop-A on the keyboard to get into the boot monitor. How do you do that in QEMU? Well, if you've connected the monitor somewhere, you can!

I added -monitor stdio to the end of my sprawling qemu command (see below). That lets me type a command like this in the terminal / shell (pty if you want to get technical) where I ran the qemu command:

QEMU 10.1.0 monitor - type 'help' for more information
(qemu) sendkey stop-a

From here, a boot cdrom at the Sun OpenBoot PROM (OBP) prompt worked, enabling me to:

  • boot from the CD image to install the miniroot
  • boot from the miniroot and install the OS from the CD image by running suninstall

Steps to follow on macOS to get this far

Assuming you've installed Homebrew on your Mac, you can do this:

  • brew install qemu
  • fetch the SPARCstation 5 ROM image and SunOS 4.1.4 CD image – yep, SunOS 4 was retrospectively named “Solaris 1”, and Solaris 1.1.2 / SunOS 4.1.4 was the final release
  • qemu-img create -f qcow2 disk1.qcow2 2G to make the disk image
  • put the script just below into a file called run-sparc5.sh
    • if you're not on macOS, you'll need to customise the -display and -nic sections
  • boot the VM by running ./run-sparc5.sh – it should then say QEMU 10.1.2 monitor - type 'help' for more information and the cursor should be next to (qemu)
  • when you see “Timeout waiting for ARP/RARP packet”, enter sendkey stop-a in that same window where you'd typed ./run-sparc5.sh (ie. just next to (qemu))
  • pop over to the VM's window and boot cdrom
  • when it reboots, do the same sendkey stop-a but this time boot disk
  • you'll be dropped at a root prompt (starting with a #) where you can type suninstall and follow the prompts to install the OS to the disk

run-sparc5.sh

#! /bin/bash
qemu-system-sparc \
    -name mysparc5 \
    -L . -bios ss5.bin \
    -machine SS-5 \
    -m 96 \
    -drive file=disk1.qcow2,if=scsi,bus=0,unit=3,media=disk \
    -device scsi-cd,channel=0,scsi-id=6,id=cdrom,drive=cdrom,physical_block_size=512 \
    -drive file=sunos4.iso,if=none,id=cdrom,media=cdrom,readonly=on \
    -nic vmnet-bridged,model=lance,mac=52:54:00:11:22:33,ifname=en0 \
    -vga cg3 \
    -display cocoa \
    -monitor stdio

Hiccup number one

At this point, I was excited to boot into the working OS but instead, it only got a little further before QEMU crashed with a Trap 0x29 (Data Access Error) while interrupts disabled, Error state error.

I found some discussion in this issue in the qemu repo which led to a second issue that gave me some further help when someone suggested:

One thing I remember from using real Sun systems is that if you do a “Stop-A” while it's trying to boot (from the net, or whatever), you can leave the device environment in a bad state, and you typically had to fix up your NVRAM environment to get the boot device you wanted and issue a “reset” to the PROM monitor and start again.

Making that work, though, needs us to stop it trying to boot off the net when it resets., so that we don't need to press 'Stop-A'. A quick refresher on Sun OpenBoot PROM commands reminded me that I could type this:

setenv auto-boot? false
reset

It'd then reset the VM, and I could boot disk from there.

Hiccup number two

Reading a bit further down issue 2015 I saw someone say:

Unfortunately, at this point it's currently freezing having mounted root, swap, and dump.

which matched what happened to me. Ugh.

sad trombone - it hangs right here after mounting the filesystems

Randomly trying things until they work, part 1

I tried other SPARCstation types – I could get a SPARCstation 20 partially booting if I added -machine SS-20 -cpu TI-SuperSparc-60 and used the appropriate ROM, but it crashed in other ways and I still haven't got it completely working. I also couldn't get it to make more than 1 CPU visible, but that's no big deal – Solaris 2 used multiple CPUs much more effectively, I seem to remember.

Randomly trying things until they work, part 2

At this point, I could've gone and built QEMU from source, trying some of the patches mentioned in that repo issue. I was feeling a bit lazy, though, and figured I'd try a few other things before giving up and going that way. One experiment was to swap out the Sun ROM for QRMU's default OpenBIOS...

...which worked!

The finally-working QEMU script for macOS, then

#! /bin/bash
qemu-system-sparc \
    -name mysparc5 \
    -machine SS-5 \
    -m 96 \
    -drive file=disk1.qcow2,if=scsi,bus=0,unit=3,media=disk \
    -device scsi-cd,channel=0,scsi-id=6,id=cdrom,drive=cdrom,physical_block_size=512 \
    -drive file=sunos4.iso,if=none,id=cdrom,media=cdrom,readonly=on \
    -nic vmnet-bridged,model=lance,mac=52:54:00:11:22:33,ifname=en0 \
    -vga cg3 \
    -display cocoa \
    -monitor stdio

ie. I've just removed the “roms” line from the one above.

So all of this means that you should:

  • use the first script (with SPARCstation 5 ROM) for initial installation
  • use the second script (without the ROM line) for running it normally

Hurrah!

Ok, so I could boot up, enter boot disk3:a at the OpenBIOS prompt to get into the installed OS, do that final configuration, and make the network work per John Millikin's post.

I have a weird netmask on my network for historical reasons, so I had to add an entry to /etc/netmasks and configure /etc/defaultrouter.

How do I get files onto it?

You might notice John Millikin's post talks about compiling recv.c on the VM to get a basic program to receive files over a bare network connection from elsewhere. I was going to use this, but had another thought, about using ancient internet technology that still works today.

I remembered that SunOS 4 has a bunch of network services accessible by default (a security nightmare if you connected it up to the Internet, unexposed!). One of these is FTP, the venerable File Transfer Protocol. Checking /etc/inetd.conf confirmed my memory that an FTP server would, indeed, run on demand.

On my Mac, Homebrew still has lftp available, so I installed that, and could transfer stuff by running lftp -u username _host or IP_ and then put file (or mput file* to send a few at once).

Netscape works per John's post, and when looking for stuff earlier in my adventures, I'd found a copy of Lucid Emacs(!) on archive.org, which seems to run.

a working desktop!

Historical artefacts

What was truly useful, though, was suddenly remembering that I still had these books on my bookshelf – a few issues of Rich Morin's Prime Time Freeware for Unix from the mid-90s. These were from the days when people had slow, or even only occasional internet access. Having local copies of software was super useful. The CDs still work, and I was able to copy the source for two pieces of software – gzip and zsh – that were essential way back then, onto my VM and compile them.

three Prime Time Freeware books with CDs

What's next?

Well. I'll probably:

  • dig up a 3-button mouse, as Sun's OPEN LOOK Window environment really just doesn't work without one
  • compile a few more memories that I can find on the PTF CDs – olvwm for one, and probably a heritage version of GNU Emacs – maybe 18.59 for real nostalgia
  • make it look more colourful!
  • see how much semi day-to-day stuff I can do from it
  • wonder if I can make it properly boot automatically (ideas welcome!)

...and what else is next?

Beyond getting back to that VMS emulation, I'm also wondering how easy it is to emulate a DECstation, so I can relive my student days? Definitely tasks for some other time, though.

Final thoughts

SunOS existed in a time before journaling filesystems, so make sure you shut the VM down properly (via a su -c 'shutdown -h now') rather than just switching it off, or you'll find yourself needing to learn how fsck works.

#SunOS #Unix #Emulation #RetroComputing #SPARCstation


This was a post from Cos.

You can follow this blog on the Fediverse at @cos@apintandaparma.club or subscribe in your RSS reader.

Hi! I’m Cos, and I run this service. My pronouns are he/him and I live in #Naarm / #Melbourne in Australia with my wife and cats.

I’ve been hanging around the Internet since the days of UUCP connections. The distributed / less-centralized nature of those times is something that still appeals to me, which is why I’m still here #selfhosting and hosting for others – I’ve loved empowering friends to get their thoughts up and into the Internet so that it’s not just the same old nerds like me in here.

I’m trying out WriteFreely as a way to better aggregate my writing and some other information. This post serves as both an #introduction and a test.

Read more...