# How to make kernel more verbose?

## petrjanda

Lets say I plugin a USB disk, I want to see an output from the kernel in the terminal, saying something like "/dev/sdc: SCSI-2 device connected".

Possible?

----------

## codergeek42

You could find the specific parts of the code and add printk(...) calls  :Confused:  *shrug*

----------

## petrjanda

Seems like too much of a problem. In FreeBSD when I connect my USB flash disk, it prints out that a devices has been connected in the terminal.

----------

## codergeek42

Are you actually looking at the kernel messages? Do you have a system logger running? Try switching to vt0 by pressing Ctrl+Alt+F1 then Alt+[<--] (left arrow key).

----------

## petrjanda

 *codergeek42 wrote:*   

> Are you actually looking at the kernel messages? Do you have a system logger running? Try switching to vt0 by pressing Ctrl+Alt+F1 then Alt+[<--] (left arrow key).

 

Yes, Im running metalog.

----------

## transient

Theres a whole heap of verbose settings in the kernel config. I had my previous kernel spitting out message for most of the subsystems when I was trying to debug some udev notification stuff, but I cant recall what the options are.

----------

## brantgurga

If you use udev.conf, you can set an option in udev.conf to have it log when it adds and removes device nodes.

----------

## petrjanda

 *brantgurga wrote:*   

> If you use udev.conf, you can set an option in udev.conf to have it log when it adds and removes device nodes.

 

whats the option called?

----------

## petrjanda

 *transient wrote:*   

> Theres a whole heap of verbose settings in the kernel config. I had my previous kernel spitting out message for most of the subsystems when I was trying to debug some udev notification stuff, but I cant recall what the options are.

 

Can you try to remember by looking at the kernel menuconfig? Was it in the "kernel hacking" option or somewhere close?

----------

## transient

I would have, but Im on winXP, and havnt been on linux since november or so last year -_-

Linux will be back on in a week or so.

But I think the master setting was in the kernel hacking options. You turned that setting on, and the verbosity/error options in other sections were enabled.

----------

## gentsquash

In 

```
make menuconfig
```

you can try typing

/verbos

(the "/" introduces a string search).  This should find both

"verbose" and "verbosity" and ought to give you half-a-dozen

options to have more information displayed.

----------

## petrjanda

How do I get this to appear in the terminal also?

From the kernel log:

```

Feb  9 09:35:46 [kernel] usb 1-2: new high speed USB device using ehci_hcd and address 5

Feb  9 09:35:46 [kernel] scsi2 : SCSI emulation for USB Mass Storage devices

Feb  9 09:35:51 [kernel]   Vendor: USB 2.0   Model: Flash Disk        Rev: 0.00

Feb  9 09:35:51 [kernel]   Type:   Direct-Access                      ANSI SCSI revision: 02

Feb  9 09:35:51 [kernel] SCSI device sdc: 512000 512-byte hdwr sectors (262 MB)

Feb  9 09:35:51 [kernel] sdc: Write Protect is off

Feb  9 09:35:51 [kernel] sdc: assuming drive cache: write through

Feb  9 09:35:51 [kernel] SCSI device sdc: 512000 512-byte hdwr sectors (262 MB)

Feb  9 09:35:51 [kernel] sdc: Write Protect is off

Feb  9 09:35:51 [kernel] sdc: assuming drive cache: write through

Feb  9 09:35:51 [kernel] SCSI error: host 2 id 0 lun 0 return code = 8000002

Feb  9 09:35:51 [kernel] _Sense class 7, sense error 0, extended sense 0

Feb  9 09:35:51 [kernel] Attached scsi removable disk sdc at scsi2, channel 0, id 0, lun 0

Feb  9 09:35:51 [kernel] Attached scsi generic sg2 at scsi2, channel 0, id 0, lun 0,  type 0

```

----------

## transient

if it doesnt show in 

```
dmesg
```

 which it may not, you would need to tail your main log file, which is usually /var/log/messages if youre using syslog-ng.

Oh yes, I just re-installed gentoo  :Very Happy: , and the option to increase the size of the ring-buffer etc.. is found in the kernel hacking section. You need to enable the Kernel Debugging option, and then that will enable extra logging options in the earlier config sections.

----------

## petrjanda

 *transient wrote:*   

> if it doesnt show in 
> 
> ```
> dmesg
> ```
> ...

 

It shows in dmesg, but I want it to show in the terminal! How would increasing the ring-buffer size make it show in the terminal i just dont understand.  :Confused: 

```

x x                          [*] Kernel debugging                                                     x x  

  x x                          [ ]   Magic SysRq key (NEW)                                              x x  

  x x                          [ ]   Collect scheduler statistics (NEW)                                 x x  

  x x                          [ ]   Debug memory allocations (NEW)                                     x x  

  x x                          [ ] Debug preemptible kernel                                             x x  

  x x                          [ ] Spinlock debugging (NEW)                                             x x  

  x x                          [ ] Sleep-inside-spinlock checking (NEW)                                 x x  

  x x                          [ ] kobject debugging (NEW)                                              x x  

  x x                          [ ] Compile the kernel with debug info (NEW)                             x x  

  x x                          [ ] Compile the kernel with frame pointers                               x x  

  x x                          [ ] Check for stack overflows (NEW)                                      x x  

  x x                          [ ] Kprobes (NEW)                                                        x x  

  x x                          [ ] Stack utilization instrumentatio

```

Which one will make it show in the terminal?

----------

## transient

By terminal, do you mean something like an xterm, or an actual terminal?

If you want it to echo to the terminal you login on (vt/1 or whatever), then youd need to edit your sysloggers config file and redirect whatever output you wanted to that console.

If youre meaning to an xterm/Eterm etc.. then its easy to do. Just start up 

```
tail -f /var/log/messages
```

 in a terminal emulator, assuming youre using syslog-ng.

----------

## thersites

Are you looking for root-tail?

I have

```
exec root-tail -f -fn  "-misc-fixed-*-r-*-*-14-*-*-*-*-*-*-*" -g 1000X600+20+20 --wordwrap /var/log/kernel/current,blue
```

in my ~/.ratpoisonrc. 

And then with metalog you simply need to change the permissions in /var/log so that the file you want can be read by your user.

----------

## petrjanda

 *transient wrote:*   

> 
> 
> If youre meaning to an xterm/Eterm etc.. then its easy to do. Just start up 
> 
> ```
> ...

 

Thanx thats what I meant. But it still requires me to have a particular xterm window open just for the kernel messages

----------

