Can I Run DOS Programs Under Linux?
Setting Up DOSemu
Setting up DOSemu is not hard, but it does require a few steps to get a fully functioning DOS session up and running. Because the software is being actively developed and improved, I strongly recommend that you get the latest version available from the DOSemu Web site at http://www.dosemu.org. After downloading the RPM file for DOSemu, issue this command while logged in as root:
The package is now installed, but we need to tweak the DOSemu configuration file before using it. Edit the /etc/dosemu.conf file and modify the $_hdimage entry so that it reads as follows:
$_hdimage = "hdimage.test /dev/hda1"
The hdimage.test file resides in your /var/lib/dosemu directory and is a hard disk image--a special Linux file that contains a complete DOS system. The line you just modifed tells DOSemu to treat the hdimage.test file as the C drive when DOSemu is started. This C drive is not your beloved DOS partition; it's a simulated bootable hard-disk partition containing the FreeDOS operating system¾a freeware clone of MS-DOS. The /dev/hda1 portion of the modified line tells DOSemu to treat your real DOS partition as the next drive letter, or the D drive. (You can boot DOSemu directly from your real DOS partition, but we'll address that later.)
Starting a DOSemu Session
Before starting a DOSemu session, which will be accessing /dev/hda1 (your MS-DOS partition), it's very important to unmount the partition. Otherwise, the DOS virtual machine and your Linux system might be trying to write to the disk simultaneously, with potentially disastrous results. To unmount the partition, issue this command:
Now we're ready to fire up DOSemu. Issue the command shown here from your Linux command prompt:
In a few seconds, you should see a DOS session start, and the familiar C:> prompt will appear. Voila--you're running DOS under Linux! Issue the dir command and have a look at the results. Don't panic if the listing of files is unfamiliar. Remember--what you have here is a special C drive with the FreeDOS files that DOSemu will use to boot up.
FreeDOS in a DOSemu session.
You can switch to your D drive (your DOS partition) by issuing the D: command and then change directories, view files, execute programs, and so on. Because we booted from the C drive with FreeDOS, the config.sys and autoexec.bat files from your DOS partition were not executed. This means that your normal DOS PATH variable will not be set, so you may have to use cd to get to the appropriate directory before running a program.
Exiting from DOSemu
You can exit the DOSemu session by entering the following command at your C: prompt (note that it won't work if you are at the D: prompt):
If that doesn't work, or if your DOSemu session is frozen, log in from another virtual console and then use the ps and kill commands to find and terminate the DOSemu task. (See Chapter 3, "Living in a Shell," for details on killing an active task.)
The command "killall dosemu" will also work without having to do a ps.SmoogeIt's a good idea to copy the exitemu.com file from the C drive to the D drive so you can exit from DOSemu cleanly if you later decide to run DOSemu directly from your "real" DOS partition. To do so, enter this command from the C: prompt:
copy C:\exitemu D:\
Starting DOSemu with "Real" DOS
If any of your DOS programs don't run correctly as a result of finding themselves on a D drive instead of a C drive, you can start a DOSemu session by booting your "real" DOS partition. To do so, edit the /etc/dosemu.conf file and modify the $_hdimage entry so that it reads like this:
$_hdimage = "/dev/hda1"
This tells DOSemu to treat your DOS partition as the C drive and to boot the MS-DOS operating system instead of FreeDOS. Upon restarting DOSemu, MS-DOS will try to start Windows 95/98, if you have it installed. This will surely lock up your machine, because DOSemu does not support Microsoft Windows. To avoid this problem, press the F8 key as soon as the message "Starting MS-DOS" appears and then select option 6, Command Prompt Only, to boot MS-DOS without starting Windows.
Additional DOSemu Configuration
By default, DOSemu starts with text-only video support and no support for serial ports. So if you want to run any graphics programs or use the mouse or modem, exit DOSemu and continue.
To enable support for graphics or the mouse or modem, edit the /etc/dosemu.conf file as described here. I recommend that you configure only the features you really need. Take these steps one at a time and test each new feature separately by starting DOSemu. That way, if a problem arises, you'll know which feature caused it, and you can go back to the /etc/dosemu.conf file and disable it or try an alternative.
Setting Up VGA Graphics
Look for the $_graphics and $_videoportaccess entries and change them to read as follows:
$_graphics = (1)
$_videoportaccess = (1)
Start DOSemu and test your graphics program. If it doesn't work, see the copious comments in the /etc/dosemu.conf file or at the DOSemu Web site for other things to try.
Setting Up Mouse Support
Look for the $_com1, $mouse, and $mouse_dev entries and change them as follows:
$_com1 = "/dev/mouse"
$_mouse = "microsoft"
$_mouse_dev = "/dev/mouse"
If your mouse is not on COM1, select the $comX entry corresponding to your mouse port. Set the $_mouse value according to the type of mouse you have. Most systems use a Microsoft mouse, but this value can be microsoft, mousesystems, logitech, mmseries, mouseman, hitachi, busmouse, or ps2. Start DOSemu and test your mouse application. Again, if you have problems getting the mouse to work, refer to the /etc/dosemu.conf file or the DOSemu Web site¾http://www.dosemu.org/.
Setting Up Modem Support
Look for the $_com2 entry and change it to read as follows:
$_com2 = "/dev/modem"
If your modem is not on COM2, select the $comX entry corresponding to your modem port. Start DOSemu and test your modem application.
Comments - most recent first
(Please feel free to answer questions posted by others!)
I have Linux Mint 11. I put DOS on through Synaptic. Didn't work. I don't know why. So then I removed that through a terminal. Then I had a CD with DOS and put it on my computer in that fashion. Thought it was loaded properly. I typed dosemu. Then I pressed enter. Here's the error code:
[: 373: -: unexpected operator
In file included from built-in global.conf:828
from built-in global.conf:686
Error in built-in global.conf: (line 825) Disk-device/file /var/lib/dosemu/drives/d doesn't exit.
1 error(s) detected while parsing the configuration-file.
So it doesn't open. Any ideas what I have done incorrectly?
I am a Cameroonian and I live in Cameroon.
NO SPAM! If you post garbage, it will be deleted, and you will be banned.
Copyright © by -
All rights reserved - Redistribution is allowed only with permission.