3 Ways You Can Run MS-DOS Games and Apps in Linux
MS-DOS (Microsoft Disk Operating System, often used interchangeably with “DOS”) is often linked with acute nostalgia. An old word processor, or maybe some DOS game that provided hours of pure, non-internet based entertainment. But what options do we have for igniting that old flame on Linux? Fortunately, quite a few!
FreeDOS is a complete, free, DOS-compatible operating system. Any program that works on MS-DOS should also run on FreeDOS. Along with being completely free to download and use, it can also be shared for anyone to enjoy!
MS-DOS was last released in 1994 which was nearly a quarter of a century ago. The current version of FreeDOS was released in December 2016. This indicates that the team is still keeping the project up to date, for the greater benefit of the human race.
You will need to download FreeDOS for use in our first two methods.
If your machine has some resources running spare Oracle’s VirtualBox is a great free bit of virtualization software . It allows installing virtual machines, DOS included, on your host computer. The only consideration being that your host’s resources will be shared with the virtualized machine, however, DOS is not going to be greedy.
You can download VirtualBox for your respective operating system and launch the installer through your GUI. If you prefer command line type:
sudo apt install virtualbox sudo apt install virtualbox-guest-dkms
Creating a virtual machine is very straightforward. After launching VirtualBox click on New. Give your machine a Name and leave the RAM set to 512MB. Select Create a virtual hard disk now, and ensure VHD is selected under Hard disk file type. Leave the disk set to Dynamically allocated and give it a size (1GB or 2GB is ample).
Click Create to end the wizard and create your machine.
Next click on Settings > Storage > Controller: IDE > Empty. In the Attributes section, there is a CD icon with a drop-down arrow that will allow you to browse for your FreeDOS ISO that was just downloaded. Click the OK button to end the wizard.
Now click on Start from the VirtualBox home screen to launch the FreeDOS installer!
Your install wizard should start, and through a series of easy selections, you can get FreeDOS installed. Select Install to hard disk, then accept the disclaimer followed by Partition drive C. Then like the old days we need to reboot for the partitions to take effect.
After a quick reboot select Install to hard disk followed by your preferred language and accept the disclaimer again. Select the option to Erase and format the drive, and finally the actual install can begin.
Once you’ve chosen your keyboard layout, select Full Installation followed by Yes – please install FreeDOS. Definitely one of the more polite install wizards. Your install should now commence.
After the install completes you need to remove the ISO from the virtual machine so that the machine boots directly into FreeDOS. From the same screen, we mounted the ISO above; you can unmount it before clicking reboot in the install wizard.
If you did all the above correctly, which I’m sure you did, the screen you’re now presented with should be a familiar site.
Transferring Files for Virtualbox
Before transferring files to your virtual machine, make sure to shut it down completely and for good measure, quit Virtualbox while you’re at it. The DOS shutdown command, in case you may have forgotten is in fact, shutdown.
FreeDOS’s method of mounting a drive didn’t seem to be too consistent. This was using libguesftfs-tools. The workaround was using the qemu-nbd command. To install this run the following in a terminal:
sudo apt install qemu
This installs QEMU along with its tools. Now run the following commands:
sudo modprobe nbd sudo qemu-nbd -c /dev/nbd0 <vhd-file>
By default, your VirtualBox directory should be in your home folder. Replace <vhd-file> in the command above with the path to your virtual machine. Now run the following command to mount the device:
sudo mount /dev/nbd0p1 /Path-of-your-choice
Now copy your favorite programs and files to your virtual machine. Once completed, unmount the virtual machine by running:
sudo umount /Path-of-your-choice sudo qemu-nbd -d /dev/nbd0
2. Quick EMUlator (QEMU)
Similar to Virtualbox, QEMU is an open source hypervisor that can run FreeDOS as a guest operating system. The steps are quite similar to the above method, however, it can be accomplished in just a few terminal commands. First, install QEMU by running:
sudo apt install qemu
Now we need to create a virtual hard drive to install FreeDOS. We can do this by typing:
qemu-img create dos.img 500M
Now we create our virtual machine in a single swoop by running:
qemu-system-i386 -cdrom FD12CD.iso -m 32 -hda dos.img -k en-us -rtc base=localtime -soundhw sb16,adlib -device cirrus-vga -boot order=d
There are quite a few parameters in the command. You’re basically:
- Selecting the FreeDOS ISO
- Setting the RAM size
- Selecting the virtual drive we created above
- Setting a keyboard layout
- Ensuring the time matches the host
- Choosing a common sound card
- Choosing a common graphics card
- Setting the boot order
FreeDOS should open in a new window and the install wizard in exactly the same way as the Virtualbox method above. After the install completes, we don’t require the ISO any longer and can boot directly into our installed image by running:
qemu-system-i386 -m 32 -hda dos.img -k en-us -rtc base=localtime -soundhw sb16,adlib -device cirrus-vga -boot order=c
Transferring Files for QEMU
Fortunately, this part is much simpler. All we need to do is create a folder and include that folder in our command we use to launch our QEMU FreeDOS machine. First close your QEMU window then type:
Now copy any files or folders you’d like to see in your virtual machine into the dosfiles folder. When you’re done, type:
qemu-system-i386 -m 16 -k en-us -rtc base=localtime -soundhw sb16,adlib -device cirrus-vga -display gtk -hda dos.img -drive file=fat:rw:dosfiles/ -boot order=c
As you can see the new part of the command is the -drive parameter which uses the dosfiles folder we created. It will also mount it to the next drive letter available, which is in our case D. If you’d like to see your dosfiles folder inside FreeDOS simply type:
Once again, DOS away to your heart’s content!
If all of this seems like a little overkill and you just want to run the odd game, and you’re more of a GUI person, then you could get DOSBox . By their own admission, DOSBox’s developers state: “DOSBox also comes with its own DOS-like command prompt. It is still quite rudimentary and lacks many of the features found in MS-DOS, but it is sufficient for installing and running most DOS games.”
So much of their emphasis has been placed on games, and if that’s all you require DOSBox may be enough. Before we begin, create a folder on your Linux machine and move your DOS programs in there. Our example uses /dosbox/dosfiles.
Now go to the Ubuntu Software and download the DOSBox emulator. Once you launch DOSBox you can mount the folder you just created above by typing the following in the DOSBox console:
mount c ~/dosbox/dosfiles C:
All your files should now be visible, your games playable, and the nostalgia kicking in!
You Can Still Run DOS!
Whether you like it or not, MS-DOS has been a huge part of the computing world. Many of the games we know and love stemmed from the MS-DOS glory days. You may be surprised to know that many companies still use MS-DOS programs to run their entire businesses. The good news is that Linux offers many options for making MS-DOS happen as we’ve demonstrated.
Don’t be limited to MS-DOS, either. Other classic operating systems can be installed or emulated on Linux .
What are your favorite DOS games? How do you run DOS on Linux? Do you think we’ll ever be rid of DOS? Let us know in the comments below!