Running MS-DOS on Debian GNU/Linux



This document deals specifically with getting Dosemu 0.98.8 and 1.0.1 running on Debian 2.2, a.k.a. Potato and perhaps Woody as well. Details provided here may not be completely applicable to other non-Debian based distributions.

Page Index


1. Introduction

The Linux Operating System right now is the hottest OS in the PC world. Perhaps you've heard of it and wanted to give it a try, but don't care to give up your favorite MS-DOS programs. Since Linux is based around the standards and file formats of the UNIX world, it is not designed to run MS-DOS or MS Windows programs natively. However, efforts have been under way now to provide Linux (and some other Unices) a way to run MS-DOS programs. The Intel x86 series of microprocessors since the 80386 have contained a feature known as Virtual 86 that allows the microprocessor in conjunction with supporting software to mimic the behavior of an 8086 based computer (in fact multiple virtual 86 machines can exist at once). This combination of hardware and software allows an environment to be created that allows MS-DOS programs to run as if they are being run by themselves on an 8086 machine. MS Windows uses this technique to run DOS programs and multi-task them with Windows programs. Such a program written for Linux is known as dosemu, or the DOS EMUlator.

Dosemu isn't so much an emulator of MS-DOS as it is a PC emulator as it creates a virtual 8086 PC in your computer's memory and boots DOS. Once DOS is running many programs written for DOS (including Windows after a fashion!) may now be run including KaGold. Dosemu provides programs access to real hardware including the serial ports and disk drives. Much of the configuration is done by editing a few text configuration files. Two of these reside in the main Linux directory for configuration files and the rest reside in a special file dosemu creates which DOS accesses as a bootable disk drive.

Top

2. Installing dosemu

Well, since you're using Debian (or a Debian based distribution such as Corel or Storm) your installation method is much easier and a bit more limited than building from source. The version of Dosemu packaged for Debian 2.2 is 0.98.8, a pre-release stable version. However, if you check the Dosemu site, http://www.dosemu.org/, you see the latest version is 1.0.1 and this version is currently packaged for Woody, a.k.a. Debian 2.3 Unstable. More on 1.0.1 in a bit.

Use your favorite method of installing a new Debian package to retrieve the latest Dosemu .deb and install it. If you would like to try the the 1.0.1 .deb that installed without dependency conflict on my 2.2 box, you can find it here as dosemu_1.0.1-3.deb. To install the 1.0.1 version, if you've never installed a package using dpkg manually follow these steps:

Step 1:		Log in as root
Step 2:		cd to the directory containing dosemu_1.0.1-3.deb
Step 3:		Install it with: dpkg -i dosemu_1.0.0-3.deb

Now, either package you chose should be installed and ready for configuration.

Top

3. Configuring dosemu

The configuration between 0.98.8 and 1.0.1 is essentially the same, although there are naming differences between the two installs. 0.98.8 uses the following files:

/etc/dosemu/conf
/etc/dosemu/users

and 1.0.1:

/etc/dosemu/dosemu.conf
/etc/dosemu/dosemu.users

Despite the naming differences, the two sets of config files are very similar. There are additional security permissions included in the 1.0.1 package which may make it a better choice if security is your concern.

Okay, everything has been installed, you can start dosemu with the dos -C command and you are able to boot the hdimage partition. Now you'll have to get things a bit customized. I'm no expert at getting dosemu configured in every situation, but have managed to get my system running. Here is a basic layout of my hard drives which will help explain my files and the choices I made.

Linux Device      mounted as     DOS Drive
/dev/hda1          /DOS/C/           C:
/dev/hda3          /                --
/dev/hda4          /opt/            --
/dev/hdb1          /DOS/D/           D:
/dev/hdc           /cdrom/           E:

Top

/etc/dosemu/[dosemu.]users

