Setting Up a Base Linux Install on a Laptop

by Jay Docherty

In my previous article, I discussed the things one should consider when purchasing a laptop on which Linux will run. This time I would like discuss a few ways to get the laptop up and running with a base Linux install. Your first step is selecting a distribution. I have been using Debian for about five years now and have grown quite accustomed to it. As a result, much of this article tilts to the way Debian does things. The goal of this article is to get you up and running with Debian Sid and the 2.4.20 kernel.

The Splendor of Sid

Debian has a reputation for being difficult to install. Although this is not necessarily true, Debian's installer is a far cry from the fully automated installers of distributions such as Mandrake and Red Hat. However, there is a benefit to your extra labor: much more control of how the system is laid out, which packages are installed and which kernel features are enabled or disabled. This gives you the freedom to have a system completely tailored to your specific needs. Debian Sid (unstable) is my preferred flavor. At the time of this writing, Woody (stable) and Sarge (testing) also are available. I like Sid because it offers the latest software in binary form with the shortest release date turn-around. The largest advantage can be found with all the Debian flavors, the powerful apt-get system. Combine apt-get with Sid, and you can be sure your system will be up to date with all the leading edge (sometimes bleeding edge) applications for the Linux operating system.

Early Decisions

To get started, you're going to need a basic kernel to boot from and to start the install. Before you can boot any kernel, you need to decide from which medium you would like to boot. You have two main choices: CD-ROM or floppy disk. This assumes you have a high-speed internet connection; Sid is available only through download. I suggest using a CD-ROM where possible. It is faster than floppies, and you won't have to swap disks around. Compact disk images can be found here and floppy disk images can be found here This is where things can get a little confusing. Even though we are eventually going to have a Sid system, you must start with the Woody boot images. You have to trust me on this one. Make a Woody boot CD-ROM from the ISO image or the corresponding floppy disks from the six bin files.

Efforts are being made to try to provide an up-to-date CD-ROM that users may acquire through snail-mail, but these efforts are few and far between. This also defeats one of the major advantages of using an OS that is constantly updated; often, daily updates are applied to Sid. If you find a major bug with one of Sid's packages, you can be sure that a fix is soon to follow.

The Basic Install

