Space Menu Home Downloads Newbie Area Documentation Knowledge Base E-Training Forum Blogs Chat RPMs Farm Linux Events
HistoryHistory |
View
Code | XML |
Help
XWiki Syntax |


Removable Storage VI EN COURS DE TRADUCTION

Summary

  • Hotpluggable hardware and removable media handling
  • Chronology
  • Comment débugguer ?
Section index - KB index

Hotpluggable hardware and removable media handling for Mandriva Linux 2005 (and later)

Starting with Mandriva Linux 2005 LE, HAL (Hardware Abstraction Library) is used extensively to handle hotpluggable hardware (like usb memory stick, digital cameras, removable hard-drives) and removable medias like CD or DVD.

Chronology

When an new device is plugged on the system, events occur in the following order (schematics can be found on here) :

  • kernel detect new hardware is plugged and call /sbin/hotplug (to load kernel module and notify interested applications) and udev (to create devices in /dev )
  • udev will signal hal daemon (hald) when devices are created/removed. udev will also apply pam console privilege on created node, allowing user physically logged on the system (in low security setting) to acces their devices without root privilege.
  • hotplug will signal hal daemon when hotplug events (hardware device plugged/unplugged) occur.
  • hald, using a set of rules, updates its system configuration view (tree based view) and send those changes in the configuration on system bus (using dbus) to listening applications. Hald also call fstab-sync to update fstab to add/remove mount point entries and create/remove mount points (in /mnt) if needed.
  • if a user is logged in a graphical environment (like KDE or GNOME), he should have GNOME Volume Manager running in background (KDE still uses gvm until KDE volume manager is complete). gvm listens to system bus events (over dbus) and is notified when hald send "hardware added/removed" events. Based on those events and its own configuration, gvm will either mount/unmount new devices (for usb memory stick or hard-drive) or start associated applications (when digital cameras is plugged).
For removable media (like CD or DVD), path is shorter :
  • hald monitors CD/DVD drive (or any other removable media drive, like ZIP drive) for new medium. If medium is inserted or ejected, event is send over dbus.
  • gnome-volume-manager listens for those events and will mount/unmount corresponding mount points accordingly. If medium is not a data medium (audio CD, video DVD), gnome-volume-manager will start user defined scripts from /etc/dynamic/user-scripts/ which will try to start application based on the current desktop environment.
For instance, if user is inserting video DVD under GNOME, totem will be used ; under KDE, kaffeine will be used.

Comment débugguer ?

C'est la partie délicate. Vous branchez un périphérique et "il ne marche pas". Pour régler ce problème, vous devrez peut être remplir un rapport de bug sur le logiciel concerné, pour aider les développeurs à comprendre quel est le problème exact. La meilleure manière de le faire est un diagnostique différentielle (comme fait un médecin ).

Essayons ça avec un périphérique de stockage amovible: un disque dur amovible.

  • Un icone aparait sur le bureau? C'est fini!
  • Pas d'icones sur le bureau : Vérifiez /etc/fstab si un point de montage a été rajouté pour votre périphérique. Si vous n'êtes pas certains, vérifiez /etc/fstab, débranchez le périphérique, attendez une dizaine de secondes et vérifiez le fichier à nouveau.
    • Si un point de montage est ajouté et que le périphérique est bien monté, faites un rapport de bug sur nautilus (GNOME) ou kdebase (KDE).
    • Si /etc/fstab contient une ligne décrivant votre périphérique, et qu'il n'est pas monté, cela veut dire que gnome-volume-manager ne l'a pas monté automatiquement.
    • Vérifiez si gnome-volume-manager tourne:
ps aux | grep gnome-volume-manager
et s'il est configuré pour monter automatiquement les périphériques amovibles.
  • Si c'est le cas, vérifiez ensuite si hal n'est pas configuré pour désactiver les montages automatiques (notifiés, donc, par gnome-volume-manager) dans /etc/hal/hald.conf (option storage_automount_enabled_hint)
( :note du traducteur: voici un exemple d'utilisation de cette option: http://www.shallowsky.com/blog/index.cgi/linux/hald-poll.html )
    • Si cette option est activée (true), vérifiez qu'elle n'est pas désactivée pour ce périphérique en particulier. Pour cela, lancez hal-device-manager (paquet hal-gnome) et vérifiez la valeur pour ce paramètre pour ce périphérique particulier.
    • Si cette option était activée(true), c'est probablement un bug dans gnome-volume-manager qui doit être reporté.
    • Si cette option est désactivée, cela a été fait, soit par accident, soit volontairement, soit c'est un bug. Dans ce dernier cas, reportez le pour le paquet hal.
  • Si etc/fstab ne contient pas de point de montage, soit hal n'a pas détecté correctement votre périphérique ou n'a pas créé le point de montage pour lui :
    • Vérifiez que hald tourne correctement (/etc/init.d/haldaemon status).
    • Vérifiez que votre système dbus tourne correctement (/etc/init.d/messagebus status).
    • Si hal tourne corréctement, il faut surveiller l'apparition d'événements dans hal avec hal-device-manager :
      • Lancez hal-device-manager, puis branchez ou débranchez le périphérique. L'arborescence du système dans hal-device-manager doit se modifier (latence: 5 à 10 s).
      • Si la vue ne change pas, hal n'a pas reçu d'événement ou ne savait pas comment agir à ces événements.
      • Vérifiez syslog (en root: tail -vf /var/log/syslog&) en débranchant/rebranchant votre périphérique
      • Si le kernel ne voit pas de modification, c'est un bug dans hal.
      • Sinon, c'est un bug hotplug (coldplug en 2006) ou kernel.
      • Si la vue a été modifiée, le bug doit être reporté en tant que bug hal.
Quand vous faites un rapport de bug sur hal or gnome-volume-manager, il faut toujours inclure ce que rapporte "lshal". Il produit une représentation textuelle de votre système qui sera utile aux développeurs.

When testing removable media (like CD or DVD), scenario is easier :

if your medium is a data one :

  • insert medium : if it is automatically mounted (icon on desktop), everything is fine.
  • if is isn't mounted:
    • check if mount point are ok (see above for that).
    • Try manually mounting the device. If it works, it means gnome-volume-manager didn't mount it correctly.
    • You should check if hald is running correctly, as well as dbus system bus and gnome-volume-manager.
    • Also check if gnome-volume-manager is configured to automount removable media. Start hal-device-manager and check if medium is detected.
    • If everything seems ok, report a bug for gnome-volume-manager.
    • If medium is not detected by hal-device-manager, report a bug on hal.
    • you should also test when ejecting medium that it is correctly unmounted.
  • if your medium is a non data one (audio CD, video DVD) :
    • insert medium : if application is not started, check if it enabled in gnome-volume-manager configuration. If it is, run hal-device-manager to check if new medium was correctly detected :
    • if it is not detected, file a bug report on hal.
    • if it is detected by hal-device-manager, try changing the associated application with any other application. Eject and insert again your application :
    • If the new application is detected, you have found a bug in scripts used to start applications. Fill a bug on dynamic package
    • If no application is started, it is probably a bug in gnome-volume-manager you should report.
Revision / Modified: 20 May 2005
Author: Frederic Crozat

Legal and original text

RSS
KB.HardwareHremov6 fr Last Author: moula_2559  Date: 2006/01/13 16:00
Powered by XWiki
Copyright (c) 2006 Mandriva