Configuring my dosemu installation consisted of editing four files. The first is /etc/dosemu/[dosemu.]users (the square [] brackets mean that part of the filename is package dependent) and it is touched on briefly in section 3 of /usr/doc/dosemu/QuickStart.gz. Of course, the package installation takes care of these dirty little details.

This file will suffice to start, however, if your machine is on any kind of network, be sure to follow the security advice in the dosemu documentation. The 0.98.8 file is "wide open" as users can access all capabilities and hardware Dosemu has to offer while the 1.0.1 package's file will require some modification to give a user or all users complete access.

The following line gives all users access:

all c_all

while

username c_all

gives it to a specific user (replace username with the login name of the given user). By default in each package the root user is given all privileges with c_all.

I found that if a user runs Dosemu the serial ports cannot be used unless the /usr/bin/dos executable has the SUID bit set. This is a security consideration, but is likely safer than running Dosemu as root!

Top

/etc/dosemu/[dosemu.]conf

The file you will really need to change is /etc/dosemu.conf Be careful as some of the settings fundamentally change the way dosemu behaves. Here are the lines I changed from the supplied file that seems to work reasonably well.

---------------------------------------------------------------------

$_cpu = (80486)         # CPU emulation, valid values:  80[345]86

$_speaker = "emulated"  # or "native" or "emulated"
$_term_char_set = "ibm" # Global code page and character set selection.
# "" == automatic, else: ibm, latin, latin1, latin2
$_com2 = "/dev/ttyS1" # e.g. "/dev/modem" or "/dev/cua1"
---------------------------------------------------------------------

The cpu setting may or may not make a difference, but it's what is in this box.

Emulated speaker allows speaker beeps to be played very well in this version.

Setting the terminal character set to IBM allows programs to display its graphics characters as in DOS/Win.

If your program needs to use the serial ports, configure those here. I've configured COM 2 in DOS which translates to /dev/ttyS1 in Linux.

I didn't do any special mouse configuration and found that it does work in DOS EDIT running in XDos (more on that below).

Top

Configuring a boot image

The Dosemu packages install a DOS hard disk image in /var/lib/dosemu/hdimage.first. By default Dosemu will use this image as its boot image and once started it becomes the C: drive in Dosemu. This default image is nice, but it has a couple drawbacks.

First, the DOS used to create the image and what is actually run is FreeDos and while that in itself isn't bad, it currently lacks a crucial feature I needed, supporting redirects.

Second, the EZEDIT.EXE editor supplied with Doseum has been determined not to meet the Debian Free Software Guidelines, DFSG, and has been removed from the Dosemu package.

So, there are some alternative ways of configuring Dosemu to take advantage of any DOS partitions in your system. One involves putting the needed DOS file in a directory and booting from that, while the other will boot directly from a DOS boot floppy or a bootable partition. Let's take a look at these in turn.

Top

Booting from a boot directory

Since FreeDos isn't far enough along to fit my needs, I decided to try booting from a directory. I used a custom made boot floppy of MS-DOS 6.22 for the source files. As a result, I did not do a complete install of MS-DOS. Beyond a few utilities, most of it is simply not used. With that in mind, here are the simple steps I used to get Dosemu booting from a directory in the Linux file system.

What we will do is create a directory for the files, copy the files into the directory, edit the Dosemu configuration file to point to the boot directory, and test to be sure it works.

Step 1.		Log in as root
Step 2.		cd /var/lib/dosemu
Step 3.		mkdir bootdir.first
Step 4.		cd bootdir.first

Now that the directory has been created we will copy the DOS files into the directory. Perhaps the best way to accomplish this is to use the mcopy program from the mtools (MS-DOS tools) package that allows certain DOS file actions from the shell. For this installation I'll be using the mcopy command to copy the files. I assume the files to be on a floppy disk.

Step 5.		mcopy a:\*.* .

I found that mcopy copied the normally hidden files IO.SYS and MSDOS.SYS without any special options. Now, this is optional, but I created a dos subdirectory and copied all the DOS files except IO.SYS, MSDOS.SYS, COMMAND.COM, CONFIG.SYS, and AUTOEXEC.BAT into the dos directory.