Now you should have the CD or floppy disks ready, and your high speed Internet connection is aching to start downloading packages. If you're using a CD-ROM, you may have to change a setting in your laptop's BIOS to be able boot from it; the same goes for the floppy install. Either way, once the laptop boots a Debian image you will be presented with a boot prompt. Press Enter to begin the install or a different option to begin a rescue. The rescue feature is useful for recovering from a botched kernel install. As usual, if confusion abounds press F1 for help. An installation is what we need, so press Enter and fire up the blue text-based installer if booting from CD-ROM; if you're using floppies you'll be prompted for the next disk. The Debian installation is divided into steps. If you so choose, you may jump around between the steps. To simplify things I outline the basic order and syntax of the steps below.

  1. Configure the Keyboard

    This is the first step of any OS install; use QWERTY unless you know otherwise.

  2. Partition a Hard Disk

    This can be a hot issue amongst Linux/UNIX people. Here's my recommendation for how to partition a laptop or desktop, but not a server. HDA1 should be swap, and it's size should be twice the size of your memory. HDA2 should be root and take the remainder of the drive. In this step, use the cfdisk utility to set up the partitions. Key tips: don't forget to make your root partition bootable, don't forget to change your swap partition Type to swap and don't forget to write your changes to disk.

  3. Initialize and Activate a Swap Partition

    Select the partition you set the swap to in the previous step and verify your choice.

  4. Initialize a Linux Partition

    Select the partition you set as root and verify your choice. If you created more than one partition other then swap, repeat this step incrementally to enable each one.

  5. Install Kernel and Driver Modules

    Select the same media type that you booted from. This is where CD-ROM users advance much faster, because floppy disk users have to insert up to five floppies.

    If you are doing a PCMCIA device install, now is the time to use the alternate choice; go to Configure PCMCIA Support. If you are not doing a PCMCIA device install, continue with Configure Device Driver Modules.

    This is where you can specify what external modules the kernel loads at boot time. Depending on your NIC card, you may have to load a module for it. Don't fret about loading modules for devices you are not sure about. The installer lets you know promptly if it's unable to find your hardware.

  6. Configure the Network

    This is perhaps the most important step of them all. This option is available only if your kernel detected a networking device or if you loaded the appropriate module. Go through the menus and fill in your TCP/IP information.

    A trick I like to do before I start accessing any network network connections is to switch out of the installer by holding Alt+Ctrl+F2. This brings you into a fresh console session, from where you can try pinging an outside address. This is a good way to verify your TCP/IP settings prior to starting the Net-based install. This also is a convenient place to fix any TCP/IP problems you may find. From here you have access not only to config files, such as resolv.conf, but also to run commands, such as ifconfig. Once you are confident the network configuration is running properly, press Alt+Ctrl+F1 to continue with the install.

  7. Install the Base System

    Time to start using that high-speed internet connection. Select Network to begin a base Linux install from the latest stable packages at Debian.org. A progress bar indicates the download's progress.

  8. Make the System Bootable

    This step asks you where you would like to install LILO. Unless you have something special in mind, the default is the best option. If you had another OS in the laptop previously and did not completely remove all of its system records, you may be prompted to put your previous OS in a boot menu with Debian. This is pretty confusing, especially after you rewrote the Inode tables earlier in the install. When prompted for this choose Ignore.

  9. Make a Boot Floppy

    People installing from CD-ROM can ignore this step as they may not have a floppy drive with which to format a boot floppy. Floppy disk users may choose this option to put an emergency recovery copy of your kernel onto a floppy disk. I skip it because I can use the rescue floppy that I used to start the install in case of recovery.

  10. Reboot the System

    Nothing to say here. You're better off if you do what the man says.

    At this point the system restarts with the freshly installed 2.2.20 kernel. After the reboot is complete, it fires up your favorite blue text-based installer. First you are asked some questions pertaining to the date and time zone and then some security questions. If you're not sure what to answer, go with the defaults. Finally, it asks some basic password and user creation questions and then goes back to the topic-based install process.

  11. Shall I Remove PCMCIA Packages?

    If you are not using any PCMCIA devices, remove these packages. Its easy to add them later if you need them.

  12. Do You Want to Use a PPP Connection to Install the System?

    It is not out of the question to do a full Linux install over a 56k modem. Personally I don't have the patience, and I know many other people feel the same. If you don't plan to, say No.

  13. Choose a Method apt Should Use to Access the Debian Archive

    This is where things get tricky. If you were setting up a Woody system, now would be the time when you would configure your apt sources and run tasksel. But because we're setting up a Sid system, this is the point when we start changing things. When asked this question, select Cancel. Then you are asked to run tasksel or dselect; choose No. This halts the install. You then are asked a couple of package configuration questions and then dropped to a login prompt.

It's Sid Time

Log in with root and use the password you specified earlier. You need to edit /etc/apt/sources to point to Sid's internet-based sources. It should contain the following lines:

deb http://ftp.us.Debian.org/Debian/ sid main contrib
deb-src http://ftp.us.Debian.org/Debian/ sid main contrib
deb http://non-us.Debian.org/Debian-non-US sid/non-US main contrib
deb-src http://non-us.Debian.org/Debian-non-US sid/non-US main contrib

Now run apt-get update and then apt-get dist-upgrade.

We have just configured apt to use only the Sid package repositories. Then we updated the system's list of potential packages to that of Sid's. Finally, we kicked off the apt-get dist-upgrade command to start the upgrade from Woody to Sid. This process may take some time to complete. It is essentially updating all the packages that we downloaded earlier in the Install a Base System portion of the Woody install, so expect a similar download time. Once this has completed, you are asked to configure various packages. As usual, if you are confused, go with the defaults. After all the new packages are configured, you are returned to the system's prompt; reboot the system. When it comes back up you should see Debian GNU/Linux testing/unstable in the header. Welcome to Sid.

