Install GNU/Linux without any CD, floppy, USB-key, nor any other removable media

A chinese translation is (currently) located here: http://my.opera.com/hxf_prc/homes/gnu/win2linstall-cn.html

The challenge
You are in front of a working, networked machine and want to install your favorite GNU/Linux distribution on it. Unfortunately, you don't have any CD, floppy, USB-key, no nothing at hand. Fortunately, you don't need any one of them.
The trick
Copy the (small) Linux installer on a hard disk and run it from your previous operating system. Finish using the network. That's all. In some cases you can substitute the network by a (big) hard disk if your network is not good.
The even better trick
Jordi Massaguer i Pla is developing instlux , a sofware automating most of the steps below. Instead of hunting all across the internet for a bunch of files, now you just have to download instlux, run it and reboot. It's currently working for OpenSUSE 10 and Ubuntu breezy 5.X. Since you are now rushing to instlux to escape the reading of this boring document, let me just remind you to backup your data before doing anything!
Note:
This document is focused on Microsoft Windows as the pre-existing operating system, but many things still apply if you start from something else. You'll just have to "translate" a bit. As a bonus, the "translation" will probably be shorter and easier. You may even find some bits of this document useful if you start with no pre-existing operating system at all and want to boot your machine from the network.
Note 2:
This document is (too) long because it covers many different cases/configurations/linux distributions. But most people will only need to read not even 1/3 of it to get the job done. Intensive use of hyper-links and tables of contents is recommended.

Official location: http://marc.herbert.free.fr/linux/win2linstall.html

Life of a Linux installer

Almost all Linux installers I know work the same. They use one of the numerous ways your PC has available to boot to load in memory two files: a Linux kernel, and an initial (root) filesystem containing the minimal files needed for a tiny GNU/Linux system and the actual installer program. This very first filesystem is also located in memory (RAM) thanks to a technique called... "ramdisk".

The Linux kernel and the INITial RamDisk (initrd) are typically pulled from the CD or the floppys used to boot. But they are also two relatively small files easy to download and save on the hard disk of your networked PC.

After booting, the task of the distribution installer is basically to put a whole lot of software packages on your hard disk. These packages are also typically pulled from a CD or DVD, but if you have a high speed network connection, it is much more convenient and sometimes even faster to download them directly from the network. Moreover, this way you download only the packages you need, as opposed to downloading a whole CD image (so it may be even faster).

So, if your machine is running Windows and connected to the some GNU/Linux distribution mirror, and thanks to a tool called Loadlin or GRUB for NT you don't need any removable media to install Linux; you can do it without moving your hands off the keyboard. Why did not you hear this before? Because the procedure detailed below is a bit more complex than "stick the CD in and press the button", so it's too complex for basic users. But faster and more convenient in many cases. There is absolutely nothing revolutionary below, actually many hackers know this already. It is even documented in the dark corners of the installation manual of some distributions. But since you absolutely not need to be a hacker to achieve this, I wrote this document to help any sysadmin or advanced user do it quickly and easily.

Why do this ?

Preparing & downloading

The installers of some distributions provide nice graphical disk partitioning utilities, but you may prefer to prepare your disk earlier using some Windows-based disk manager. It's up to you and your distro.

Warning:
Partitioning is really a risky operation. You really should backup all your data off your hard disk before that. This warning is off-topic (you have to re-partition your disk whatever your install media is), but was added because of its importance and by "popular demand". In particular, there has been recently an infamous partitioning bug making the partition table incorrect and thus preventing you to boot Windows afterwards. This bug is due to an incompatibility between the linux kernel version 2.6 and the partitioning tool "parted" or similar, versions less than 1.6.12. Have a look at this FAQ for more information. From there: "Known major distributions having this problem are but not limited to Mandrake 10, SUSE 9.1, Fedora 2."