Now, the Dosemu utilities need to be installed in the bootdir.first hierarchy. The Debian distribution maps DOS drive M: to the Dosemu hdimage.first file so that the mtools utilities can operate on it as a DOS disk. To test this, try mdir m: and see if you get a directory listing. If this doesn't work, take a look at /etc/mtools.conf.

Step 6.		mkdir dosemu
Step 7.		cd dosemu
Step 8.		mcopy m:\*.* .

If all went well you should have a number of files in this directory. In particular we need the EMUFS.SYS and EXITEMU.COM files further down the road.

Lastly, we need to point Dosemu to the bootdir.first directory. Open /etc/dosemu/[dosemu.]conf in your favorite editor and make the following change:

$_hdimage = "bootdir.first" # list of hdimages under /var/lib/dosemu
                        # assigned in this order such as
                        # "hdimage_c hdimage_d hdimage_e"
                        # If the name begins with '/dev/', then partion
                        # access is done instead of virtual hdimage such as
                        # "/dev/hda1" or "/dev/hda1:ro" for readonly
                        # Currently mounted devices and swap are refused.
                        # Hdimages and devices may be mixed such as
                        # "hdimage_c /dev/hda1 /dev/hda3:ro"
                        # Note: 'wholedisk' is _not_ supported.

Reading this description you can see that a combination of image files and /dev/ partition points may be specified. However, I will show how you can use EMUFS.SYS to accomplish the same thing in CONFIG.SYS.

Now try to start Dosemu by typing dos at a shell prompt. Did it start okay? Are you able to change directory into dos? dosemu? If so, great! Now you can jump to the sections on config.sys and autoexec.bat. If not, check everything over for typos, etc. I know this works as it is how I am running Dosemu currently.

Top

Booting from a DOS file system

Another feature of Dosemu is its ability to boot from a bootable DOS partition or a bootable floppy disk. You can boot from a floppy by simply using the -A switch when starting dos at your shell prompt.

If you want to point Dosemu to a DOS partition on your hard disk(s), you will need to be sure the partition is not mounted and edit /etc/dosemu/[dosemu.]conf as follows:

$_hdimage = "/dev/hda1" # list of hdimages under /var/lib/dosemu
                        # assigned in this order such as
                        # "hdimage_c hdimage_d hdimage_e"
                        # If the name begins with '/dev/', then partion
                        # access is done instead of virtual hdimage such as
                        # "/dev/hda1" or "/dev/hda1:ro" for readonly
                        # Currently mounted devices and swap are refused.
                        # Hdimages and devices may be mixed such as
                        # "hdimage_c /dev/hda1 /dev/hda3:ro"
                        # Note: 'wholedisk' is _not_ supported.

Now you should be able to start dos and have it boot from your selected partition. Note! Be aware that if you are booting a Win95 partition, then you need to edit the MSDOS.SYS file to disable the launching of the GUI and the display of the splash logo as follows:

[Options]
BootGUI=0
.
.
.
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxs
Logo=0

I found those changes necessary to cleanly start MS-DOS 7.0 a.k.a. Win95 with Dosemu. However, I found the long file names of DOS 7 to not be supported under Dosemu, so I went back to using DOS 6.22 in the boot directory example above.

Top

Configuring DOS

Just like a bootable DOS disk, Dosemu utilizes CONFIG.SYS and AUTOEXEC.BAT to setup DOS. Note!If you don't want to disturb the CONFIG.SYS and AUTOEXEC.BAT files you can edit the following lines in /etc/dosemu/[dosemu.]conf:

$_emusys = ""           # empty or 3 char., config.sys   -> config.XXX          
$_emubat = ""           # empty or 3 char., autoexec.bat -> autoexec.XXX        
$_emuini = ""           # empty or 3 char., system.ini   -> system.XXX          

