A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded


Adding hardware

  • Levels of support

    There are two levels of support that need to be addressed when supporting hardware.

    Basic system level

    almost always by means of loading appropriate kernel modules for the hardware device

    X windows subsystem

    some devices need more-or-less separate support from the X11 subsystem, generally either XFree86 or X.Org

    For an X server, such as X.Org, device support needs to be provided for the I/O devices with which a user will interact with an application - video card, monitor, input devices (keyboard, mouse, ...).

    For an X client, device support is generally provided through the underlying Linux kernel, i.e. support for disk access, memory, network interfaces, printers, special devices like scanners and so on.

    Adding support for a new device boils down to

    • finding the appropriate kernel parameters that support the device, enable them and recompile the kernel if previously disabled
    • finding, compiling and loading the right kernel modules for the device
    Kernel modules

    Contain extra kernel code that may be loaded after the base kernel. Modules provide additional functions to those provided by the the base kernel. Module 'root' directory in /lib/modules//kernel/

     $ ls /lib/modules/3.8.0-33-generic/kernel
     arch  crypto  drivers  fs  lib  mm  net  sound  ubuntu
  • Examining hardware
    Command Description
    lspci Provides detailed information on findable PCI devices (including those over PCMCIA or USB buses)
    setpci Can configure devices on PCI buses
    lspnp Lists plug-and-play BIOS device nodes and resources
    lsusb Similarly examines USB devices -t tree, -vv very verbose
    usbview Graphical display of USB devices
    setpnp Modify configurations USB devices
    setserial Display/set serial device configuration -a all, -G format to use with script
    lsdev Display info on installed hardware from the interrupts, ioports and dma files in the /proc directory

    A common method when 'not too sure' about a device, is to plug it in and boot a live-CD. Login to the live-CD environment and see what's what with the device.

    If a live-CD cannot find a driver for the device then it may well be unsupported - though this would be fairly rare. You would need to do a bit of searching on the net.

  • Print system information
    uname [options]
    Common options:
     -a | --all                      Print all information, omit -p and -i if unknown:
     -s | --kernel-name              Print the kernel name
     -n | --nodename                 Print the network node hostname
     -r | --kernel-release           Print the kernel release
     -v | --kernel-version           Print the kernel version
     -m | --machine                  Print the machine hardware name
     -p | --processor                Print the processor type or "unknown"
     -i | --hardware-platform        Print the hardware platform or "unknown"
     -o | --operating-system         Print the operating system

    Display system information

    $ uname -srm
    Linux 3.8.0-31-generic x86_64

    You may well need this sort of information when determining if a device is supported or which driver should be used.

  • List currently loaded kernel modules

    Show currently loaded kernel modules

    Module                      Size  Used by
    autofs4                        28361  2
    nf_conntrack_netbios_ns        10945  0
    nf_conntrack_ipv4              17225  1
    xt_state                       10689  1
    nf_conntrack                   65217  3 nf_conntrack_netbios_ns,nf_conntrack_ipv4,xt_state

    The command formats the contents of the '/proc/modules'.

  • Show information about a kernel module
    $ modinfo --help
        modinfo [options] filename [args]
        -a, --author                Print only 'author'
        -d, --description           Print only 'description'
        -l, --license               Print only 'license'
        -p, --parameters            Print only 'parm'
        -n, --filename              Print only 'filename'
        -0, --null                  Use \0 instead of \n
        -F, --field=FIELD           Print only provided FIELD
        -k, --set-version=VERSION   Use VERSION instead of `uname -r`
        -b, --basedir=DIR           Use DIR as filesystem root for /lib/modules
        -V, --version               Show version
        -h, --help                  Show this help

    Display sata_nv module information

    # modinfo sata_nv
    Filename:       /lib/modules/
    Version:        3.5
    License:        GPL
    Description:    low-level driver for NVIDIA nForce SATA controller
    Author:         NVIDIA
    Srcversion:     7DA9089DA9AEC9BE766C0C7
    Alias:          pci:v000010DEd000003F7sv*sd*bc*sc*i*
    Alias:          pci:v000010DEd0000008Esv*sd*bc*sc*i*
    Depends:        libata
    Vermagic: SMP mod_unload
    Parm:           adma:Enable use of ADMA (Default: true) (bool)

    Print radeon module parameters only

    $ modinfo  -a -p radeon
    no_wb:Disable AGP writeback for scratch registers (int)
    modeset:Disable/Enable modesetting (int)
    dynclks:Disable/Enable dynamic clocks (int)
    r4xx_atom:Enable ATOMBIOS modesetting for R4xx (int)
    vramlimit:Restrict VRAM for testing (int)
    msi:MSI support (1 = enable, 0 = disable, -1 = auto) (int)
    lockup_timeout:GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable) (int)

    '-a' author option is ignored - only one (the last) option is used.

  • Insert and remove a kernel module
    /sbin/insmod, rmmod


    $ insmod --help
        insmod [options] filename [args]
        -V, --version     show version
        -h, --help        show this help

    'filename' - Requires the full filename/path of the module to be loaded

    'args' - Any module parameters


    $ rmmod --help
        rmmod [options] modulename ...
        -f, --force       forces a module unload and may crash your
                          machine. This requires Forced Module Removal
                          option in your kernel. DANGEROUS
        -s, --syslog      print to syslog, not stderr
        -v, --verbose     enables more messages
        -V, --version     show version
        -w, --wait        begins module removal even if it is used and
                          will stop new users from accessing it.
        -h, --help        show this help

    List, remove and insert modules

    # lsmod | grep floppy
    floppy                 65769  0
    # rmmod floppy
    # lsmod | grep floppy
    # insmod /lib/modules/`uname -r`/kernel/drivers/block/floppy.ko       (Full path and filename)
    # lsmod | grep floppy
    floppy                 65769  0
    # rmmod floppy

    Use 'modinfo' to provide full path and filename to 'insmod'

    # insmod $(modinfo -F filename floppy)
    # lsmod | grep floppy
    floppy                 65769  0
  • Insert, remove and load module dependencies
    $ modprobe --help
        modprobe [options] [-i] [-b] modulename
        modprobe [options] -a [-i] [-b] modulename [modulename...]
        modprobe [options] -r [-i] modulename
        modprobe [options] -r -a [-i] modulename [modulename...]
        modprobe [options] -c
        modprobe [options] --dump-modversions filename
    Management Options:
        -a, --all                   Consider every non-argument to
                                    be a module name to be inserted
                                    or removed (-r)
        -r, --remove                Remove modules instead of inserting
            --remove-dependencies   Also remove modules depending on it
        -R, --resolve-alias         Only lookup and print alias and exit
            --first-time            Fail if module already inserted or removed
        -i, --ignore-install        Ignore install commands
        -i, --ignore-remove         Ignore remove commands
        -b, --use-blacklist         Apply blacklist to resolved alias.
        -f, --force                 Force module insertion or removal.
                                    implies --force-modversions and
            --force-modversion      Ignore module's version
            --force-vermagic        Ignore module's version magic
    Query Options:
        -D, --show-depends          Only print module dependencies and exit
        -c, --showconfig            Print out known configuration and exit
        -c, --show-config           Same as --showconfig
            --show-modversions      Dump module symbol version and exit
            --dump-modversions      Same as --show-modversions
    General Options:
        -n, --dry-run               Do not execute operations, just print out
        -n, --show                  Same as --dry-run
        -C, --config=FILE           Use FILE instead of default search paths
        -d, --dirname=DIR           Use DIR as filesystem root for /lib/modules
        -S, --set-version=VERSION   Use VERSION instead of `uname -r`
        -s, --syslog                print to syslog, not stderr
        -q, --quiet                 disable messages
        -v, --verbose               enables more messages
        -V, --version               show version
        -h, --help                  show this help

    Trying to remove a module that has dependencies

    # lsmod | grep vfat
    vfat                   19009  0
    fat                    54385  1 vfat           (vfat is dependent on fat)
    # modprobe -v -r fat
    FATAL: Module fat is in use.

    Remove any dependencies of vfat first then remove vfat module

    # modprobe -v -r vfat
    rmmod /lib/modules/
    rmmod /lib/modules/

    Insert vfat module along with dependencies

    # modprobe -v vfat
    insmod /lib/modules/
    insmod /lib/modules/

    Display a modules dependencies

    # modprobe --show-depends vfat
    insmod /lib/modules/2.6.24-23-generic/kernel/fs/fat/fat.ko 
    insmod /lib/modules/2.6.24-23-generic/kernel/fs/vfat/vfat.ko
  • Shared libraries, shared object dynamic linker

    A shared library or shared object is a library of functions/executables that can be shared by other programs. In linux these generally have a file extension of '.so'.

    Shared libraries are linked in one of two ways:


    In which case they are built into a target application at compile time.


    In which case a shared libraries functions/executables are loaded into an application at runtime.

    The linker '' is usually named and linked to ld-<ver>.<subver>.so.

    Is linked

    $ ls -al /lib/
    lrwxrwxrwx 1 root root 9 2008-09-30 13:33 /lib/ ->

    probably dated now and or distribution dependant as ..

    Is not linked

    $ ls -al /lib/x86_64-linux-gnu/
    -rwxr-xr-x 1 root root 149312 Sep 30 15:01 /lib/x86_64-linux-gnu/
    • '' looks for dependencies in executables being loaded and attempts to satisfy any unresolved links to shared libraries.
    • It searches for available shared libraries in /etc/ - a binary file generated by 'ldconfig'.
    • If the linker is unable to find a required library it fails, causing the loaded executable to fail.
  • Print shared library dependencies
    $ ldd --help
    Usage: ldd [OPTION]... FILE...
          --help              print this help and exit
          --version           print version information and exit
      -d, --data-relocs       process data relocations
      -r, --function-relocs   process data and function relocations
      -u, --unused            print unused direct dependencies
      -v, --verbose           print all information

    Print an applications's shared library dependencies

    # ldd $(which wpa_supplicant) =>  (0xb7fd7000) => /lib/tls/i686/cmov/ (0xb7fc1000) => /lib/tls/i686/cmov/ (0xb7e72000) 
    /lib/ (0xb7fd8000)
  • Configure dynamic linker run-time bindings

    The linker may no longer be called '' but should match pattern 'ld*.so'.

    'ldconfig' creates, updates, and removes the necessary links and cache to the most recent shared libraries (lib*.so.) found in the directories specified either on the command line or in the file /etc/ and in the trusted directories (/usr/lib and /lib)


    A text file containing a list of directories that contain shared libraries

    $ more /etc/
    include /etc/*.conf
    $ ls /etc/
    libc.conf  x86_64-linux-gnu.conf  x86_64-linux-gnu_EGL.conf  x86_64-linux-gnu_GL.conf
    $ more /etc/
    # libc default configuration


    $ ldconfig --help
    Usage: ldconfig.real [OPTION...]
    Configure Dynamic Linker Run Time Bindings.
      -c, --format=FORMAT        Format to use: new, old or compat (default)
      -C CACHE                   Use CACHE as cache file
      -f CONF                    Use CONF as configuration file
      -i, --ignore-aux-cache     Ignore auxiliary cache file
      -l                         Manually link individual libraries.
      -n                         Only process directories specified on the command
                                 line.  Don't build cache.
      -N                         Don't build cache
      -p, --print-cache          Print cache
      -r ROOT                    Change to and use ROOT as root directory
      -v, --verbose              Generate verbose messages
      -X                         Don't generate links
      -?, --help                 Give this help list
          --usage                Give a short usage message
      -V, --version              Print program version

    Manpage examples:

    Set up the correct links for the shared binaries and rebuild the cache

    $ sudo ldconfig -v
    [sudo] password for mark: 
    /sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
    /sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
    /lib/x86_64-linux-gnu: -> -> ->

    After the installation of a new shared library update the shared library symbolic links in /lib

    # ldconfig -n /lib

    Print the current cache

    $ ldconfig -p | head -n 6
    701 libs found in cache `/etc/' (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /lib/x86_64-linux-gnu/

    Rebuild shared library dependencies cache - /etc/

    $ sudo ldconfig

    Add a new shared library

    Can add new shared libraries to LD_LIBRARY_PATH or into /etc/ and then run 'ldconfig' or provide new shared library paths as args to 'ldconfig'.

    # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH;/path/to/new-lib_dir1;/path/to/new-lib_dir2
    # ldconfig
    # ldconfig /path/to/new-lib_dir1 /path/to/new-lib_dir2

    Now-a-days, on Lubuntu at least, instead of adding an entry to '/etc/' you would either add an entry to an existing '.conf' file in '/etc/' or create a new '.conf' in '/etc/' and add the entry to that.