Now the very first thing you need to look for and download are the Linux kernel and initrd (INITial RamDisk) files of the target distribution. Finding these files may take a while, since the documentation usually insists that you use a CD or floppy image instead (that's one of the reason I wrote this page). I have compiled this information for most major distributions below.

Then you need to find out the distribution-specific, tuning options that the bootloader (GRUB or Loadlin, see next section) will pass to the kernel at boot time. These options are needed to tune the kernel or the installation process to your machine or to your taste. Sometimes none is required, sometimes the kernel will not boot your machine or the installer will not run without some of them. There is usually some isolinux.cfg text file located next to the kernel and initrd files. Open it: the tuning options are inside. If you have some odd hardware that linux has a hard time to detect/initialize, you may need to add a few tuning options specific to your machine (whether you install with a removable or not). Check the BootPrompt HOWTO about these issues.

Now have a look at the distribution specifics section below to gather the relevant information and come back here.

Loadlin or GRUB for NT?

The main technical issue is booting the first Linux kernel and its initial ramdisk filesystem. This section is mostly oriented towards Windows users, but can be easily simplified for other operating systems.

If you use Windows95 or 98 you are lucky because you can run DOS, and there is a simple DOS tool able to boot Linux and the installer without even rebooting the hardware. This tool is Loadlin, and you should now move to the Loadlin section.

If you use Windows NT/2000/XP, Loadlin will not work because you don't have DOS, and Windows will not let Loadlin take full control of the system. One possibility was to make a quick installation of FreeDOS and launch Loadlin from there. It has been displaced by the brand new and much more convenient GRUB for NT.

Windows ME is unfortunately a very special case. It has DOS and thus the ability to run Loadlin (in the so-called "real-mode"), but Microsoft has decided to hide it to "motivate" programmers to give it up. So you can either try to adapt the Windows NT/2000/XP instructions (using GRUB for DOS instead of GRUB for NT), or you can first install FreeDOS to run Loadlin, but the easiest way is probably to "unhide" DOS and get access to real-mode again thanks to some unofficial patch like the one from MFD, Dosfix or Dew associates. Search google for more. Disclaimer: I know absolutely nothing about these patches.

GRUB for NT

The new GRUB for NTLDR (NT LoaDeR) allows you to run the powerful GNU GRUB bootloader directly from Windows NT/2000/XP in just two easy steps. Thanks to Wang Kebo for the tip, and congratulations to "Tinybit" for making GRUB runnable directly from NT/2000/XP. This software is currently under development so be careful, make backups [b], and keep in mind that some documentations (including this one) may be slightly out-of-date. If GRUB for NT does not work with your hardware, you can try the old (and long) FreeDOS technique, then follow the Loadlin instructions.

Actually GRUB for NTLDR can be found inside the larger GRUB_for_DOS software package, so download it and unzip it. There are only two files relevant to Windows NT/2000/XP inside the package: grldr and a sample boot\grub\menu.lst; the rest of the files is for DOS and useless for us. If the server is not responding (quite often), you can try to go the (not much more responsive) GRUB for DOS scratchpad. This one usually holds a recent, bare grldr file.

A last alternative is to connect to sourceforge servers to download WINGRUB, a graphical interface for GRUB for DOS. You don't have to use this WINGRUB graphical interface, you can just extract and use the grub\grldr_pNN file found inside its package.

To run GRUB from Windows' bootloader, copy grldr to the directory C:\. Append the following line to your C:\boot.ini file:

C:\grldr="Start GRUB"

Oh wait, by default this file is hidden, read-only, system and fireproof. To remove all that, run: attrib c:\BOOT.INI -s -h -r beforehand. Afterwards the following command may help you sleep better: attrib c:\boot.ini +s +h +r. Check that the timeout option is not set to a too low number of seconds. Back up this file before fiddling more with it; making your machine un-bootable is really not a pleasant experience. Depending on your version of Windows, there may also be some tools available to help you edit more safely the boot.ini file. Try for instance msconfig or bootcfg. Maybe even the experimental WINGRUB. Google can help you a lot here.

Then you have to find out which is the first primary partition of your hard drive (this may probably be simply C: for you). Use the Windows Disk Administrator or any other disk partitioning tool to find that. That's because by default, grldr is configured to look for its configuration file \boot\grub\menu.lst on the first primary partition of your disk. Let me call this partition F: (like "First"), please substitute by the drive letter appropriate for you. To get a correctly located menu.lst template, you can just copy the whole boot\ directory provided in the GRUB for DOS package to F:\boot. Or you can create an empty F:\boot\grub\menu.lst by hand. Now also put a copy of the two Linux installer files of your choice inside this F:\boot directory. Finally to enable your Linux installer in GRUB's menu, edit the file F:\boot\grub\menu.lst adding a paragraph similar to this one:

title My Linux installer of choice
kernel   (hd0,0)/boot/your_linux_kernel_filename   distribution_specific_options
initrd   (hd0,0)/boot/your_ramdisk_filename

You have to replace your_linux_kernel_filename, your_ramdisk_filename and distribution_specific_options according the Distribution specifics section. Do not include the initrd=your_ramdisk_filename part in distribution_specific_options (cause it's already in the last of the 3 lines just above).

Update: starting from version 0.4.0pre4, grldr will now only look for F:\menu.lst and not for F:\boot\grub\menu.lst anymore.

Now just reboot and install your favorite Linux distribution!

If GRUB does not display the menu, or complains it cannot mount the partition or find the linux kernel file, it's probably just a partition numbering bug/issue. To solve it, use GRUB's command-line (enter 'c' if you are in GRUB's menu), and type: find /boot/your_linux_kernel_name.

If GRUB does not work at all, you can try a different version of grldr from GRUB_for_DOS server. Or Lode Leroy's version of GRUB for NT, which is slightly more complex to install, but better documented. Or try to install FreeDOS. Finally send me an email telling me how it went.

Loadlin

Loadlin is a great, old tool able to boot a Linux kernel from DOS without rebooting the hardware. It can be downloaded from here. Use the latest version (1.6c at this time). Download it in the same directory as your Linux files (it will make you life easier). There are a lot of files to download from the Loadlin web site but you really just need loadlin.exe (which is unconveniently compressed in loadlin.exe.gz for some unknown reason [z]). You can also find uncompressed versions by poking around most distributions (but be careful, they may be outdated).

Windows 95/98
Choose "Reboot in MS-DOS mode" in the shutdown menu. You can also use the startup menu, pressing F8 at boot (Press Ctrl for 98/ME), and choose "command prompt only".
Windows ME
See above.

Now cd in the directory where you downloaded LOADLIN.EXE, the Linux kernel and initrd files, and finally start the magic command:

loadlin  name_of_kernel  initrd=name_of_initrd  distribution_specific_options

This may range from the simple: loadlin linux.bin initrd=root.bin to the more complex: loadlin vmlinuz initrd=initrd.gz root=/dev/ram ramdisk_size=10000 devfs=mount,dall. Extra options at the end of the command are passed from Loadlin to the Linux kernel. Unfortunately, every distribution has its specific tuning options. Find the one you need in the distribution specifics section.

Loadlin is not maintained anymore. If it fails for some reason, you can try GRUB_for_DOS instead. The only usage difference is that you have to put the loadlin command line arguments above in a menu.lst configuration file instead, then run a bare GRUB.EXE. Write this menu.lst GRUB configuration file the same way described in the GRUB for NT paragraph (skip the grldr related instructions). Also have a look at the example menu.lst file shipped.

Game over ?

At this point you should see the greetings of the installer. From now on, just follow the regular documentation of your distribution. Obviously the very first thing you need to do now is to configure and make the net work, in order to connect to the nearest mirror for your distribution. The only remaining issue you may encounter is making work this brand new network interface (yes, the one you bought without checking its Linux compatibility first). Most installers allow you to load additional drivers before going on. Use this feature to try to find and load the appropriate driver in case your network interface does not appear in the installer.

If the installer is not able to make your network interface work, an alternative is to download the ISO image of the first CD, because some installers are also able to get their stuff from a CD image on the hard disk (check the installation manual of your distribution). You don't get the benefit of not downloading the first CD, but you still don't need any removable media nor drive.

You should now move to the regular installation manual provided by your distribution. In particular, you will have to decide how you boot your new GNU/Linux system (as opposed to boot its installer). If you used GRUB for NT to boot the installer, you perfectly can re-use it to permanently boot the installed system. When your installer asks if you want to "make your system bootable", just answer no, and carefully write down instead the location of the kernel and (optional) initrd image it would have configured, as well as the location of your boot partition. Go back to Windows, and use these informations to re-configure GRUB for NT. You are done. I don't want to make this document too long and off topic by providing more details about this; all you need you know should be in the installation manual of your distribution and in GRUB's documentation. There are countless ways to "chainload" bootloaders. To decide which is the best one for you, also have a look at Linux Boot Loaders Compared and at this nice NT boot process article. Don't forget to google too!

Distribution specifics

You will find in this section the informations specific to each distribution:

  1. where you can get the two installer files needed, that is: a Linux kernel and its initrd initial ramdisk.
  2. the distribution-specific options you will have to give to Loadlin or GRUB for NT to tune the kernel and installer. Some distributions do not need any options at all. So unless some are mentioned do assume there are none.
  3. A direct link to the installation manual (when I could find it online).

Debian woody

The kernel binary is called here linux.bin and the initrd is called root.bin. There are a couple of different flavours to choose from, just follow the instructions in the Debian Installation Manual.
If you have some uncommon hardware, also download and extract drivers.tgz [z], it contains many Linux drivers.

Debian Sarge

From the debian installer web site click on "other boot images" at the bottom of the list. Then choose either "netboot" or "hd-media". You need at least one vmlinuz (or linux) kernel and one initrd.gz file from the same subdirectory. If you intend to install everything from the network, prefer the "netboot" image. For more information concerning the different debian initrd images, check this page of the Debian Installation Guide.

You can also give a try to a 2.6 kernel if you have recent hardware and suspect you need cutting edge drivers (especially check your network interface).

The tuning options for Loadlin or GRUB can be found in the netboot/pxelinux.cfg/default text file. Don't trust the outdated ones from the Debian Installation Guide. They look like this: ramdisk_size=10934 root=/dev/rd/0 devfs=mount,dall rw  --

Mandriva

Tested with versions 9.2 and 10.0

Go to the Mandriva download page, and pick up from the list a mirror close to you. Once you are browsing your mirror of choice, try to find a directory similar to this one:

ftp://ftp.mymirror.mycountry/blablabla/MandrivaLinux/official/10.0/i586/

Please note there is no iso subdirectory in the path above. Carefully write down this exact network location (protocol://server/direc/to/ries) because you will need it later. The Linux kernel (vmlinuz) and initrd (all.rdz) files you need are hidden in the subdirectroy isolinux/alt0/ [m].

The installer will ask you the exact network location of your mirror (server + directory), so keep this information at hand. The directory should end like this: ___/MandrivaLinux/devel/community/i586. If you leave login and password blank the installer will figure out you want to access an anonymous FTP server.

The tuning options can be found in the file ___/i586/isolinux/isolinux.cfg. If you have no clue just pick up the first, default "append" line. The ramdisk_size=xxx part is especially required. On the other hand, remove the automatic=method:cdrom part if you want to install from the network.

To help you complete the installation, you can find online most Mandriva's documentations. They feature the "Installing Mandrakelinux" chapter.

Mandriva 10.1 and 2006.0

The good thing that comes with version 10.1 is that you don't need anymore to write down the mirror address, because you can select it from a list! (Thanks to John Keller for the tip). Even better with 2006.0: the directory is now set automagically.

Red Hat Fedora Core

Choose a mirror from the list of Fedora mirrors. Then try to locate a directory similar to this one:

ftp://ftp.mymirror.mycountry/blabla/fedora/linux/core/3/i386/os/

From here, download the two files isolinux/vmlinuz and isolinux/initrd.img Same warning as for Mandriva: keep the exact network location of your mirror (server + directory) at hand. You will need something ending with: ___/fedora/linux/core/3/i386/os

For upcoming Fedora versions, simply substitute ___/core/3/i386/os by ___/core/test/X.Y/i386/os or alike.

Tuning options can be found in the isolinux/isolinux.cfg text file.

Fedora's installation manual is currently under works. Meanwhile, it is recommended to use the previous Red Hat 9 Installation Guide

Slackware

Installing the Slackware distribution without any removable media is less convenient than the other distributions mentioned here, because it features no package management tool able to get and install packages directly from the network. Packages have to be found on some file-system. Nevertheless, it's possible (and somewhat documented); you just have to find some additional free space, for instance in some existing windows FAT partition, and pre-download there a minimal set of packages to give to the installer when it will ask for it. The minimal set of packages to get a working and networked Slackware system weighs just less than 50Mo (small is beautiful, isn't it?)

First pick up a Slackware mirror close to you. There is a kernel in each one of the subdirectories of path/to/your/mirror/slackware-10.0/kernels/. To choose the more appropriate for your machine, get a clue from the excellent Installation Help. Most PCs will be fine with the basic kernel slackware-10.0/kernels/bare.i/bzImage. Then download the initrd image of the installer from here: slackware-10.0/isolinux/initrd.img

Finally you need to get the minimal set of Slackware packages; this is the so-called A series: all the files located in the directory slackware-10.0/slackware/a/. You also need a couple of packages from the N series (in slackware/n, you guessed it) in order to use the network immediatly after the installation. From the N series you need at least the TCP/IP package (i.e., the 3 tcpip-0.17-* files) and some user application like for instance lynx. You may also need the ppp and rp-pppoe packages depending on how you connect to the network. You obviously won't be able to download those 200 files one by one with your web browser; you need some more advanced application like for instance a specialized FTP client. An alternative is to download the whole first CD ISO image on your hard disk as explained in the Installation FAQ, but that does mean a long 600Mo download (including some packages you may not need) instead of just 45Mo for the whole mandatory A series plus the 2-3 packages of the N series. Moreover, mounting the CD image from the hard disk during the installation requires a bit more technical skills.

The tuning options for Loadlin or GRUB found in the FAQ are: rw root=/dev/ram load_ramdisk=1. No tuning at all was ok for me.

So far everything is fine, but I stumbled on (only) one potential issue: at some point the installer asks you which kernel you want to install on your machine. You probably want to install the one you carefully picked up for the install and that you are successfully running right now, but you can't: you have to feed the installer with some floppy or CD. Else it will install the "default" kernel. If the default kernel was not able to boot your machine at installation time, then of course it won't be able to boot it after. This issue is known and documented again in the Installation FAQ, but it becomes more painful in the case of our "non-removable media" scenario. I suspect you can fix it by installing your kernel of choice thanks to some wizardry while the installation is still running (before rebooting). Or you can try to re-configure Loadlin or Grub to boot your new system from Windows/DOS with your particular kernel. Since Slackware is rumoured to be a hackers' distribution, I am sure you will quickly find out a solution to this ;-) Don't forget to dig into its exhaustive documentation.

SuSE Linux

Tested with versions 9.1 and 9.2. Pick up a close mirror from the list. Locate a directory similar to this one:

ftp://ftp.mymirror.com/blabla/suse/i386/9.2

Write this (case-sensitive) location down, but instead of the hostname ftp.mymirror.com of the mirror write its IP address, cause the installer will not able to resolve DNS names later (really?). To find out the IP address, just run ping ftp.mymirror.com in a command shell. Finally download these two files: boot/loader/linux and boot/loader/initrd. Another information you have to prepare is the name of the Linux driver for your network interface, because the SuSE installer will not probe your hardware. First find out the exact manufacturer and model name of your networking hardware (for instance using Windows' device manager), then find the corresponding Linux driver name, using for instance the big manufacturer list in the Linux Ethernet HOWTO.

Ignore the harmless error message about the missing CD. Before configuring the network, first manually load the drivers you need using "Kernel modules (hardware drivers)" in the menu. Don't forget the initial slash "/" in the mirror directory name.

You can find the tuning options inside the file boot/loader/isolinux.cfg.

There don't seem to be a freely available installation manual online.

Updates for openSUSE 10.X

Do not waste your time searching in the 10.X directories found next to the 9.X directories pointed above but rather reach the new openSUSE mirrors. Then click on "Internet Installation Repository", and follow the same instructions as above. You do not have to look for the IP address of your mirror, giving a hostname is OK. You still need to carefully write down the directory name, which now looks like this:

/opensuse/distribution/SL-10.0-OSS/inst-source

Ubuntu

Ubuntu is based on Debian and thus very similar to it. Choose one of the Ubuntu mirrors. Of course, you do not want a "release-CD-only" mirror.Then find a directory similar to this one:
ubuntu/dists/hoary/main/installer-i386/current/images/netboot/ubuntu-installer/i386/

Download the linux kernel linux and the ramdisk image initrd.gz.

The tuning options are in the file pxeconfig.cfg/default. They always include:

vga=normal ramdisk_size=14972 root=/dev/rd/0 rw --

For expert mode (more configuration choices), prefix with DEBCONF_PRIORITY=low.

You can find installation manuals here, as well as a lot of other documentations.

Successfully tested with Hoary, Breezy and Dapper. Mirror layout for the previous "Warty" release was slightly different but if you want to stay out-of-date you can, it also tested and works.

Gentoo

I finally gave one more shot at Gentoo and it looks like I succeeded. The dirty trick is simply to fake the CD with some partition. It's successfully tested with releases 2004.3 and 2005.0. Gentoo does not directly provide the files needed, so the following procedure is awkward but is reported to work. It could be a zillion times simpler if Gentoo made a small packaging (or un- packaging?) effort. Please do complain to Gentoo maintainers about that, cause I won't do it myself. I won't either clutter this document with long instructions dedicated to Gentoo, so only minimum information is provided below. Sorry but you have to be somewhat familiar with linux to understand this procedure (since you are installing Gentoo you are supposed to be anyway :-). Thanks a lot in advance for sending me any report, preferably detailed. Enough disclaimers, time for the real stuff.
Download a release of the minimal LiveCD ISO image (50Mo) from one of the Gentoo mirrors. The location looks like this: ___/releases/x86/2004.3/livecd/install-x86-minimal-2004.3.iso. Mount/open this image. If you are using Windows, I suggest the excellent Daemon Tools to do this. Some CD burning software may also fit. Copy the isolinux directory and livecd.squashfs file to the root of some partition used to fake the CD. This partition does not even have to be empty. You have to know/guess how linux will name it (e.g.: /dev/hdb5). Do a similar guess for GRUB (e.g.: (hd0,4)). Do not choose an NTFS partition, unless gentoo ships a kernel that reads NTFS someday.

The kernel is isolinux/gentoo and the initrd image is isolinux/gentoo.igz. Get the tuning options from the file isolinux/isolinux.cfg, except you have to change the option cdroot into cdroot=/dev/hdb5.

This trick did not work before the 2004.3 release. Faking the CD with 2004.2 was not possible cause the cdroot option was only a 0/1 toggle at that time (check /linuxrc inside gentoo.igz). Moreover the 2004.2 kernel was not able to read a FAT partition.

Type Ctrl-D to ignore the fsck /dev/BOOT failure (it seems the installer is trying here to check the filesystem of the missing install CD) then finish the installation according to the regular Gentoo installation manual. Thanks to Anthony Sheetz for testing, reporting and explaining some Gentoo tricks to me. Please send me your report too!

Updates for release 2005.0

The mirror directory of interest is now called installcd instead of livecd. And there is now and additional file to copy: there must also be an empty livecd file at the root of the faked CD. Thanks to Kristijan Lenac for this 2005.0 fix.

Unsupported

On the 15th of July, I had confirmation from a developer of Progeny that you cannot yet install Progeny this way, but they would like to in the future.

Feedback

Please send any kind of feedback (including english mistakes) to Marc.Herbert@free.fr . I am sure this procedure can be extended, optimized, automated, etc., so thanks in advance for your contribution. Since I have not tested this in every configuration possible, I also welcome simple success reports with your detailed configuration. Thanks a lot to all the people who already kindly sent me their feedback and thus helped improve this document.


Copyright (c) Marc Herbert. Permission is granted to copy, distribute and/or modify this document under the terms of the BY-SA 2.0 Creative Commons License, or under the terms of GNU Free Documentation License Version 1.2, with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. I would greatly appreciate that you notice me in case you make anything beyond a personal use of this document.

$Revision: 4.23 $. Last modified: $Date: 2006/04/22 09:24:08 $. HTML generated from reStructuredText.

There also is an (experimental) Docbook translation. It's unverified, don't trust it too much.


[z](1, 2) If you have some trouble decompressing .gz files, check http://www.gzip.org/. To extract .tar files (.tgz is a shortcut for .tar.gz), you will probably need WinZip or PowerZip or similar.
[b]since you are installing a new system, you should do that anyway.
[m]alt0 is the default kernel. For Mandriva 10.0 this is Linux 2.6.xx (and alt1 is 2.4.xx). Thanks to Offer Kaye for the tip.