Auteur Sujet: Enable kernel polling  (Lu 1769 fois)

0 Membres et 1 Invité sur ce sujet


  • Invité
Enable kernel polling
« le: 21 mars 2013 à 22:08:31 »
While doing research on getting SpaceFM to automount inserted removable volumes, I came across these instructions.

When using SpaceFM without udisks, and without the udisks-daemon running, you may need to enable kernel polling for device media changes to be detected. For example, if you insert a CD and SpaceFM still says 'no media', this is a symptom that kernel polling is not enabled.

Kernel polling is a new feature of the Linux kernel and udev, so most distros don't yet have it enabled. Even if you are using udisks, enabling kernel polling is recommended to eliminate the need for udisks to do userspace polling. Kernel polling also corrects a common issue where the eject button on a drive won't respond with the newer udev when udisks is not used.

To use kernel polling, your Linux kernel needs to be 2.6.38 or newer, and udev must be version 173 or newer.

You can deterime if kernel polling is enabled by running these commands:

    cat /sys/module/block/parameters/events_dfl_poll_msecs
    cat /sys/block/sr0/events_poll_msecs
If you get 0 or -1 from those commands, then it's probably disabled.
To enable kernel polling temporarily, enable common polling for the block module:

    sudo bash -c 'echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs'
Any number between 2000 and 5000 (milliseconds) should be reasonable - the higher 5000 means poll every 5 seconds, which is less overhead but a little slower.
OR you can enable polling just for a single device like this (/dev/sr0 in this example):

    sudo bash -c 'echo 2000 > /sys/block/sr0/events_poll_msecs'
The change should be immediate - media will be detected and the eject button on the drive should work normally again. However, the above changes will be lost when you reboot.
To make polling permanent (survives a reboot), add one of the above commands to your /etc/rc.local file (anywhere before the 'exit' line in that file), like this (without the sudo):

    echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs
OR you can pass this option to the kernel boot command line in grub:

Hors ligne melodie

  • Administrateur
  • Membre Héroïque
  • *****
  • Messages: 1675
    • Citrotux
Re : Enable kernel polling
« Réponse #1 le: 22 mars 2013 à 00:33:10 »
This might be interesting to test and probably useful sometimes. Thanks.

Good leaders being scarce, following yourself is allowed.


  • Invité
Re : Enable kernel polling
« Réponse #2 le: 22 mars 2013 à 00:46:54 »
I've already implemented it in 4 Debian installs. Works flawlessly, so far.