Fun with Qemu & Large Disks….

I was playing around with NeXTSTEP under a snapshot of qemu and I noticed that my arrow keys were not working correctly. After a few hours of digging about I found the fix was easy enough:
-k en-us
That’s it, just append that to your boot string, and away you go! Another annoyance has been my quest to install AROS onto a P4 computer.. I picked up a new 320GB IDE disk (WD Caviar Blue) .. which the BIOS & AROS promptly refused to acknowledge corectly. Everything was going to hell until I gave up and read the manual. Once again it was simple, there is a jumper setting for ‘older’ OS’s to see only 32gb, and naturally the BIOS is now happier. If only I could say the same of AROS…

Some fun networking with MS-DOS & Novell Netware.

Ok I wanted to do this eventually but now I’ve finally done it. I have constructed something a little complex but it works surprisingly well.

Let me draw a picture so it’ll be a little easier to follow:

proxmox Netware diagram

proxmox Netware diagram

 

All of the machines in clouds are virtual…

Ok I’m going to assume you can install & configure OpenVPN on your own. I did a really simple install on Proxmox VE, just be sure to use the e1000 network adapters. All the others gave me tones of errors with any sizable traffic. Also I should point out that I’m using OpenBSD 4.3 which is the latest as of today.

dev tun0
dev-type tap
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
dh /etc/openvpn/dh1024.pem
key /etc/openvpn/server.key
server-bridge 192.168.6.33 255.255.255.224 192.168.6.50 192.168.6.62
push “route 192.168.6.0 255.255.255.0”
push “dhcp-option DNS 192.168.6.34”
client-to-client
duplicate-cn
keepalive 10 120
max-clients 100
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3
tun-mtu 1500
fragment 1300
mssfix
float

Again I just followed the example from the OpenVPN site to set this up. What makes this different though is the fact that I’m using this in a bridge mode. As you can see I have told OpenVPN that it is to use the tun0 interface as a ‘tap’ driver.

My hostname.tun0 is this:
Link0 up

Likewise the bridgename.bridge0 is:
add em1
add tun0
up

And finally for this example my bridgename.em1 is:
inet 192.168.6.33 255.255.255.224 NONE

So using this setup I have a ‘private’ 192.168.6.32/27 network in which I’ve got a few virtual machines running and space for my laptop to VPN into. Now one of the virtual servers on my Proxmox server is Windows NT 4.0 Terminal Server… Yeah I know I got it cheap on ebay, and I kind of like it. Anyways I’m running Qemu on it, which is running Netware 3.12. I installed the libpcap then I had to find out what my Ethernet devices are called. I used wireshark (it was ethereal) and it’s a cool program to have around. The last version to run under Windows NT 4.0 was 0.99.4 so that’s the one I used. Once I have done this I found my device and was able to setup a string for Qemu (which was \Device\NPF_RTL80291)

Here is what I’m using:

Qemu –had netware.disk –m 16 –M isapc –L pc-bios –net nic –net pcap,devicename=”\Device\NPF_RTL80291”

This sets up an ISA computer with 16 megaybtes of ram and a single ISA nic that will utilize libpcap to send out frames on the rtl80291 that’s being emulated to my NT terminal server by proxmox.

On the ‘client’ side of things, I’m running the 64 bit version of Vista. So I’ve installed the OpenVPN that not only has 64 bit device drivers, but has a nice little GUI to connect & disconnect from the networks. Here is the OpenVPN config that is on my laptop.

dev tap
ca ca.crt
cert client1.crt
key client1.key
client
proto udp
remote 192.168.1.75 1194
resolv-retry infinite
nobind
persist-key
persist-tun
;comp-lzo
mssfix
tun-mtu 1500
fragment 1300

Ok, so far so good. Now I do have Virtual PC 2007 on my laptop, and I have made sure that the “Virtual Machine Network Services” were bound to the “TAP-Win32 Adapter V9” interface.

The it’s a simple matter of connecting to the VPN, then loading up the virtual PC with MS-DOS & the Novell Netware client.

Then you should be able to ‘bind’ to the server & login!

dos netware client

dos netware client

