Running Linux In A DOS Partition
Turn That Old 486 Into A Internet Server AND A Linux Development system -- Also, The JOE Editor And Solving DNS Woes
By Trevor Marshall
June 14, 1999
In my first column, I started to describe some of the problems you will have to overcome in setting up that old 486 box as a Linux-based Internet server and gateway. Not the least of these problems is what flavor (distribution) of Linux to choose and how to boot the Linux on your machine for the first time.
The new GUI-based Linux distributions are very comprehensive, but they always leave me uneasy. The installer does a superb job working its magic, but I can't help but worry about the level of trust I had when I allowed it to take control of my hard disk.
It's like jumping into a swimming pool hoping that you will be able to swim. What if the Linux doesn't boot? Will the 486 have enough power to run both the Linux and the GUI? What if I can't understand what the installer did?
What low-level OS tools will it install for me? What if I need to change something subtle in the configuration? Granted, there are versions of Linux small enough to fit on a single bootable floppy disk. But these are very limited, with only a bare minimum of utilities, no compilers, and usually no manuals.
I will describe a small Linux in a future column, but at this point it makes sense to go for a more comprehensive Linux implementation since the 486 has enough power to run Linux quite well, and, unless you are trying to run a Secure Apache-SSL Server (SSL uses a lot of floating point), there is going to be plenty of CPU left over to run a fairly comprehensive command-line-based development system. (I.e., not KDE, GNOME, etc.)
For now, I'm going to stick with my preferred "runs on the existing DOS partition" constraint.
There is a little-known distribution of Linux (Zipslack) that will
install itself onto a DOS partition and co-exist gracefully with DOS.
It contains full C, C++, and Perl development environments in addition to a full set of documentation, but doesn't have any unneeded fluff. Before all the Linux purists tear me apart, I must acknowledge that this approach will not give you a high-performance Linux implementation. The DOS filesystem is slow. It is not as rugged as a Linux filesystem. But it does work. And it works well. I merely copied the .ZIP to my old 486, unzipped it, edited and executed LINUX.BAT, and up came Slackware Linux v2.2
When you feel comfortable with your configuration, there is documentation in the ZIP that explains how to partition the disk so it also has a Linux partition, and then migrate the existing Linux or install some other distribution, e.g. Caldera, Debian, Red Hat, Slackware.
Tweaking is almost too easy. The configuration files in /etc/rc.d/ can all be edited from DOS, so if you change something that causes a fatal error, you can reboot under DOS and change it back again. Even if the Linux itself refuses to boot, you can see the whole Linux directory structure under DOS and easily navigate to the correct directory and edit the file you broke.
You can download Zipslack.zip (36 meg) from ftp://sunsite.unc.edu/pub/Linux/
distributions/slackware/zipslack/ if you cannot find it on a nearby Linux distribution CD.
Copy it into the root of your DOS disk. Don't bother about the other files in the Zipslack distribution directory. You don't need them.
Don't use PKUNZIP to unpack it. PKUNZIP fails to handle large files. There is a copy of a suitable UNZIP.EXE on my system that you can download. It will take at least an hour to unzip all the files. It doesn't matter how fast your CPU is, the hour is all taken storing the Linux files on your DOS filesystem. Go make a cup of coffee or play Tetris on another machine.
UNZIP will create a directory called LINUX on your hard disk. Go into that directory with any DOS editor and edit the file called LINUX.BAT. You need to add a REMark in front of the configuration line saying that it will boot from a ZIP device and remove the REM from the start of the following line
REM /linux/loadlin /linux/vmlinuz root=/dev/hda1 rw
in order to tell the Linux Loadlin loader that it will look for the kernel on your default DOS hard disk.
Then give the command
linux
and the batch file will execute, booting up Linux and dropping you to the command prompt. Log in as root, there is no password. Set a password immediately using passwd root.
Your first task, getting Linux running, has been completed.
Now you can start to customize the configuration bootup files. The commands
cd /etc/rc.d/ ls -al
will get you a listing of rc.inet1 and the other principal network configuration files. Also look carefully at the /etc/ directory. When you are satisfied, you can find your way around, then shutdown the system with
shutdown -h now
and hit the reset button to reboot DOS. When you look at the DOS directory structure you will find
/LINUX/ETC/RC.D/RC_INET1.{_G
the same rc.inet1 file, but with a DOS compatible name that is not too garbled. I am amazed by the way that the Loadlin developers have integrated the two file systems. Sure, you have to use your imagination a little, but isn't that why you are reading BYTE.COM ?
Last month I mentioned that I would look around for sites
that would act as primary and secondary DNS nameservers. Dave Blankenship left a message on my Bulletin Board pointing out that www.granitecanyon.com offered free DNS, both primary and secondary. I have since moved all my own domains to granitecanyon, but I recommend that you do not use ns2 on its own. If you set granitecanyon to only be a secondary server, ns1 is a more reliable secondary than ns2.
There have also been questions left on my Bulletin Board about commercial, pre-configured, dial-up Linux gateways. I briefly tried out the package from www.e- smith.net and it worked fine with my dialup to Earthlink. Moshe Bar is working on testing a number of similar packages, so keep an eye on his column if you are looking to buy support for a gateway that is easy and quick to set up.
JOE, My Preferred Linux Text Editor
Several years ago, after I was hurling obscenities at vi for munging yet another of my files, Dion Whittaker introduced me to JOE. JOE is a superb ascii text editor for Unix written by Joseph Allen. It has all the power of vi but uses the command sequences of Wordstar and the Turbo Tools with which I have become so familar over the years (I just love hitting that control-Y keystroke). It is somewhat like Emacs, but doesn't have a steep learning curve. Lazy is my middle name, so I immediately adopted JOE and have never looked back. It is lightning-fast, even over a Telnet connection. You can get the Linux distribution of Joe from a variety of places, including http://trevormarshall.com/joe2.8.tar.Z.
I have put together a bare-bones Linux version of JOE just in case you don't have a means to compile the tar archive. It is at http://trevormarshall.com/joe_bare.zip and it contains just the executable and configuration files.
Unzip it in your DOS partition and copy the files to their correct locations under Linux. The JOE file names are fully compatible between the DOS and Linux partitions.
JOE under DOS - fewer unhappy returns
Some of you might have been wondering why I was saying that it was easy to edit the Linux configurations under DOS. After all, most DOS editors stick carriage returns into the ASCII files rather than just using linefeeds, and this causes Linux to complain most vigorously. Again, Joe comes to the rescue because there is a DOS version at http://trevormarshall.com/joe2x2.zip
that does not have this nasty habit. With JOE, you can edit the configuration files under DOS or Linux, it doesn't matter. Next Time
In the next column, we will start working through Linux's configuration files and talk about the similarities and differences between the various major flavors of the OS.
Trevor Marshall is an engineering management consultant, with interests ranging from RF and Hardware design to Linux internals, Internet infrastructure, MPEG, and Digital Video. He started his career in the '70s, designing the Maplin Electronic Music Synthesizers. When the Microcomputer came along, he got sidetracked into computer software, programming the 2650, 8080, Z80, Z8000, 8048, 8306, 6805, 80x86, and Power PC families. Along the way, he also picked up a little expertise in RF system design, biomedical engineering, and the printing industry. His web site is www.trevormarshall.com.
Page 1 of 1