How-To: Teach Linux To Do Windows, Part 2

In Part Two, we turn our attention to Win4Lin, software that helps you migrate to Linux without leaving your Windows apps behind.

October 4, 2004

20 Min Read
NetworkComputing logo in a gray background | NetworkComputing

Last week, in Part One of this Recipe, I showed you how to install a Linux distribution so you can still run Windows applications. This week, in Part Two, let's turn our attention to Win4Lin. This is software that helps you migrate to Linux without leaving your Windows applications behind.

To get the most from this Recipe, read Part One first. Also, you must have Linux running on a system before you can install Win4Lin. Assuming you've done both, let's jump in.

The following is a rough summary of what's described in the Win4Lin docs. This is intended to give you an idea of what you are doing; for more precise information, read the manual. Also, if you are reading the manual from Acrobat for Linux (as you should be), don't worry about starting X-Windows; it's already up.

Win4Lin Installation

I. CD Version:

  1. Get your Windows installation CD and the unlock code ready.

  2. Put the Win4Lin CD in the computer's drive, then open it from Linux. (The specifics depend on your Linux distribution.) Open the installation manual PDF from Adobe Acrobat on your Linux desktop.

  3. Do whatever the prompts tell you to do. Anything you don't understand, you should be able to get from the installation manual or from this article.

II. Downloadable version:

  1. Get your Windows installation CD or boot floppy, and the unlock code, ready.

  2. Open your Web browser from Linux, and go to the Netraverse site. Buy a registration code for $90.

  3. Create a directory for the installer. /win4lin-install is a good name for it.

  4. Download the installation PDF. Open the PDF file on your Linux desktop using the Adobe Acrobat reader.

  5. Download the netraverse_installer.tgz Tar is a *nix specific archiving format that collects a group of files into a single archive file for easier downloading/installation, gz is a compression format; the combination acts like the DOS version of PKZIP set as

    pkunzip -r archive.zip filenames

    Note: "r" stands for recursively, which in this context means: Collect all the files by directory tree and compress the tree for decompression / dearchving into a directory tree identical to the old one with all files where they should be when the dearchiving process is complete. However, PKZIP type zipfiles are not compatible with the *nix-specific tar.gz (called .tgz here) format.

    The *nix tar command is used for both compression/archiving and decompression/dearchiving.cd to the directory you created and dearchive it by typing:

    tar xzvf netraverse_installer.tgz

  6. Follow the instructions in the .PDF exactly, including installation of Windows when the installer software indicates it's ready.

If all goes well, your installation is as simple as that.Below is the Win4Lin installation screen showing where you have to choose to download the files you will need to complete the Win4Lin installation.


Unless you already know you have the packages available (e.g., on your CD) and current, click the odd looking checkbox where the arrow points and make sure it is active, as shown below.


The installer first checks to see if the installer itself is current, then it asks whether or not the user wants to download the files required to install Win4Lin. Select Next to download the files. You will see two progress bars as illustrated in the image, one for the Win4Lin file, the second for the kernel if you need to install one. The first file is Win4Lin, about 2 MB; the second is around 16 MB.

If the download is interrupted for any reason, then the installer will crash without warning or visible onscreen indication. If the modem lights aren't flashing and/or the installer progress bar doesn't move after a few minutes, log out of the system to the login prompt and restart it. If you know how to use the ps and kill commands, find the installer process and kill -9 it instead.

Once you're back up, reconnect to your ISP and restart the installer. The installer will check the files, finish downloading Win4lin, and start downloading the modified kernel, if required.

Once the Win4Lin software is installed, you will be prompted to perform the steps required to install Windows. Once the Windows files are loaded, the Windows installation process will take place as you remember it, only faster. The installation process thinks it is installing on a virtual computer and knows nothing about Linux.Note: A printer should work fine from Windows/Win4Lin, assuming you already have the printer set up in Linux.

Connecting to the Internet via Win4Lin

