Meniu

Management of hotplug hardware and removable media

Starting with Mandriva Linux 2005 LE, HAL (Hardware Abstraction Layer) is used extensively to manage hotplug hardware (devices that are available immediately after connection, such as USB storage devices, digital cameras, hard disks). removable media) and removable media such as CDs or DVDs.

When a new device is connected to the system, a series of events occur in the following order:

- the kernel detects when the new hardware is connected and calls / sbin / hotplug (to load the kernel module and announce the interested applications) and udev (to create the related devices in / dev)
udev will send a signal to the hal (hald) daemon when devices are created / removed. udev will also apply PAM privileges to the created node, allowing the user logged in to the system (with low security settings, low) to access their devices without root privileges.
- hotplug will send a signal to the hal demon when hotplug events (hardware devices are connected / disconnected) occur.
hald, using a set of rules, updates the system configuration (system tree) and sends these configuration changes on the system bus (using dbus) to applications that "listen". Hald also calls fstab-sync to update fstab, add / remove entries for mount points, and create / remove mount points (in / mnt) if necessary.
- if a user is logged in to a graphical environment (such as KDE or GNOME), he should have GNOME Volume Manager running in the background (KDE still uses gvm for now until KDE volume manager is complete). gvm listens for events on the system bus (via dbus) and is notified when hald sends events about adding / removing hardware devices. Based on these events and its own configuration, gvm will either mount / unmount the new device (for usb memory stick or hard disk) or launch associated applications (eg when a digital camera is connected).

For removable media (such as CDs or DVDs), the path is shorter:

hald monitors the CD / DVD drive (or any other removable media drive, such as a ZIP drive) for a new media. If such an environment is inserted or ejected, the event is sent via dbus.
gnome-volume-manager "listens" after these events and will mount / unmount the respective mount points. If the environment is not a data environment (audio CD, video DVD), gnome-volume-manager will start the user scripts / etc / dynamic / user-scripts / which will try to launch an application specific to the working environment it is on. For example, if the user inserts a video DVD under GNOME, the totem player will be used; under KDE, caffeine will be used.

How to debug?

Now comes the confusing part of the problem… Connect a device and "it doesn't work!". To resolve this issue, you need to complete a bug report for the responsible package to help developers understand exactly what the cause is. The best way to find the cause is to use a differentiated diagnosis (as a medical diagnosis). Let's try this with a removable storage device: Connect a removable hard drive.

Do you see an icon on the desktop? if so, everything is fine, the test is over
No new desktop icon: check / etc / fstab to see if new mount points have been added for this device. If you are unsure, disconnect the device, check / etc / fstab, then connect the device, wait a little (10 seconds) and check again. If a mount point has been added and is mounted, report a bug in nautilus (for GNOME) or kdebase (KDE).
If / etc / fstab already contains a mount point, it means that gnome-volume-manager did not mount automatically. Check if gnome-volume-manager is running and if it is configured to automatically mount removable devices.

If set this way, check if hal has not been configured to close automount hint (read by gnome-volume-manager) in /etc/hal/hald.conf (storage_automount_enabled_hint).
If set, make sure this hint has not been closed specifically for the device you have. To do this, run hal-device-manager (from the hal-gnome package) and check the values ??for this parameter for the device you have.
If this hint is set, there is probably a bug in gnome-volume-manager that needs to be reported.
If this hint is not set, it was either closed with a purpose or by mistake or it may be a bug. This bug should be reported for the hal package.

If it /etc/fstabdoes not contain an entry for the mount point, either hal did not detect the device or did not create a mount point for it:

check if hald is running correctly (/etc/init.d/haldaemon status). Make sure dbus is also running (must be started before the haldaemon daemon), using /etc/init.d/messagebus status.
if hal is running correctly, try monitoring new hal events using hal-device-manager: start hal-device-manager, then connect (or disconnect) the device. The system tree in hal-device-manager should change (with a latency of up to 5 or 10 seconds).

if the tree does not change, hal has not received any hotplug events or does not know how to interpret it. Check syslog when connecting / disconnecting the device:

if the kernel sees something, it's probably a bug in the state.

if not, or a bug in the hotplug or kernel.

if the tree records the changes, it means that some parameters for this device are missing or wrong. You should report a bug like this.

When reporting a bug to hal or gnome-volume-manager, you should always add the "lshal" log to the report, which is a text representation of the HAL view on your system.

When testing removable media (such as CDs or DVDs), the scenario is simpler:

if you have a data environment:

enter the environment: if it is mounted automatically (desktop icon), everything is fine.
if it is not mounted, check that the mounting points are in order (see above). Try mounting the device manually. If it works, it means that gnome-volume-manager did not mount it correctly. You should also check if the hald is running correctly, as well as for dbus and gnome-volume-manager. Also check if gnome-volume-manager is configured to automatically mount removable media. Start hal-device-manager and check if the environment is detected. If everything seems fine, report a bug to gnome-volume-manager. If the environment is not detected by hal-device-manager, report a bug for hal.
you should also test that when you remove the medium it is disassembled correctly.

if the environment is not a data medium (audio CD, video DVD):

enter the environment: if the application is not started, check if it is activated in the gnome-volume-manager configuration. If so, run hal-device-manager to check if the new environment has been detected correctly:

if not detected, complete a bug report for hal.
if it is detected by hal-device-manager, try changing the application associated with another. Eject and re-enter the environment:

If the new application is detected, you have found a bug in the scripts used to launch the applications. Complete a bug report for the dynamic package

If no application is running, there is probably a bug in gnome-volume-manager that you should report.

FlorinM

Utilizator Linux - Solus OS, pasionat de calatorii.
  • | 2708 articole

Nici un comentariu inca. Fii primul!
  • powered by Verysign