Table of Contents
Gestione delle periferiche e moduli kernel
Modprobe
See http://www.webservertalk.com/message861635.html.
Quando viene caricato un modulo con modprobe
(da riga di comando, da Discover, Hotplug o altro) il comportamento è determinato da alcuni file di configurazione.
Kernel 2.6 | /etc/modprobe.d/* | Files in this directory will tell which modules will be loaded and how. In a Debian system with a kernel 2.5.48 or above, kernel modules are managed with module-init-tools package. For the syntax of files contained in this directory, see man modprobe.conf(5) or modprobe.d . |
---|---|---|
Kernel 2.6 | /etc/modprobe.conf | Deprecated, use /etc/modprobe.d/* instead. If this file exists, it will be used by module-init-tools and files from /etc/modprobe.d/* will be ignored. |
Kernel 2.4.x | /etc/modules.conf | Refer to the Debian package modutils , intended for 2.4 kernels. This file tells modprobe which modules to load and how, using keywords like alias , post-install , above , etc. With Debian this file is generate by update-modules , merging pieces from /etc/modutils/* . |
Kernel 2.4.x | /etc/modutils/* | In a Debian system the /etc/modules.conf is generated by update-modules merging files from this directory. |
Kernel 2.4.x | /etc/conf.modules | Deprecated, use /etc/modules.conf instead. |
/etc/modules
List of kernel modules to be loaded. Edit it by hand to force loading of modules not loaded by discover, hotplug or others.
Discover
NOTE: starting from Debian Etch, it is preferable to install the udev
package instead of discover
and/or hotplug
.
Instead of using /etc/modules
file, with Discover you can try an automatic approach in loading kernel modules.
Discover is a tool that reports information about a system's hardware, it supports many methods for querying the host operating system (OS) about installed devices. Discover's role is to answer questions like “What Linux kernel module do I need to load for this device to work?”.
Two applications are provided with Discover: the command-line utility discover - which provides an extensible hardware detection and reporting interface - and discover-modprobe which loads Linux kernel modules identified by discover. It will typically be invoked automatically at boot time.
In the configuration file /etc/discover-modprobe.conf
you can control which categories of hardware do you want kernel modules automatically modprobed for. With this line every suitable module will be modprobed:
types="all"
Available types are: audio, bridge, broadband, display, fixeddisk, humaninput, imaging, miscellaneous, modem, network, optical, printer, removabledisk, tape and video.
Hotplug
NOTE: in Debian Etch the package the udev
is the prefferred choice instead of hotplug
.
Hotplug is mainly intended to let the kernel notify user mode software when hardware related events take place. But this means also that hotplug will load modules when devices are found say at bootstrap on PCI bus. To prevent some modules to be loaded, add a file /etc/hotplug/blacklist.d/local
and list the module names to be skipped.
If you want to entirely disable hotplug functionality for a single bus type (e.g. PCI), remove execute permission from the script /etc/hotplug/pci.agent
.
udev
This should be the preferred way, on a modern Debian system, to automatically load kernel modules, to handle hotplug events and to dynamically create devices into /dev/
hierarchy. See filesystem virtuali in Linux.
Automount
Mounting devices by unprivileged user, automounting of devices, CD-ROM, USB keys, USB cameras, … those issues in a modern Debian system (Etch) are addressed by several programs:
udev | Daemon for the kernel hotplug events. Manages the creation of devices into /dev/ , symlinks creation, permission and ownership assignment, execution of scripts. The configuration of udev consists of rule files contained into /etc/udev/ . |
---|---|
pmount | Mount arbitrary hotpluggable devices as normal user. The standard mount(8) program allow a normal user to mount devices only if there is a suitable entry into /etc/fstab . The program pmount instead is a wrapper around mount , you must belong to the plugdev group to run the program (Debian specific). The device will be mounted under the /media/ directory. |
fuse | Filesystem in USErspace. This is an alternative to the mount and pmount programs, which need superuser privileges. It runs in user space with the help of the kernel module fuse : a virtual filesystem will be created on the mount point. An example use of this program is gphotofs , used to mount digital cameras as a filesystem, entirely as a normal user. |
hal | Hardware Abstraction Layer. HAL is a piece of user-space software that maintains a list of device with well-defined properties for each device. Existing libraries can adopt HAL for accessing devices. The simplest use-case would be accessing a camera. The application programmer uses HAL for finding a camera device; he then tosses the HAL device id to the camera library and gets the pictures. |
We let hal
run as normal user, do not modify /etc/fstab
at all and instead use a program called pmount
(policy mount) that allows normal users to mount removable devices without an /etc/fstab
entries.
Introducing a new group called plugdev
. Every user who is a member of this group can access hotpluggable devices (digital cameras, USB drives etc.). pmount can only be executed by members of this group (it is root:plugdev 4754), hal runs in this group to be able to detect file systems (but it does not run in disk
), and udev assigns the plugdev
group to removable devices (static drives remain in group disk
).
Supermount e Autofs
Per rendere più o meno automatico il montaggio di filesystem (CD-ROM, Floppy, USB, network share, …) sono state sviluppate diverse soluzioni.
Supermount | Adottata principalmente da Mandrake, per floppy e CD-ROM. Non supporta share NFS. Disponibile come patch per il kernel. Vedere supermount-ng. |
---|---|
AutoFS | Nasce per dischi di rete, ma può essere adattata ad altri casi. Integrata nel kernel di Linux a partire dalla versione 2.2 |
Montaggio file system
Secondo i dettami di FHS (http://www.pathname.com/fhs/) deve esistere la gerarchia /media che contiene i punti di montaggio per floppy, cdrom, eccetera. Si estende il concetto e si creano anche punti di montaggio per cose non standard, ad esempio partizioni Windows o share NFS.