• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Urban Penguin

The Urban Penguin - Linux Training

  • Home
  • About
  • Live Online Courses
  • Shop
  • Programming
    • Master Editing Text Files Using VIM
    • Learn Shell Scripting with BASH
    • PERL Scripting in Linux
    • Ruby Scripting in Linux
    • Scripting with PowerShell
    • Learn C Programming using Linux and the Raspberry Pi
    • General Java Tutorials
    • Java 7 OCA Exam 1ZO-803
  • OS Tutorials
    • Red Hat and CentOS Training
      • Red Hat Enterprise Linux System Administration 1 – RH124
      • RHCSA – System Admin 2 – RH134
      • RHCE – EX294 – Automation With Ansible
    • Learning Ubuntu
    • LPI Training
      • LPI Linux Essentials
      • LPIC-1 Linux Administrator
      • LPIC-2 Certified Linux Engineer
      • LPIC-3 Senior Level Certification
        • LPIC-3 Exam 300 : Mixed Environments
        • LPIC-3 Exam 303 : Security
        • LPIC-3 Exam 304 : Virtualization and High Availability
    • Linux Technologies
      • Apache HTTPD Server
      • Learning PHP
      • Learning PUPPET
      • Learning SAMBA
      • Linux File-Systems
      • Monitoring with Nagios Core
      • MYSQL
      • openLDAP Directories on Linux
You are here: Home / Linux / CentOS / Kernel Runtime Management and Troubleshooting

Kernel Runtime Management and Troubleshooting

May 27, 2014 by The Urban Penguin

LPIC-2-201This objective of LPIC-2 201 is mainly about understanding how to load and unload kernel modules. Of course much of the time this is handled automatically as the hardware is detected and there is little that we have to do. But of course those times it goes wrong or where we perhaps are testing different drivers we have to know what happens behind the scenes. To begin we can run the command :

uname -r

This will report the kernel version. We could also read this from the file in the procfs:

cat /proc/version

The uname command can be useful. If we want to go the the directory for the running kernel modules we can use the command:

cd /lib/modules/$(uname -r)

To list the running modules, modules loaded by the kernel we can use the command:

lsmod

lsmod

From the output we can see that the module cdrom is in use by the module sr_mod, note the used by column. We can can’t unload the cdrom module until the module sr_mod is unloaded. We can also view the loaded modules via the file /proc/modules.



To unload module we can use rmmod or modprobe -r:

modprobe -r sr_mod OR
rmmod sr_mod
modprobe -r cdrom OR
rmmmod cdrom

Loading the modules can be made with modprobe or inssmod. Modprobe is far more convenient:

  • Does not need to full path whereas insmod does
  • Will load the required modules where insmod needs you to load each module in the correct order

To show you this we can use modprobe with the -v option. With both sr_mod and cdrom modules unloaded:

modprobe -v sr_mod

modprobe-v

We can see the insmod is used in the background that needs the full path to the module and the dependency module is also loaded. The dependencies are maintained via the file:

/lib/modules/$(uname -r)/modules.dep



The command modinfo can be used to display information about a module including the full path to the module file and and options that it may accept during the load phase. These options can be applied automatically each time the module loads though configuration files in /etc/modprobe.d/. We can also apply aliases to module names here, this is often when a program will call one module but you would like another used:

alias kangaroo cdrom

Now we can use

modprobe kangaroo

And the cdrom module will load.

 

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to print (Opens in new window)

Filed Under: CentOS, LPIC-2 Exam 201

Primary Sidebar

Newest Video

The Urban Penguin On Youtube

Categories

Pages

  • About The Urban Penguin
  • Contact Us
  • Shop
    • Basket
    • Checkout
    • My Account
  • LPI Training from The Urban Penguin
    • Live and Pluralsight hosted courses
    • Complete Linux Essentials
    • LPIC-3 Senior Level Certification
      • LPIC-3 Exam 300 : Mixed Environments
      • LPIC-3 Exam 303 : Security
      • LPIC-3 Exam 304 : Virtualization and High Availability
    • LPIC-2 Certified Linux Engineer
    • LPIC-1 Linux Administrator
    • LPI Linux Essentials for Raspberry Pi
    • LPI Linux Essentials
  • Operating System Tutorials
    • Linux Foundation Training
    • Solaris 11 OCA 1ZO-821
    • Learning Ubuntu
    • Learning SUSE
    • Red Hat and CentOS Training
      • RHCE – EX294 – Automation With Ansible
      • RHCSA – System Admin 1 – RH124
      • RHCSA – System Admin 2 – RH134
  • Scripting – the power of repetition!
    • Java 7 OCA Exam 1ZO-803
    • General Java Tutorials
    • Learn C Programming using Linux and the Raspberry Pi
    • Ruby Scripting in Linux
    • Scripting with PowerShell
    • PERL Scripting in Linux
    • Learn Shell Scripting with BASH
    • Master Editing Text Files Using VIM
  • Linux Technologies
    • Learning PUPPET
    • openLDAP Directories on Linux
    • Monitoring with Nagios Core
    • Linux File-Systems
    • Learning SAMBA
    • Apache HTTPD Server
    • Learning PHP
    • MYSQL
  • OpenStack
    • Pluralsight
    • Udemy
    • Raspberry Pi Tutorials
    • Citrix Videos
  • Online Instructor-led Courses
    • Red Hat Enterprise Linux System Administration 1 – RH124
    • SELinux Masterclass
    • Bash Scripting Masterclass
    • Nftables Masterclass

© 2021 The Urban Penguin · All Rights Reserved