Now that you have established a bare bones base system, it's time to install some packages so you can make this laptop useful. The easiest way to start this is with tasksel. You can start tasksel with tasksel, which presents you with many different package sets. The standard package sets I install for a non-server system are the X Window System, C, C++ and Tcl/Tk. If tasksel refuses to open, run dselect update, which updates your available package set.

After the download is complete, you are asked for information necessary to configure the downloaded packages. The most significant questions are those regarding the configuration of your X files. Once you're done configuring the packages, reboot. If everything goes well when your system comes up, X should start. You can begin adding packages and customizing them to your liking.

Kernel Compiling

At this point it's not necessary to do any more major modifications to the OS. However, many advantages can be had by compiling a custom kernel specifically for your machine. The default may not have certain features enabled that your laptop offers. For example, power management is not enabled and wireless support is not present. A custom kernel is vital for those of you who want to tailor the OS completely to your laptop.

For anyone new to Linux, the kernel seems like black magic, some mystical force driving the computer. In reality manipulating the kernel is not that hard at all. Many utilities can help you and plenty of documentation is available. With all this said, you can seriously cripple your operating system with a botched kernel install. If it doesn't boot (which is the worst case scenario), the only way to bring it back is from an alternate media recovery. If you are not familiar with how to recover from a floppy or CD-ROM, please do not follow my steps for compiling a custom kernel. I don't want to be responsible for hours of time wasted with an OS install just to corrupt it with a bad kernel compile.

With the disclaimer out of the way, we can start the kernel compile. You first need to download two packages, so run apt-get install kernel-package and then apt-get install libncurses5-dev.

Now you need to decide which version of the kernel you want to build. You can go to www.kernel.org and have the pick of the litter. Here, we're going to build 2.4.20. You can download it with apt-get install kernel-source-2.4.20.

After this has completed, change directories to /usr/src. Next you need to link the kernel version directory to Linux with ln -s kernel-source-2.4.20 linux . Now, change directories to Linux, and run make menuconfig. This presents you with a text-based menu where you can switch between kernel parameters. A help menu even is available for assistance if you are not sure what something means. To complete this step successfully, it is imperative that you know the intricate components that make up your laptop. Many kernel parameters are extremely specific. Be prepared to know minute details, for example, which AGP controller, sound card chipset, video card chipset, USB controller or ATA Bus adapter your laptop has.

