Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I plug in a usbhub (7 sticks in) udev displays a lot of messages in console. Can I hide these messages or send them to /dev/null?

share|improve this question
add comment

2 Answers 2

On CentOS, I don't get udev messages when I plug in a simple USB thumbstick. Instead I get:

[sdb] Assuming drive cache: write through

a couple of times.

But this isn't udev, or syslog mentioning this to you on the console. You could know this for sure yourself, by killing syslogd or rsyslogd (Please make sure this isn't a production server, which I hope it is not what with inserting USB hubs and all that :) and re-inserting the USB device.

The messages still popup, so as Ulrich mentioned, this is coming from the kernel, or the USB module to be exact, which uses kernel.printk to show you these messages, not using any system services at all.

An excerpt from the linux documentation sysctl/kernel.txt:

The four values in printk denote: console_loglevel, default_message_loglevel, minimum_console_loglevel and default_console_loglevel respectively.

These values influence printk() behavior when printing or logging error messages. See 'man 2 syslog' for more info on the different loglevels.

  • console_loglevel: messages with a higher priority than this will be printed to the console
  • default_message_level: messages without an explicit priority will be printed with this priority
  • minimum_console_loglevel: minimum (highest) value to which console_loglevel can be set
  • default_console_loglevel: default value for console_loglevel
    #define KERN_EMERG    "<0>"  /* system is unusable               */
    #define KERN_ALERT    "<1>"  /* action must be taken immediately */
    #define KERN_CRIT     "<2>"  /* critical conditions              */
    #define KERN_ERR      "<3>"  /* error conditions                 */
    #define KERN_WARNING  "<4>"  /* warning conditions               */
    #define KERN_NOTICE   "<5>"  /* normal but significant condition */
    #define KERN_INFO     "<6>"  /* informational                    */
    #define KERN_DEBUG    "<7>"  /* debug-level messages             */

So using the above mentioned values for arguments to printk, you can get the kernel to shut up about informational messages or simple warnings on the console. For example,

echo "3 3 3 3" > /proc/sys/kernel/printk

made my insertions of the USB thumbstick go all quiet. Do you want to make it stick through a reboot, add a line to /etc/sysctl.conf:

kernel.printk = 3 3 3 3
share|improve this answer
add comment

Yes, by changing to a different syslog channel, provided you understand how syslog works:

From udev manual:

   udev_log
          The logging priority which can be set to err ,info or the corre-
          sponding numerical syslog(3) value.  The default value is err.

So now you could edit /etc/udev/udev.conf and change this value.

share|improve this answer
    
okay thanks for answering. How can I find out, which Syslog value I have to use that all usb-udev messages are hidden? –  jonas Aug 8 '12 at 8:19
    
Do I have to use the the values of "Facility Level" or of "Severity Level"? See en.wikipedia.org/wiki/Syslog#Facility_Levels –  jonas Aug 8 '12 at 12:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.