The ‘cool’ thing about this setup is that it will work over things like wifi, and easily allow you to add clients near & far. Oh and the best part for the wifi crowd is that it will use REAL encryption since WEP/WPA have all been shown to be useless. Oh yes, and it should allow you to host your DOOM, Quake 1, Rise of the Triad, Warcraft II, and Descent games…. Along with people playing at home! Using this you too can build your own IPX/Internet network!

I do hope this clears some of the uses & versility of Virtual servers, Qemu & Virtual Networking.

Netware 3.12 with Qemu

Ok I’m getting more requests on this which means I’ll finally do it.. I didn’t mean to put it off THIS long, honestly!

I have issues with Qemu 0.91 under Vista so this will all be with Qemu 0.90.

I have built a version with the libpcap compiled in, and placed a copy of the winpcap that I’m using in with this zip.

You can download the libpcap enable Qemu for Win32 right HERE.

I’m using the enclosed 1.cmd to run the thing, and I’ll go over more of it tomorrow.

Qemu 0.90 patched for NeXTSTEP 3.3 i386

Patches for Qemu 0.90 are available here:
http://www.vaxenrule.com/Shared%20Documents/patchesforNeXTSTEP-on-Qemu-0.9.diff The busmouse patch still survives here.
The win32 exe is here.

A PowerPC macosx 10.4 binary is available here:
http://www.vaxenrule.com/NextSTEP%2033/qemu-0.9.0-osx-10.4-PowerPC

This moves the soundblaster to IRQ 7, and incorporates a bus fix & busmouse additon. Remember to remove the parallel port for this to work correctly. Tested with NeXTSTEP 3.3

Why all the patches, you may ask? Well for some reason NeXTSTEP is unable to correctly drive the mouse in Qemu. Nobody has tracked it down, but I suspect it’s some wierd issue with the BUS… Anyways I found this busmouse patch ages ago, and I’ve just been finagaling it for ages so that it will keep on working. I know that there are a hand full of enthusists left, but I figure that for all interested they would appreciate this.

Linux the old

My first experience with Linux was with SLS, or Soft Land Systems. It was the first pre-packed Linux system for those of us who didn’t have a Minix system to cross build from. Although Taunenbaum saw this as a draw back, like Linus many of us had 386 computers, and wanted to exploit their power. Many of us were sickened by the shattered hope that was the 286, which provided protected mode, abet in 64k chunks. The 386 offered the holy grail, or a 4 gigabyte address space! No more offset games.