Assuming you use the default network installation using Winsock 2 (strongly recommended), here's how to connect to the Internet via Win4Lin:

  1. Connect to your ISP using Network Device Control or (KPPP should work, but I never had occasion to try it, see the docs for information on it) whatever you were already using for network connection from your Linux installation.

  2. Open a Linux network client. (I usually open a Web browser. Mozilla is installed by default, I usually open Linux instead.)

  3. Open Windows in Win4Lin. Open any Windows network client. (in my case, usually mail and Usenet news)

At this point, you should be fully connected for either Windows or Linux network applications You can open and close your connection or Network Device Control as you please. If you reboot Windows, you'll need to reopen Network Device Control and open a Windows network client.

If You Can't Connect to the Net After InstallingConnecting to the Net should not be a problem for users running a 2.6.x kernel. Netraverse plans to make a modified 2.6.7 kernel that should fix the problems described below available shortly after this article is complete, perhaps even before you read this. If you don't have any problems, skip this section and go directly to "Now that you have Win4Lin installed" section below.

I. Fixing the dialer / network local connection:

When I tried Network Device Control (also connects to Ethernet LANs, VPNs, etc.) it refused to open. Here is what Netraverse recommended doing about this problem, which appears to be due to configuration errors in the Win4Lin software installation:

Network Device Control patch

  1. su root

    password:

    nano /usr/share/system-config-network/netconfpkg/NC_functions.py

  2. Change line 54 from:

    (ver, rel) = release.split("-")to:

    (ver, rel) = release.split("-", 1)

    Make sure that the indents are the same; simply add a ,1 right before the ) at the end.

    After you make the change, save the file and exit. You should now be able to run the network control panel application.

    This made it possible for me to access my local modem connection so I could dial up my ISP. But my mail/Web/Usenet applications still couldn't connect to the Net.

II. Getting connected to the Internet:

Here is the Win4Lin network driver patch:

  1. Exit any Win4Lin sessions

  2. Log in as root.

  3. Open the file /etc/default/merge in your favorite text editor:

    nano /etc/default/merge

  4. Replace the line that reads:

    MERGE_VNET_IFNAME=autowith:

    MERGE_VNET_IFNAME=lo

  5. Save and exit.

  6. Start Win4Lin service as follows:

    /etc/rc.d/init.d/Win4Lin restart

  7. Log out from root. Log back in as the user who runs Win4Lin, and launch 'win.'

(Thanks to the Netraverse support people and their director of software engineering for providing these patches.)

Now That You Have Win4Lin Installed...

Here's how to move your files to your Linux installation. The approach is simply to copy the directory tree into the Win4Lin/Windows environment.Start by changing to the directory in which your Windows drive is mounted. Note that "windows" here means whatever you decided to call your Windows drive.

cd /mnt/windows

For instance, use cp for copy:

[root@terrarium windows]# cp -r,reply=no [a-vA-Vx-zX-Z0-9]* /home/alizard/win

This instructed the computer to copy all the directories and subdirectories and files from the Windows to the win directory--which Win4Lin/Windows sees as the C: drive--except for ones starting with the letter W. You do NOT want to copy the Windows directory, Win4Lin requires a fresh installation of Windows.There is one problem with this, however. For reasons having to do with the way Linux treats the Windows file system as foreign, all files on the original file system belong to owner=root , group=root. That means that only the root owner can do anything with the files. You will not be running as root for anything but system administration operations.

One fix is to change the file ownership:

cd /home/username

chown -R username:username win

(chown means change ownership, *nix files have ownership metadata which governs access)And change the read/write/execute permissions:

chmod -R 755 win

To move the non-Windows files starting with either upper-case or lower-case W, use the superuser file manager: Start - System Tools - More System Tools > File Manager - Super User Mode . Highlight the directories and files you want to move and move them to /home/username/win .

Installation: Windows Applications Under Win4Lin

In general, installing Windows applications over Win4Lin is exactly like installing them in an ordinary Windows environment. However, moving your stuff into the Win4Lin environment will be more like moving into a new house than your previous experiences with system upgrades.In your previous upgrades from one version of Windows to another, you generally simply installed over previous Windows installations. The great majority of legacy applications worked fine and didn't need to be reinstalled.

But in a Win4Lin installation, all the Windows applications will have to be reinstalled with the exceptions described below. You will have to pick and choose what to install. You will have to choose how to define or redefine your new dataspace just as you would define / redefine your physical space when moving into a house.

