Sunday, February 2, 2014

Debian 5.0.10 Alpha

I've been trying to get qemu-alpha working for years now. The furthest I ever got was partially booting a Debian ramdisk. It would boot into the installer as long as I didn't specify a CD to install from. If I did, qemu would crash right after detecting it. If I didn't, there was nothing to install from. I might have somehow installed from the internet but version 5.0.10 was the end of the line for Alpha support by the time I figured out how to get the installer to boot, the online repositories were long gone.

DVD's are still available at http://cdimage.debian.org/mirror/cdimage/archive/5.0.10/alpha/iso-dvd/ though, so if I could get qemu to keep from crashing, maybe I could install from the DVD.

Qemu 1.7.0 came out a little while ago and yesterday I gave it a try. I didn't notice anything in the release notes about updates to the alpha emulation but hey, you never know... Much to my surprise, the kernel detected the cdrom, didn't crash and began the installation. Woohoo!

It wasn't totally smooth though. The kernel reported the DVD but the installer couldn't find it later. I had to play around a bit, but eventually I was able to get the installation to work using:

qemu-system-alpha -kernel vmlinux -append 'console=ttyS0' -initrd initrd.gz -drive file=debian_alpha.img,if=ide -drive file=debian-5010-alpha-DVD-1.iso,if=ide,media=cdrom -net bridge -net nic,macaddr=aa:00:00:00:00:16 -nographic

I had to extract the kernel and ramdisk from the iso and unzip the kernel. The -drive parameters were necessary instead of -hda/-cdrom parameters too. Without them, the installer can't see the DVD. I'm not sure why.

Before long I was installing.

debian 5.0.10 alpha - 1. Installation

The installation was familiar. I told it to install all packages and aside from having to ignore a few warnings about not being able to access security updates, it went pretty smooth.

I hit my first roadblock trying to boot to the virtual hard disk though. The kernel and ramdisk on the installer disc are different than the kernel and ramdisk that get installed and can't be used to boot to the virtual hard disk. The partition table on the virtual drive wasn't readable by fdisk on the host either so I couldn't determine the offsets of the partitions to try to loopback mount. What to do? What to do?...

There are probably other solutions, but I created a second disk image...

dd if=/dev/zero of=fakedisk.img bs=1024 count=10000

...and booted back into the installer without the DVD so the installer would fail and let me drop to a shell:

qemu-system-alpha -kernel vmlinux -append 'console=ttyS0' -initrd initrd.gz -drive file=debian_alpha.img,if=ide -drive file=fakedisk.img,if=ide

In the shell, I mounted the /boot partition (/dev/hda2) and dd'ed the kernel to the second virtual drive (/dev/hdb).

mount /dev/hda2 /cdrom
dd if=/cdrom/vmlinuz-2.6.26-2-alpha-generic of=/dev/hdb

Then, on the host, I pulled it off of the drive image.

dd if=fakedisk.img of=vmlinuz-2.6.26-2-alpha-generic bs=1587497 count=1

I then repeated this to get the ramdisk.

In the vm...

dd if=/cdrom/initrd.img-2.6.26-2-alpha-generic of=/dev/hdb

...and on the host:

dd if=fakedisk.img of=initrd.img-2.6.26-2-alpha-generic bs=9271534 count=1

Got em.

Now to restart qemu...

After some trial and error, I eventually discovered that with the VGA console disabled, gdm would crash qemu. The solution was to start linux in single-user mode...

qemu-system-alpha -kernel vmlinux-2.6.26-2-alpha-generic -append 'console=ttyS0 root=/dev/hda3 single' -initrd initrd.img-2.6.26-2-alpha-generic -drive file=debian_alpha.img,if=ide -drive file=debian-update-5.0.10-alpha-DVD-1.iso,if=ide,media=cdrom

...then disable gdm...

cd /etc/rc2.d
mv S30gdm K30gdm

...and then restart in multi-user mode.

qemu-system-alpha -kernel vmlinux-2.6.26-2-alpha-generic -append 'console=ttyS0 root=/dev/hda3' -initrd initrd.img-2.6.26-2-alpha-generic -drive file=debian_alpha.img,if=ide -drive file=debian-update-5.0.10-alpha-DVD-1.iso,if=ide,media=cdrom -net bridge -net nic,macaddr=aa:00:00:00:00:16 -nographic debian 5.0.10 alpha - 2. Login

Actually while I was disabling gdm, I also disabled other services I didn't plan on using like smartmontools, dhcdbd, winbind, spamassassin, and so on.

At that point, it was running, rather quickly actually, and felt like any other older Debian system.

I configured it with a static IP, added the Updates DVD to apt and installed openssh-server and various bits of development software. This required a bit of switching DVD's back and forth and I had to look up how to use the qemu monitor again.

Everything ran pretty well at that point. Networking worked. I could ssh into the machine. Apache worked. I could check out and build my software. I did run into a quirk with ODBC but that's why I like to build my stuff on these odd platforms. You never know what you'll find.

Gnome worked after rebooting with 256mb of emulated ram and aiming X at a nested X server on my PC.

debian 5.0.10 alpha - 3. Gnome

I could browse the web, albeit a little slowly.

debian 5.0.10 alpha - 4. Web

And finally, I was able to run the SQL Relay server against SQLite, PostgreSQL and MySQL and the client against a remote SQL Relay server to access Oracle.

debian 5.0.10 alpha - 4. sqlrsh

Yay.

So, finally I got linux running in an Alpha emulator. The only remaining problem is that it kind-of slams the host CPU. I guess qemu doesn't do idle-loop detection for Alpha, or if it does, it doesn't work with Debian. Either way, it's rough.

Still, it's a big step. I'll have to try some of the BSD and old Redhat alpha distros too.

2 comments:

  1. this is really cool!!! the firmware is still useless, but its awesome to see that it can boot Linux at least!

    ReplyDelete

  2. If you're looking for a decent and reliable resource that would provide high class protection for your corporate or personal data, provide high server capacity and many other advantages in the regulation of your business, turn your attention to the cloud server virtual data rooms for mergers and acquisitions

    ReplyDelete