At the time the closest one could hope in terms of a personal Unix was SCO Xenix, which with the developer packages was prohibitively expensive, or Coherent. Coherent was a clean room re-implementation of Unix version 7 ( http://www.vaxenrule.com/sls%201.05.zip.torrent ).

I’m going to use Qemu, again because of it’s cross platform nature, and it’s ability to emulate the NE2000. One can only hope one day that VMWare or Virtual PC would allow some kind of interface for us to ‘hack’ emulated hardware into their infrastructure…..

Anyways first let’s create a 200mb disk

Qemu-image create –f qcow sls.disk 200M

Don’t laugh, 200mb back then was a ‘big deal’… Really. Mine was SCSI, and probably weighed some 7lb.

Unzip your sls distro somewhere accessible from your Qemu tree. I’m just going to stuff mine under a sls directory. During the install we will need a boot disk, simply copy any one of the files to ‘boot’. We’ll touch on it later. To boot from the floppy I’m going to issue:

qemu -L . -hda sls\sls.disk -m16 -net nic -net user -fda sls\a1.3 -boot a

At the LILO prompt simply press enter. Then you’ll be informed
Press to see SVGA-modes available, to continue….

Press space. Early Linux kernels had this annoying ‘feature’ compiled in.. I know, I think I’m the only person that doesn’t like custom fonts, nor do I like directory colors.

At the login prompt, login as root then run the fdisk command. The keystrokes for creating a primary Linux partition is as follows:
n
p
1
1
400

Now we are going to make a smallish swap partition.
n
p
2
401
406

Now we need to change its type to swap.
t
2
82

It’s just a byte flag, but each operating system selects a flag to identify itself to others, a marker of what is where. Before emulation on dual boot systems this was a “big deal”… However now dedicating a virtual machine to an entire OS takes out the complexity that plagued so many users so long ago….

Let’s save the changes type typing in ‘w’.

We are then told to reboot the system. Type in ‘sync’ a few times, then close qemu & restart it with the same flags.

Now we can login as ‘install’. We can use the color screen, so enter ‘y’. We are going to do the brave thing, and use floppy disk images. That’s option 1. The floppy images are 3 ½” so that’s option #2.

Now we need to identify the root & swap partitions. Select #1, then type in /dev/hda1. It will want to format it, so let it. Next select #2 for the swap, and type in /dev/hda2 .
Now we can select #7 to commence installation.

To get the full experience we are going to install the full thing… 100MB of it.. Option #4. We don’t want to be prompted we simply want everything that SLS has to offer, so answer ‘n’.

You will be prompted for a2-a4 Don’t forget in Qemu it’s ctrl-alt-2 for the runtime config, and you just issue:

change fda sls\a2

and so on for the rest of the disks. Then ctrl-alt-1 to go back to the main screen.

While this may seem tedious it’s better & faster than the real thing. Trust me!

Once X11 finishes unpacking, place in the boot disk, and let it write to it. Next feel free to preset the video mode to -1. We don’t have a modem, so you can answer no. Next we’ll allow the install to mark /dev/hda1 as the active partition. Just press enter for the question about dos partitions. Pick a snazzy hostname. The default softland works just fine. We have no patch disks, so you can just enter ‘n’ and press enter.

Phew we have just installed SLS! Press enter!

After that you can boot up into Linux 0.99.15g/SLS 1.0 . The best that 1994 has to offer.

Before we leave for now, lets get X-11 rolling. Login as root, no password, and then run syssetup. Choose 5,2,6,0. This configures the basic VGA server, a PS/2 mouse & exits the basic program. Running ‘startx’ Should get you into a really old X-11. No Gnome/KDE here! The mouse however acts erradictly. Ctrl-alt-backspace will bring you back to the prompt. I’ll see if I can figure this out later…

But for now that covers a basic install. Next up we’ll do some networking, and a game perhaps….

A tale of two kernels.

Back in the early 1990’s Microkernel’s were all the rage. Everywhere you would go you’d hear all about Pink, Taligent, Windows NT, and the grand daddy of them all Mach.

Probably the most well known debate about microkernel vs monolithic kernels was the Tanenbaum vs Torvalds debate that raged on comp.os.minix back in 1992. You can read the entire thing here : ( http://www.oreilly.com/catalog/opensources/book/appa.html ). It was interesting in the sense that even Ken Thompson of UNIX fame even chipped in. Tanenbaums’s major points were that a microkernel is more inherently portable than a monolithic kernel, and that microkernels could be more reliable, and easier to maintain. Of course more than 10 years later we can see that Linux still flourishes, and that outside of Windows NT & OS X no mainstream OS relies on a microkernel. Even OS X treats mach more as a call library than a traditional microkernel, since all of the exe’s in Darwin / OS X are Mach-O format, not COFF/ELF,A.OUT, etc etc.

Mach started out as a project from CMU derived from the UNIX source code, to try to re-invent the lower levels of UNIX into something that would scale easier to multiprocessors, support for threads, and the holy grail of them all, expand it’s portability. Sadly the first few versions of Mach are barred from distribution due to their inclusion of encumbered UNIX source code. However when the university of Utah picked up Mach, and released Mach4 (UK22, info here http://www.cs.utah.edu/flux/mach4/html/Mach4-proj.html ), including full source. Also they provided Lites, a BSD server that can run atop Mach, giving the user a ‘UNIX’ system, as it were.

Lites

Lites

So digging through some network groups, and testing stuff, I finally slapped together the pieces, and built a Mach/Lites system on NetBSD 1.1 . And how does it perform? It’s significantly slower than NetBSD is. You can tell that the amount of context switching involved in Mach as a program makes a call the microkernel, which in turn validates & passes it to the server, which further validates, runs the process, then sends the results back to the kernel, which then passes it back to the program. I’ve heard in a worse case scenario a 500% reduction in speed. You can always read more info on the fine wiki article here ( http://en.wikipedia.org/wiki/Mach_kernel ).

Lots of people will argue that microkernel’s have simply failed, and that it’s simply an example of what seemed like a good idea being pushed too hard once it was found to fail. It a lot of ways it reminds me of ADA.

So for now I’m going to provide a Qemu image of Lites running on Mach 4. unzipping the file will provide you with a lites.cmd file which for windows users you can just run directly. Things to note are:

-The version of Qemu that I’ve bound requires libpcap to be installed.
-Mach4 can only address 16mb of ram, due to DMA issues across the 16mb line.
-I’ve enabled user mode networking so that
-the cmd file sets up local port 23 to be redirected to the VM. This will allow you to telnet in simply by ‘telnet localhost’. You may want to use putty for better terminal handeling
-The included Gcc 2.4.5 is ancient. Outside of building a simple irc client, I wouldn’t expect much.
-The boot process is broken, and it’ll parse through the rc scripts twice. Just let it do it’s thing, and it’ll drop to a login prompt.

Logging into Lites/NetBSD

Logging into Lites/NetBSD

Other than that it behaves just like a NetBSD 1.1 machine.

Notice that grub boots the kernel /Mach.UK22 . When Mach boot’s it’ll load up the files emulator & startup. The ‘emulator’ is the Lites microkernel. Once it’s loaded it’ll start mach_init which just symlinks to /sbin/init and the normal NetBSD bootup will commence.

You can download my image directly here as MachUK22-lites-nat.zip.

Next time we’ll play with SLS Linux.

Running Xenix on qemu

Neither Bochs nor Qemu can boot the Xenix floppy diskettes all the way. Virtual PC & VMWare seemed to have no luck when the kernel transitions to protected mode. While on the way to work I had an idea. What if you had an old hard disk and a machine capapble of installing? Simply imaging the hard disk may be enough, since after that point you don’t need any floppy disks!

So this is what I have to show for the work today:

Freaking awesome, if I do say so myself.

OK, now how to do it? First you need an existing system running Xenix. If you have any plans on migrating an existing installation take note! This will preserve your install, just don’t format! On the Xenix boot screen take note of the geometry of the disk. We will need the geometry for later. Although I did a test boot without it, its a good thing to preserve it.

For virgin users, you will need a small disk to install on. I had a 2.5 GB disk that was too big, and 132MB disk that worked fine. I used a dell pc with 2 ide controllers for this. The longest task honestly was installing Xenix. I think that ran about 20 minutes. Once I was done, shutdown xenix, and put the disk in a machine running Windows (Linux fans can put it in their box, and just dd the Xenix disk into an image). Us poor Windows users don’t have dd. Anyways take not of what disk # it is, as Windows of course will not assign it a drive letter since it does not understand Xenix’s filesystem.

As you can see it’s disk #2 in this computer. Ok now we need to read the disk and write it into a disk image. I couldn’t find a util offhand to do it, so I wrote one real quick. Here is the source code, you’ll need a C compiler on your PC to compile it. I guess I could ‘neaten it up’ some, but for now here you go:

Source code

Executable

Yes I know its horrible, and blogger does a wonderfull job of formatting my program. Anyways compile it & run it. Now you’ll have a disk image of your hard disk!

Now for the fun part, running Xenix! We simply specifiy the hard disk geometry that we got earlier, and pass it the disk image that we created! I’m using an Quantum Pro drive ELS with the following geometry:

919 Cylinders
16 heads
17 bytes/sector

That translates into the following command:

qemu -M isapc -m 16 -hda xenix386-2.3.4.disk -hdachs 919,16,17 -L .

 

Let the good times roll!

–Update from 2011!

It is *NOW* possible to install Xenix in Qemu 0.14.0. You can read more about it here.

Installing Novell Netware 3.12

Ok, I thought I’d kick this thing off, by installing the most popular NOS (network operating systems) on Qemu.

First I tried the 2.x stuff, and it just crashes on the bootup of the kernel. Which is frustrating, as it required me to shuffle floppies like there was simply no tomorrow. I also have a copy of 4.1, which I’ll do at some other time.

Let’s get to the list of our requirements:

  1. Qemu 0.9.0 I’m going to use the windows pre-compiled version that can be found here: http://www.h7.dion.ne.jp/~qemu-win/
  2. MS-DOS, or I suppose you can you any DOS compatible OS. I haven’t tried DR-DOS, or FreeDOS. For this installation I’m going to be using MS-DOS 6.22 that is available on MSDN.
  3. An IDE cdrom device driver. I’ve had mixed results with various drivers, however I like IDECD.SYS available from: http://www.computercraft.com/cd_drivers/cdromdrivers.shtml
  4. An ISO Image of your Netware 3.12 CD. For the real unfortunate you’ll have the floppy version…
  5. Some way to take your license diskette and make an image of it. I like WinImage. Available here: http://www.winimage.com/winimage.htm

Here is what my directory looks like before I get started.

 

05/31/1994 06:22a 1,474,560 dos622_1.img
05/31/1994 06:22a 1,474,560 dos622_2.img
05/31/1994 06:22a 1,474,560 dos622_3.img
05/13/2007 01:16p 1,474,560 idecd.vfd
01/26/2004 04:25p 79,321,088 netware312.iso
02/19/2007 12:02a 6,248,207 qemu-0.9.0-windows.zip
05/13/2007 10:42a 1,474,560 SYSTEM_1.IMG
03/08/2007 05:22p 102,400 unzip.exe

Ok, let’s get started! First we are going to unzip the qemu distribution. I’m using Windows 2000 for my host, so I’ve got the commandline unzip from the execellent distribution here: http://unxutils.sourceforge.net/ Ironically it’s zipped, so I’ll provide a copy of unzip at my site here: http://www.vaxenrule.com/Shared%20Documents/unzip.exe

Next cd into the qemu-0.9.0-windows directory. First we need to make two hard disk images. For whatever reason Netware doesn’t detect the MS-DOS disk partition geometry correctly and will destroy your boot hard disk. Since we are running under an emulator, virtual hardware is cheap, so adding a second disk is really no big deal. The MS=DOS hard disk is only to boot up, so it won’t be big at all. I’m going to create a 32 megabyte boot disk, and a 1 gigabyte Netware disk. You can always add more disks, or go with larger disk. Just be forwarned that my Netware didn’t like the MS-DOS disk’s partitioning. This may be a fault of ISADISK, but then it worked fine on its own disk.

qemu-img create -f qcow netware-boot.disk 32M
qemu-img create -f qcow netware-data.disk 1G

Ok now with the disks created it’s time to install MS-DOS. I’m going to assume that you have *some* experence with Qemu, and MS-DOS.

qemu -L . -hda netware-boot.disk -hdb netware-data.disk -M isapc -m 16 -net nic -net none -fda ..\dos622_1.img -boot a

With any luck you’ll be greeted with this image:

netware1

We are going to just accept the defaults (hit enter a few times) which will partition the first disk, and ready it for the MS-DOS install. After enough enters, qemu will reboot, and MS-DOS will format the first disk, and then prompt for disk two. We will want to change disks. This part of qemu can be a little scarry for the uninitated, however its quite simple. Click on the qemu window, then hit CTRL+ALT+2. This will bring you to a window like this:

netware2

 

I typed in “info block” to show what disk images were mounted where. Then to change floppy disk images, simply typing in “change fda ..\dos622_2.img”. Pressing CTRL+ALT+1 changes you back to the qemu display, where you can hit Enter to tell the MS-DOS installation program that you have inserted the second disk image. You will need to repeat this for the third disk.

Once MS-DOS is installed it will prompt you to remove disks and press ENTER. You can simply press enter, and qemu will notify you that your disk is not bootable. Close qemu.

Now we are going to boot qemu from the hard disk, and with the idecd.vfd disk image containing IDECD.SYS.

I’m going to start Qemu as follows:

qemu -L . -hda netware-boot.disk -hdb netware-data.disk -M isapc -m 16 -net nic -net none -fda ..\idecd.vfd

Copy the IDECD.SYS device driver from the floppy to the C:\DOS directory (copy a:\idecd.sys c:\dos). Then you will need to edit your config.sys & autoexec.bat to recognize the cdrom.

Append the following line to config.sys using edit

device=c:\dos\idecd.sys /d:cdrom01

And append the following line to your autoexec.bat

mscdex /d:cdrom01

Information on edit can be found on Wikipeida here. Although if you don’t remember MS-DOS edit, you are going to be in a world of pain when we start Netware…

Ok with the configuration files edited, we can close Qemu, and now start it again as follows:

qemu -L . -hda netware-boot.disk -hdb netware-data.disk -M isapc -m 16 -net nic -net none -cdrom ..\netware312.iso -fda ..\system_1.img

During the MS-DOS install the netware data disk may have been formatted by DOS. This is no big deal, but just keep an eye where your CD-ROM drive is drive letter wise.

To start the Netware install, we now need to type in the following:

e:
cd netware.312\english
install

You’ll get some warning about ethernet frame types, which we can ignore for now. Then you’ll be prompted on the install type. We are going to do a new installation, so just hit enter. The MS-DOS partition will be displayed on the primary disk. We can just leave it alone (or we’ll have to start from the beginning!), press enter to retain the current setup.

Next you’ll be prompted for a server name. I’m not going to cover moving data from an existing Netware 3.12 server, so for now I’m just going to call my server “bobo”. I’m going to accpet the preselected internal IPX number. Again if you are migrating you may wish to preserve the exting information. You will next be prompted as to the location of the DOS mode files. Press enter as the defaults should be correct.

You can press F10, to accept the default locale. Next Netware will ask what naming convention you will wish for your server. If you are going to use ‘modern’ clients on your server you will wan’t the Netware format, otherwise, select the MS-DOS format. Next press enter, as we have no special startup flags. You may allow autoexec.bat to be modified to boot netware directly. The Netware console will now boot up to something like this:

netware3

Next let’s load the disk driver. Type in:

load isadisk

It will prompt for the port & interrupt, just press enter to accept the defaults. With the disk in place, its time to install the Netware files so that we can then setup the networking. Type in the following:

load install

You will be presented with the menu driven install. You will want to setup the partition on the ‘data’ disk. press enter twice, then select the second disk. You’ll need to delete any existing partition, then select create a Netware partiton. You can use the defaults (the entire disk). Pressing escape will confirm the partition creation. Press escape to get back to the root menu, now we can create some volumes. I want a 200MB SYS volume, and the rest of the disk as DATA. Of course you may have other wishes, but this is my install.

Press insert will allow you to create a new volume. Using 4k blocks, about 50,000 of them will allow for an approximate 200MB volume. Pressing escape & enter will create the volume. Next create the DATA volume with the remainder space.

You’ll need to mount the SYS volume by selecting it, and then going down to status, and selecting “Mount Volume”.

With your system volume mounted, we can now copy the rest of the files. Press escape to get back to the root menu, and then select “system options”. From here choose the fist option to copy the system & public files. Since I’m using a CD-ROM, I’m going to press F6 and change the path to:

e:\netware.312\english

Then perss enter. Netware will now start to copy the files. This can take a while. Once the copy is completed, press escape back to the main menu, then exit the installer. I know this seems counter intuitive, but its for a good reason.

Now we will want to load the network card. The default location & type of the network card in Qemu is a NE2000 at 0x300 on interrupt 2/9 (it’s a shared IRQ). Type in the following:

load ne2000

Be sure to select IRQ 2 for the Interrupt Number. Next we will want to select an IPX network number for the card. If you have an existing one, use it, otherwise make one up.

bind ipx ne2000

Then type in the nework name when prompted. I’m using DEADF00D.

Now we can re-load the install program. Go back to System Options, and create the autoexec.ncf file. At the end of this file, you may wish to add “load monitor”. Use the escape & save. Select the default for creating the startup.ncf file. With those two files in place we are now ready!

Exit the install program and then you’ll go back to the server console. Type in down, and the Netware server will shutdown. Then type in exit and you’ll get dumped back to MS-DOS. You can now close Qemu. Now you can re-start Qemu with the following command line:

qemu -L . -hda netware-boot.disk -hdb netware-data.disk -M isapc -m 16 -net nic -net none

Or even save it to a CMD file. You will now have Netware 3.12 installed on a new computer!

I don’t think I need to point out that not only is this exellent for preserving an existing copy of Netware 3.12 (Which was *VERY* expensive in the early 1990’s) But by emulating an older PC we don’t have the same worry when it comes to device drivers. Not to mention the Netware server is now portable to newer computers, by simply copying the data files. I’ll save networking this fileserver for another day.