I copied my entire Windows C: drive directory tree except for Windows over to the new Linux drive under the /win directory Linux creates. Applications are not automatically installed, though any application that is self-contained and doesn't need Windows Registry entries or DLLs that don't exist in C: > windows > system will run with a new Desktop pif shortcut. Quite a few utility programs fit this description.

Don't bother with third-party Windows file managers, as they don't work.

If you obtained a significant number of your Windows applications via download, install WinZip first so you can go to your download directory and unzip / install your applications.When installing Office 97, remember to use a custom installation and open Office Tools and uncheck Office Assistant. Unless you're in the small minority that likes Clippy.

Here are some screen shots illustrating my installation. The first shows my initial working environment with the default Win4Lin/Windows install, default KDE desktop, and multiple Windows programs running.


The next screen shot displays Corel Draw in operation:


Next, here's Microsoft Word at work.


Next, here's Paint Shop Pro shown in use:


The next screen shot shows Eudora working with my legacy Windows Eudora mailbox files. The ability to do this was one of my primary reasons for going with Win4Lin:


What is particularly significant about the above is that three out of the four programs shown do not work with Wine/Codeweavers Windows emulation.

Don't assume that you automatically need to reinstall all the old Windows applications from your old Windows environment. Remember, the idea is to learn Linux. So use Linux applications in preference to Windows applications whenever possible. Also, the more applications you can run from Linux, the more productive you are likely to be when the Windows part of the system is too busy executing operations to accept any input from you.

That said, your Windows OS will be quite a bit stabler than it used to be once you find a significant number of Linux replacements -- ideally, ports of your Windows software -- running in place of Windows applications.

Every application that is running as native Linux instead of in Windows is not consuming Windows resources. Having two dozen subwindows in Opera open doesn't destabilize Linux significantly. But not having it run in Windows stabilized the legacy OS quite a bit.If you've had your Windows environment for any length of time, you also have many desktop icons attached to programs or files/directories, but no idea exactly why you decided to put them there because you haven't used them in years. The next screen shot shows my old Windows desktop. See what I mean?


Like a move, this gives you a chance to leave behind a lot of accumulated dross. Install the handful of applications you really need immediately, along with a few files/folders relating to current projects, and install only what you need when you need it. Also, check for Linux applications first if you think you need to install a Linux application when time allows. There is also a good chance that many of the major applications you depend on will be ported or that Linux applications with acceptable functionality and legacy compatibility will appear. Your distribution probably has a whole lot of applications you haven't installed available for download and a setup for automatically downloading and installing them. Find out what it is, and learn how to use it.

