Lesson 6: Managing Kernel Modules Flashcards

1
Q

What is a Kernel Space?

A

This is where the kernel executes the services that it provides with full system privileges. Typical only includes critical software (modules, drivers, services, SELinux).

note. user space, will include everything else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two classifications of the Linux Kernel?

A
  • Monolithic (bigger, faster, uses a lot of RAM, less secure)
  • Microkernel (small, more stable, slower, other modules are stored in user space. runs the minimum amount ofresources necessary)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you view which kernel you are running?

A

uname -a (give all details)

  • r view the kernelversion number of your current system
  • i to view the hardware platform
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the several layers that operate in kernel space?

A

System CallInterface (SCI) (handles system calls sent from user applications to the kernel)

Process management (handles different processes by allocating separate execution space on the processor and ensuring that the running of one process does not interfere with other processes)

Memory management (manages the computer’s memory)

File system management (manages the filesystem, which involves storing, organizing, and tracking files and data on a computer, also supports a virtual file system (VFS))

Device management (manages devices by controlling device access and interfacing between user applications and hardware devices of the computer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where can you view the Kernel files?

A

Can be view in /boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Vm Linuz ?

A

Vm Linuz is your kernel file that gets booted up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where can you view the kernel modules?

A

Can be viewed in /use/lib/modules or /lib/modules (in some distributions).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Kenel Modul subdirectories - Inside /usr/lib/modules//kernel/ are severalsubdirectories

A

archArchitecture-specific support.

crypto Encryption and other cryptographic functions.

drivers Various types of hardware.

fs Various types of file systems.

net Networking components such as firewalls and protocols.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command shows modules?

A

lsmod

allow you vies all modules and their status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the advantages of kernel modules are?

A

They reduce the burden on the kernel because otherwise all of the modules’functionality would have to be added directly to the kernel.

Dynamic loading of kernel modules facilitates lower memory consumption.

They avoid having to rebuild and reboot the system when new functionality isrequired.

note. kernel module file consists of a .ko extension. Modules built for a specific kernelversion may not be compatible with another version of the kernel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How you view information about a module?

A

modinfo {module_name or file_name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you install a module?

A

insmod {file_name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you delete a module?

A

rmmod {mod_name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you enable a module?

A

Tell the system to probe for new hardware using modprobe.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you specify hardware you don’t loaded?

A

create a .conf file in /etc/modprobe.d and specify that hardware and the rules that apply

alias {alternative name} {module name}Specify an alternative name for a module with along name.

blacklist {module name}Ignore internal aliases, which occur whenmodules define their own aliases.

install {module name} {command}Run the specified command without inserting themodule into the kernel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can you add or remove modules from a kernel?

A

Use modprobe, syntax of the modprobe command is modprobe [options] [module names]

Options:

  • a to add a module
  • r oTo unload/remove a module, use th
  • f Force the module to be inserted or removed.
  • n Conduct a dry run, i.e., output results without actually executingoperations.
  • s Print errors to the system log (syslog) rather than stderr.
  • v Enable verbose mode.
17
Q

How would you update the database of dependencies so that modprobe can function properly?

A

Use the depmod command which searches the contents of /lib/modules// for each module

The syntax of the depmod command is depmod [options]

18
Q

How would you view and edit Kernal options?

A

Kernel options can be views using the sysctl (system control). The syntax of the sysctl command is sysctl [options]

options:

  • a allows you to view all Kernal parameters getting passed to Kernal.
  • w {parameter}={value}Set a parameter value.
  • p [file name]Load sysctl settings from the specified file,or /etc/sysctl.conf if no file name isprovided.
  • e Ignore errors about unknown keys.
  • r {pattern}Apply a command to parameters matching agiven pattern, using extended regularexpressions.
19
Q

What is the /proc/ directory ?

A

directory is a virtual file system (VFS) that provides significantinformation about the kernel’s running process

Here are some common files in this directory:

/proc/cmdlineOptions passed to the kernel by the boot loader at boottime, such as mounting the kernel as read-only.

/proc/cpuinfoCPU information, such as its architecture, name, clockspeed, cache size, and more.

/proc/devicesA list of character and block device drivers loaded intothe currently running kernel.

/proc/filesystemsA list of file systems types that are supported by thekernel, as well as if any are currently mounted.

/proc/meminfoInformation about RAM usage, including total memory,free memory, and much more.

/proc/modulesInformation about modules currently installed on thesystem. An alternative to the lsmod command.

/proc/statVarious statistics about the system since it was lastrebooted.

/proc/version file specifies several points of information about the Linuxkernel:•The version of the Linux kernel currently running.•The version of the GNU Compiler Collection (GCC) used to compile the kernel.• The user name of the kernel compiler.• The time the kernel was compiled.

20
Q

How would you print messages that have been sent to the kernel’s message buffer?

A

Use the dmesg (“display message” or “driver message”) command. The syntax of the dmesg command is dmesg [options]

Options:

  • c Clear the kernel buffer after printing its contents
  • f {facility list} Restrict output to the specified comma-separated list of facilities.
  • l {level list} Restrict output to the specified comma-separated list of levels.
  • e Display a human-readable version of the time of each message as well as its delta, or the difference in time between subsequent messages.
  • L Color-code messages for easier readability.
  • H Output in a human-friendly format, combining both -e and -L options and using a text pager.
  • h List the available options, as well as the available facilities and levels.