CSE 265: System and Network Administration

Lab #9

Today we continue with network file services, but first consider linux kernel modules.

  1. Exploring Kernel Modules

    There are four methods of modifying the configuration of a kernel: modify tunable kernel parameters; provide kernel parameters at boot time; compile the kernel from scratch; and load new drivers and modules on the fly into an existing kernel. The latter is the approach that we explore today.

    Loadable kernel modules are stored under /lib/modules/version where version is the version of your Linux kernel. Recall that uname -a will tell you which kernel you are currently running. The kernel on your RHEL/CentOS systems has been upgraded (leaving the old one in place) and so there will likely be multiple kernel versions. Take a look through the various subdirectories to see what modules (.ko files) are there.

    Find the vfat module, which is the driver for the Windows FAT filesystem with NT long name support. What type of device do you think the cirrusfb module supports? Recall that the find command can help you find the cirrusfb.ko file, with a find . -name "*cirrusfb.ko" -print

    The /sbin/lsmod command is used to list the currently loaded modules. Run it to see the modules loaded on your system.

    The /sbin/insmod command is used to load a kernel module. Try loading the dummy device. Can you guess what it does? How do you know that it has been loaded? Is it being used?

    The /sbin/rmmod command is used to unload a kernel module. Unload the dummy module. How do you know that it is no longer loaded? Can you unload the raid456 module?

    Now load the msdos module. You'll get an error about unresolved symbols. This is because the msdos module has dependencies on another module, and can't be loaded until all dependencies are satisfied. To find out what symbols are a problem, run dmesg piped to tail. Look at the common prefix for each of the unresolved symbols. Go ahead and load the missing module first, and then load the msdos module next. Why does "msdos" appear in two lines of lsmod output?

    Now try to unload the two modules you just added, but unload msdos last. Do you understand the error message you got? Now unload them in the correct order.

    Many modules are loaded automatically when they are needed, rather than only after being loaded manually as we have been doing so far. However, in order to load certain modules, it is important to know what modules it depends on. That information is stored in a modules dependency file called modules.dep. You can find it in the modules directory for your kernel. If you grep for msdos, you'll see the dependency that you discovered above.

    There is another utility that can automatically resolve module dependencies. It is called modprobe. It can be used to load the msdos module (along with any dependencies).

    This time use modprobe to load the dos module. Run lsmod to see which modules are listed. Is there a dos module? What was loaded instead? The command modprobe -c | grep dos will help you understand what is going on.

    Aliases are defined in files in /etc/modprobe.d/, where you can find the dos alias defined.

  2. Installing AFS client on a Linux Machine using Pre-built RPMs

    Let us first make sure we have the tools to build kernel modules. This is greatly simplified by using DKMS (which will re-build the module automatically as your kernel gets updated).

    1. Add an additional RPM package repository (EPEL: Extra Packages for Enterprise Linux) which provides DKMS
      wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
      rpm -ivh epel-release-6-8.noarch.rpm
    2. Install tools for building kernel
      yum install dkms gcc flex make kernel-devel

    AFS is a distributed filesystem, pioneered at Carnegie Mellon University that offers a client-server architecture for federated file sharing and replicated read-only content distribution, providing location independence, scalability, security, and transparent migration capabilities across many platforms. The open source version of AFS is called OpenAFS.

    OpenAFS is not in the usual RPM repositories, which means you cannot use default yum for installation. However, OpenAFS does have a yum repository--we just need to add it, much like we did for EPEL above.

    1. Add OpenAFS RPM package repository wget http://www.openafs.org/dl/openafs/1.6.17/openafs-release-rhel-1.6.17-1.noarch.rpm
      rpm -ivh openafs-release-rhel-1.6.17-1.noarch.rpm
    2. Install three AFS packages:
      • openafs (Utilities, Init scripts, and documentation)
      • openafs-client (AFS daemon, PAM modules, client configuration files)
      • dkms-openafs (for building afs kernel module)
      yum install openafs openafs-client dkms-openafs (might take quite a while)
    3. Installation is complete. Now we will configure the client to access AFS directories provided by Lehigh.

    Note that we installed the DKMS version of the AFS kernel in case we want to run an unsupported kernel (i.e., not already listed for kmod-openafs), which would mean that we would need to build the kernel module.

  3. Configuring AFS

    1. Edit /usr/vice/etc/CellServDB.dist
      You should add the following:
      >cc.lehigh.edu          #lehigh university
          128.180.2.13            #fs3.cc.lehigh.edu
          128.180.2.10            #fs4.cc.lehigh.edu
          128.180.2.11            #fs5.cc.lehigh.edu
      
    2. Edit /usr/vice/etc/ThisCell
      It should only have one line:
        cc.lehigh.edu
    3. See that you have directory /afs. It should have been created when we installed openafs RPMs.
    4. To start the client do
      /etc/init.d/openafs-client start
      This may take a little while.
    5. You should now be able to see /afs/cc.lehigh.edu and different sub-directories therein.
    6. When the openafs-client service is running, you'll also be able to see that openafs is loaded as a kernel module.

  4. Using AFS

    Lehigh's AFS provides access to a lot of commercial software (such as matlab). For our 64bit linux machines many of these are located in /afs/cc.lehigh.edu/common/amd64_linux26/bin. You can also see your own lehigh folder in /afs/cc.lehigh.edu/home/<your lehigh id> and also your webpage in www-data in your Lehigh-home directory. Note that you wont be able to read/execute your files. You have to log in to do so.
    1. klog lehigh-id
      This attempts to acquire an AFS token for your lehigh-id so that you can access your files. Enter your Lehigh password.
    2. Use the touch command to create a new file in your AFS directory space.
    3. Try running perl from the afs partition.
      cd /afs/cc.lehigh.edu/common/amd64_linux26/bin
      ./perl --version
    4. Use klist to see who all have valid login tokens for an afs directory. Use mount -l to see if AFS is shown as mounted.
  5. Wrapping Up

    In order to sign the lab completion sheet, you will need to:
    1. tell me what kernel module has the alias dos
    2. show me that you have full access to your AFS file system by using ls -l and showing the new file that you just created using touch
    3. show that you are able to run the perl binary via AFS


This page can be reached from http://www.cse.lehigh.edu/~brian/course/2016/sysadmin/labs/
Last revised: 4 April 2016.