Here are the main differences between Win4Lin/Windows and a native Windows installation:

  1. Win4Lin can't access your video accelerator chip yet. So video playback will be a lot more pixellated. (Remember to install DirectX 8.0 anyway.)

  2. The Windows file system is now a subset of the main Linux file system. What Linux sees as: /home/username/win is seen as C:%5C drive to Windows. If you need to use a Windows program to operate on files originated using Linux software, then the file will have to be placed into the Windows filesystem to allow a Windows program to have access to it. If you're inside the Windows environment, and accessing files from a "Open File" box or a DOS prompt, C: > path > filename.ext is still correct. If you want to access that file from a Linux application, it's /home/username/win/[path]/filename.ext , and note that backslash > directory indicators are forward slashes / in Linux.

  3. Anybody who has had a Windows environment for a few years has tuned it in all sorts of ways, from adding updated systems components to lots and lots of personal configuration settings. Your new Windows install is exactly that, a new install. You'll have to put many of these components back in over time and in many cases, you'll have to remember how you did made it work last time. The learning curve for Windows was very significant, too, it just happened so long ago that you've probably forgotten.

    The Linux GUI maps Control-Alt-Delete to logout/shutdown.The following will explain how to reclaim that keystroke combination for Win4Lin/Windows.


  4. Before you start using Win4Lin, go IMMEDIATELY to Start > Preferences > Control Center > Regional & Accessibility > Keyboard Shortcuts > Logout > custom (button). Click on the button, which will say Cntr-Alt-Del. Then hit Alt-Delete. You won't be able to function in Windows without the ability to check or shut down individual crashed applications.

  5. The best Windows file manager for the Win4Lin environment appears to be...Windows Explorer. My favorite Windows third-party file managers, X-Files and PowerDesk, take forever to load and tend to use most/all CPU resources when doing this. Windows Explorer comes right up.

  6. Reinstall your firewall before you go online for the first time. I am still running ZoneAlarm. Reinstall whatever security apps you use in the Windows environment. Your virus scanner may work a bit differently than usual , as file formats have been changed and some forms of malware written for DOS/Windows can not work in the Win4Lin/Windows environment.

  7. Most of the time, Windows operations seem to run a bit slower than they do on a comparable machine. However, this makes a difference to me because I've got an older machine with a Duron 900.

  8. Individual apps appear to consume fewer system resources than they did under a pure Windows system. This is especially evident when printing. Memory seems to leak more slowly as well. While you probably can't see it in the screen shot below, my Windows session has been running for hours, I've got lots of high-resource demand applications running, and the Resource Meter in the Systray is at 23 percent. Perhaps more important, the more high-resource-demand applications one can run outside Windows, the more stable it will be. So my web browsers (Opera and sometimes Mozilla) now run on the Linux side. Crashes can be just as catastrophic, so remember to back up. However you can keep right on working in Linux when this happens. Your ability to restore your /mnt/(backup_drive_name)/home/(username)/win/windows installation can be a lifesaver just as it is for a standard Windows installation.

    I've used 98lite for years to remove Microsoft Internet Explorer from my Windows environment for stability and security reasons. The arguments for and against running IE as part of a Windows installation apply to running one in Win4Lin, too. While the 98lite for extracting Internet Explorer from Windows does not work because it calls for a DOS video type not supported in Win4Lin, the IEradicator script for removing IE does. If you choose to do this, you can get the MS installer script here.

Here is a screen shot of the new Win4Lin/Windows desktop running over Linux shortly after installation:


Backups

Windows backups do not work with the Win4Lin environment. Whatever Windows on Win4Lin thinks, you no longer have access to a DOS/Windows file system. The good news is, neither do viruses.

While one can transfer the data from your Linux drive to a mirror drive by simply doing a cp operation, to make a bootable drive clone as you can a Windows drive is a far more complex problem. One would automatically have to create a set of drive partitions identical to that of the drive to be cloned, then stuff the right data into each partition. There are packages that will copy everything, including partitions, but I did not test them for this Recipe.I'm also looking for a Linux equivalent of ZipBackup to allow converting the contents of my Linux drive to archivally compressed DVD-R size chunks.

To back up to a blank hard drive available from Linux, first:

cd /mnt

make the new directory to mount the backup drive to:

mkdir linux_backupfollow these instructions from About.com from Steps 1 to 5.

For this, you only need a single Linux partition. To mount the backup drive once it's formatted:

mount - t ext2 /dev/hdd1 /mnt/linux_backup

linux_backup means whatever you thought was a good volume name for your backup drive. The rest of the About.com article isn't relevant, since you're creating a data drive, not a boot drive. If you are using ext3 or other kind of filesystem instead of ext2, type in the right filesystem descriptor instead.

Get help with respect to the fdisk part if you have any doubts of your being able to carry it through once you've gotten to the menu part of fdisk.cp is like the DOS copy command:

cp -au --reply=yes /bin /dev /home /lib /misc /opt /root /selinux /tmp /var /boot /etc /initrd /lost found /proc /sbin /sys /usr /mnt/linux_backup

cp is in source-destination format. Everything before the /new-disk is source. So the command means to copy updated files recursively (down the directory tree) from your working Linux drive to the backup drive linux_backup.mounted temporarily as a directory in the Linux filesystem and write new ones where they don't already exist.

Note: /win4lin-download is where I put the Netraverse downloads. The CD may install it somewhere else; if that happens, either change /win4lin-download to fit, or, if it's a subdirectory of any of the listed directories, omit it.