These are the parameters I set for my IBM Thinkpad R32:

  • Loadable module support

    • Enable loadable module support

    • Set version information on all module symbols

    • Kernel module loader

  • Processor type and features

    • (Pentium-4) Processor family

    • Machine Check Exception

      • /dev/cpu/microcode - Intel IA32 CPU microcode support

      • /dev/cpu/*/msr - Model-specific register support

      • /dev/cpu/*/cpuid - CPU information support

      • (off) High Memory Support

    • MTRR (Memory Type Range Register) support

  • General setup

    • Networking support

    • PCI support

    • (Any) PCI access mode

    • ISA bus support

    • PCI device name database

    • Support for hot-pluggable devices

  • PCMCIA/CardBus support

    • PCMCIA/CardBus support

    • CardBus support

    • System V IPC

    • BSD Process Accounting

    • Sysctl support

    • Kernel core (/proc/kcore) format

    • Kernel support for a.out binaries

    • Kernel support for ELF binaries

    • Kernel support for MISC binaries

    • Power Management support

    • Advanced Power Management BIOS support

  • Plug and Play configuration

    • Plug and Play support

  • Networking options

    • Packet socket

    • UNIX domain sockets

    • TCP/IP networking

  • ATA/IDE/MFM/RLL support

    • ATA/IDE/MFM/RLL support

  • IDE, ATA and ATAPI Block devices

    • Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support

    • Include IDE/ATA-2 DISK support

    • SCSI emulation support

    • Generic PCI IDE chipset support

    • Sharing PCI IDE interrupts support

    • Generic PCI bus-master DMA support

    • Use PCI DMA by default when available

    • Intel PIIXn chipsets support

    • PIIXn Tuning support

  • SCSI support

    • SCSI support

    • SCSI CD-ROM support

    • (2) Maximum number of CDROM devices that can be loaded as modules

    • SCSI generic support

    • Enable extra checks in new queueing code

    • Probe all LUNs on each SCSI device

  • Network device support

    • Dummy net driver support

    • Ethernet (10 or 100Mbit)

      • Ethernet (10 or 100Mbit)

      • EISA, VLB, PCI and on board controllers

      • EtherExpressPro/100 support (eepro100, original Becker driver)

    • Wireless LAN (non-hamradio)

      • Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)

      • Hermes PCMCIA card support

    • Input core support

      • Input core support

      • Keyboard support

      • Mouse support

      • (1024) Horizontal screen resolution

      • (768) Vertical screen resolution

    • Character devices

      • Virtual terminal

      • Support for console on virtual terminal

      • Standard/generic (8250/16550 and compatible UARTs) serial support

      • Unix98 PTY support

      • (256) Maximum number of Unix98 PTYs in use (0-2048)

      • Mice

        • Mouse Support (not serial and bus mice)

        • PS/2 mouse (aka “auxiliary device”) support

      • Intel i8x0 Random Number Generator support

      • /dev/nvram support

      • Enhanced Real Time Clock Support

      • /dev/agpgart (AGP Support)

      • Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860

      • Direct Rendering Manager (XFree86 DRI support)

      • ATI Radeon

    • Filesystems

      • Kernel automounter version 4 support (also supports v3)

      • Virtual memory filesystem support (former shm fs)

      • ISO 9660 CDROM filesystem support

      • /proc filesystem support

      • /dev/pts filesystem for Unix98 PTYs

      • Second extended fs support

    • Console drivers

      • VGA text console

      • Video mode selection support

    • Sound

      • Sound card support

    • USB support

      • Support for USB

      • Preliminary USB device filesystem

      • UHCI Alternate Driver (JE) support

      • USB Human Interface Device (full HID) support

After you have gone through the lengthy process of selecting the parameters you like, there are a few different ways to compile the kernel. One way is to run make-kpkg clean and then make-kpkg --revision yourname.1 kernel_image. This uses the make-kpkg utility, a Debian tool used to assist you with compiling kernels. It compiles the kernel and all associated modules and puts them in a .deb package one directory below your kernel source. After you have built the package you can install it with the dpkg utility. I like this because it's easy to keep multiple kernel compiles around. Especially if you are troubleshooting a problem, your latest compile may not be the best. If you're having a problem, all you have to is install an older, more successful one.

The make-kpkg method replaces the more standard six step method of

make dep
make
make bzImage
make modules
make install
make modules_install

Both techniques work, but if you are trying a kernel recompile on a non-Debian system, you do not have the make-kpkg utility at your disposal.

After you have compiled and installed your new kernel, reboot to see how its working. Don't fret if you get some random errors here and there. You can always chase those down. Your main worry is if you get to a valid prompt and the system is coming up in multi-user mode. If the system boots completely, you have jumped the first big hurdle. You can run uname -a to verify that you are indeed running the latest kernel.

Conclusion

As you can see, installing Sid and recompiling the kernel definitely has a lot of steps but is not overly complicated. A couple times through, and it becomes second nature. As with all Linux-oriented projects, you are never alone. If you get lost, there are almost unlimited help resources just a web browser away. May you have a long happy life of kernel tweaking and OS updating ahead of you.

Load Disqus comments

Firstwave Cloud