For example, you could use emu as the extension and keep your DOS and Dosemu files separate. This a useful feature as the HIMEM and EMM386 files will fail upon loading in Dosemu as it provides its own memory management.

Top

CONFIG.SYS

Here is what my current CONFIG.SYS looks like.

BUFFERS=15,0
FILES=30
DOS=HIGH
LASTDRIVE=C
FCBS=4,0
STACKS=9,256

rem this sets up the redirector to look at the Linux root directory.
rem this is probably not a good idea once you have dosemu installed
rem device=c:\emufs.sys /
device=c:\dosemu\emufs.sys /DOS/D/
device=c:\dosemu\emufs.sys /cdrom/
device=c:\dosemu\emufs.sys /opt/archive/programs/
device=c:\dosemu\emufs.sys /opt/archive/multimedia/
device=c:\dosemu\emufs.sys /home/nate/tmp/
device=c:\dosemu\ems.sys

The emufs.sys driver maps the Linux path you specify to a DOS drive, kind of like the DOS SUBST command. Note I mapped the CD-ROM which allows programs access to as under DOS. These mappings present the same drive structure as under DOS/Win except that drive C: is the /var/lib/dosemu/bootdir.first directory.

Top

AUTOEXEC.BAT

Here is my simple AUTOEXEC.BAT.

@echo off
set path=c:\;c:\dos;c:\dosemu;d:\ham\kagold;c:\zip;d:\ct
set CTPATH=D:\CT
set DIRCMD=/p /l
c:\dos\doskey
echo "Welcome to dosemu 1.0.1!"

I've had trouble getting the doskey program to start at DOS boot. For some reason it fails to load from AUTOEXEC.BAT, but works when typed from the DOS prompt. Weird...

These are the settings in the various files that allow me to run KaGold in X using the xdos program to start DOS and then I simply type kagold at the C:\> prompt to start it.

Top

4. XDos

Dosemu can be run from a virtual terminal on the console and will look just like a full screen DOS application. Alternatively, you can use the XDos program provided by the Dosemu package. If you installed Dosemu while still in the X Window environment, you'll want to restart X as two VGA font files are installed and X needs to reread its fonts.

Now that X has been restarted, you can start XDos from an XTerm or add it to your Window Manager's menu. Check to be sure everything starts normally and you should be able to run your DOS programs along side your X programs. Exceptions will likely be those programs that use the graphics hardware.

Since I use IceWm, there is an option you'll need to add to the winoptions so that functions are passed to the application, so, add the following line:

XDosEmu.fullKeys: 1

Top

5. Nits and errata

Okay, dosemu is evolving and some things may get fixed or broken between releases. Even though the stable branch is at version 1.0.1, there are quirks.

The cursor which should appear in the transmit text line at the bottom of the screen in KaGold is not there in XDos. It remains in the upper left hand corner of the screen. Running Dosemu on the console with KaGold causes the problem to disappear.

KaGold uses the PC speaker for Morse code announcements. Dosemu allows the characters to be heard without chopping or delays. However, if I start XDos from the IceWM menu, the sound is muted, while if I start XDos from an XTerm it works. Hmmmmm...

For what Dosemu attempts to do, it succeeds very well. While there are some similarities between DOS and Linux with regard to their directory structures, internally, things are as different as night and day. It is a credit to the Dosemu programmers that things work as well as they do. Many DOS programs expect to have complete control of the hardware they use. Meanwhile, Linux forces programs to share hardware resources and restricts direct hardware access. For what I wish to use it for, Dosemu is a great tool to have.

Top


Take me back to the Index!

The Linux Webring:
[ Prev | Next | Random | List | Home | Stats ]

Original content Copyright © 1997-2017 Nate Bargmann NØNB n0nb@n0nb.us
any other content copyright by respective author(s).

This page last modified
February 12, 2005
Valid XHTML 1.0! Valid CSS! Built with WSMake!