To restore an entire drive, install or reinstall Linux to a drive, mount your backup drive as described above, cd to it, and then:cp -au --reply=yes /bin /dev /home /lib /misc /opt /root /selinux /tmp /var /boot /etc /initrd /lost found /proc /sbin /sys /usr

/

/ is itself a directory name, of the top-level directory. The command says take the listed main directories from the main directory tree on the linux backup drive -- not mentioned because you are doing this from that drive -- to the directory / on your primary Linux drive.

The list between - au and / should include all the top-level directories of your hard drive except /proc and /mnt.

, /proc contains temporary processes, and /mnt contains the drives that are temporarily mounted/unmounted, including your backup drive.You don't want to copy a hard drive into itself. This is why you leave /mnt out of the restore command.

Remaining Problems

These are the most important problems I've found with this combination as installed:

  • The installer needs to be stabilized so it can tolerate a disconnection from the dialup or network without crashing. The installer should also provide a definite indication to the user that the file transfer isn't happening.

  • The installer UI should make it clearer what options are enabled or disabled. A checkbox with a big X in it may be prosaic, but it is clear and unambiguous.

  • Do all the GUI programs required to configure a Linux install have to be scattered between System Tools, System Settings, and Preferences submenus? This, however, is a problem with Fedora Core 2 and other Linux distributions, not specifically with Win4Lin. But this isn't really much worse than in Windows, a lot of the Windows learning curve consists of figuring out how to find the menus.

  • Notice the number of configuration files one has to open from a command-line text editor a terminal session? People like us who have to be early adopters are used to be stuff that's rough around the edges. But before this becomes a mass-market product, these problems need to be fixed, so our customers will come to us when the GUI applications break, not because they need help with routine installation.

ConclusionsBelow, a screen shot showing what my Linux / Win4Lin desktop looks like now. Eye candy aside, this is more functional than the Windows Desktop it replaces. My most used applications are in the taskbar, but only the needed ones are started at startup. The taskbar program tabs stay the same size regardless of the number of GUI programs running. The clock is a lot more visible than it used to be.


Once the setup is done, it all works very well. I think it was completely worth the effort. While dialing in this system was not easy, now I no longer have to devote the average of half an hour a day to rebooting or changing Windows system settings to keep it operational. Nor do I have to put up with the intense annoyance at the inability to do anything useful while putting in this penalty time.

If you try this, you should have a far easier time than I did, since you'll have this Recipe to refer to. The problems discussed here will be fixed over time. Meantime, this article is written for those of us who will actually have to know how Linux desktops work, including the guts which our users will come to us for help with when point-and-click stops working -- just as they do with Windows now.

Sidebar: Where To Go If You Run Into Trouble

  • Check the vendor site first. The answer may already be in a searchable KnowledgeBase, FAQ, or other documentation on the site.

  • Google is your friend.

  • There is much useful documentation available at the Linux Documentation Project. Also check out About.com.

  • Post questions in places like Linux Questions, The Fedora Forum (if you use Fedora Core), or Usenet groups like news://comp.os.linux or subgroups. There are many Linux Web forums and vendor-specific mailing lists. Google can help you find them, too.

  • Ask a knowledgeable friend or local Linux User Group (LUG). There's a list of LUGs here.

  • If you bought a distribution or application that includes support, call the vendor. Win4Lin includes support. But first make sure your problem is with Win4Lin, not Windows, your Windows application, or the Linux distribution underlying Win4Lin.

  • Check vendor and open-source developer sites for user and developer forums. Your question may have already been answered. If not, post a new question.

  • Visit TechBuilder's Recipe Forum, and post a question for your fellow system builders.

This is Part Two of a two-part Recipe. View Part One here.A. LIZARD is an Internet consultant in the San Francisco Bay Area who has written for technology magazines and Web sites since 1987. He thanks Maxtor and Netraverse for contributing a pair of hard drives and a review copy of Win4Lin, respectively, for use in this Recipe.

Discuss this Recipe with other system builders in the TechBuilder Recipe Forum.

SUBSCRIBE TO OUR NEWSLETTER
Stay informed! Sign up to get expert advice and insight delivered direct to your inbox

You May Also Like


More Insights