Worker Worker - 6 months ago 16
Linux Question

Running command on bootup before rc.local

I'm running Debian on Beagle Bone computer.
What I want is disabling dmesg output to console whenever USB drive is inserted.

'dmesg -D' does the trick, however putting it in rc.local does not work for me, because if USB is inserted before booting up the computer, first I get the message and only then is dmesg disabled for future messages.

Essentially, I want to run the 'dmesg -D' before computer mounts the USB drive.

I briefly looked into init.d but I cannot figure out the sequence in which these are executed.

Thank you.

Answer

I'd argue you can get better answers on Server Fault, since this is a question of system administration rather than scripting.

Yet, (although i'm not an expert on Linux Kernel boot) i can point you towards two options. First you might look at:

console=tty3

And set it to a completely different tty than the one that is being displayed.

Another option would be:

loglevel=3

Where 3 is ERROR, and the kernel will not print any message that is above that debug level. This might be dangerous because that means it will not log it anywhere not only leaving it out of the console.

You set the kernel boot parameters in GRUB (or another bootloader you might be using) after the kernel image path. To test the configuration you can force it in GRUB by pressing e and editing the boot parameters. For example

kernel /boot/vmlinuz-linux loglevel=3

Disclaimer: I have not tried it and actually never used console= (although i did use loglevel=).

Comments