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?
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
syslog mentioning this to you on the console. You could know this for sure yourself, by killing
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
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
kernel.printk = 3 3 3 3
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.