LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate






   Linux FAQ > 7. Solutions to Common Miscellaneous Problems
Question:  7.22. The PCMCIA Card Doesn't Work after Upgrading the Kernel.
Answer:

The PCMCIA Card Services modules, which are located in /lib/modules/version/pcmcia, where version is the version number of the kernel, use configuration information that is specific to that kernel image only. The PCMCIA modules on your system will not work with a different kernel image. You need to upgrade the PCMCIA card modules when you upgrade the kernel.

When upgrading from older kernels, make sure that you have the most recent version of the run-time libraries, the modutils package, and so on. Refer to the file Documentation/Changes in the kernel source tree for details.

Important: If you use the PCMCIA Card Services, do not enable the Network device support/Pocket and portable adapters option of the kernel configuration menu, as this conflicts with the modules in Card Services.

Knowing the PCMCIA module dependencies of the old kernel is useful. You need to keep track of them. For example, if your PCMCIA card depends on the serial port character device being installed as a module for the old kernel, then you need to ensure that the serial module is available for the new kernel and PCMCIA modules as well.

The procedure described here is somewhat kludgey, but it is much easier than re-calculating module dependencies from scratch, and making sure the upgrade modules get loaded so that both the non-PCMCIA and PCMCIA are happy. Recent kernel releases contain a myriad of module options, too many to keep track of easily. These steps use the existing module dependencies as much as possible, instead of requiring you to calculate new ones.

However, this procedure does not take into account instances where module dependencies are incompatible from one kernel version to another. In these cases, you'll need to load the modules yourself with insmod, or adjust the module dependencies in the /etc/conf.modules file. The Documentation/modules.txt file in the kernel source tree contains a good description of how to use the kernel loadable modules and the module utilities like insmod, modprobe, and depmod. Modules.txt also contains a recommended procedure for determining which features to include in a resident kernel, and which to build as modules.

Essentially, you need to follow these steps when you install a new kernel.

  • Before building the new kernel, make a record with the lsmod command of the module dependencies that your system currently uses. For example, part of the lsmod output might look like this:

       Module         Pages    Used by
       memory_cs          2            0
       ds                 2    [memory_cs]     3
       i82365             4            2
       pcmcia_core        8    [memory_cs ds i82365]   3
       sg                 1            0
       bsd_comp           1            0
       ppp                5    [bsd_comp]      0
       slhc               2    [ppp]   0
       serial             8            0
       psaux              1            0
       lp                 2            0
    


    This tells you for example that the memory_cs module needs the ds and pcmcia_core modules loaded first. What it doesn't say is that, in order to avoid recalculating the module dependencies, you may also need to have the serial, lp, psaux, and other standard modules available to prevent errors when installing the pcmcia routines at boot time with insmod. A glance at the /etc/modules file will tell you what modules the system currently loads, and in what order. Save a copy of this file for future reference, until you have successfully installed the new kernel's modules. Also save the lsmod output to a file, for example, with the command: lsmod >lsmod.old-kernel.output.

  • Build the new kernel, and install the boot image, either zImage or bzImage, to a floppy diskette. To do this, change to the arch/i386/boot directory (substitute the correct architecture directory if you don't have an Intel machine), and, with a floppy in the diskette drive, execute the command:

       $ dd if=bzImage of=/dev/fd0 bs=512
    


    if you built the kernel with the make bzImage command, and if your floppy drive is /dev/fd0. This results in a bootable kernel image being written to the floppy, and allows you to try out the new kernel without replacing the existing one that LILO boots on the hard drive.

  • Boot the new kernel from the floppy to make sure that it works.

  • With the system running the new kernel, compile and install a current version of the PCMCIA Card Services package, available from metalab.unc.edu as well as other Linux archives. Before installing the Card Services utilities, change the names of /sbin/cardmgr and /sbin/cardctl to /sbin/cardmgr.old and /sbin/cardctl.old. The old versions of these utilities are not compatible with the replacement utilities that Card Services installs. In case something goes awry with the installation, the old utilities won't be overwritten, and you can revert to the older versions if necessary. When configuring Card Services with the "make config" command, make sure that the build scripts know where to locate the kernel configuration, either by using information from the running kernel, or telling the build process where the source tree of the new kernel is. The "make config" step should complete without errors. Installing the modules from the Card Services package places them in the directory /lib/modules/version/pcmcia, where version is the version number of the new kernel.

  • Reboot the system, and note which, if any, of the PCMCIA devices work. Also make sure that the non-PCMCIA hardware devices are working. It's likely that some or all of them won't work. Use lsmod to determine which modules the kernel loaded at boot time, and compare it with the module listing that the old kernel loaded, which you saved from the first step of the procedure. (If you didn't save a listing of the lsmod output, go back and reboot the old kernel, and make the listing now.)

  • When all modules are properly loaded, you can replace the old kernel image on the hard drive. This will most likely be the file pointed to by the /vmlinuz symlink. Remember to update the boot sector by running the lilo command after installing the new kernel image on the hard drive.

Also look at the questions, How do I upgrade/recompile my kernel? and Modprobe can't locate module, "XXX," and similar messages.


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by: