LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2009, 04:45 PM   #1
joeuser123
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
dmesg output to tty


I have what I believe is a simple question...

I would like to add a line to the inittab that will create a terminal console, lets say tty11, and I would like that console to display the output from dmesg. (this tty will have no other purpose in life but to output dmesg)

this would allow me to press alt+f11 at any time to view anything that might have changed/updated both during the boot process and after.

thanks
 
Old 02-26-2009, 10:15 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
bash -c "dmesg >/dev/tty11"
 
Old 02-26-2009, 10:19 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
but dmesg is not streaming kernel messages...
better:

bash -c "cat /proc/kmsg >/dev/tty11"
 
Old 02-26-2009, 10:24 AM   #4
joeuser123
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you Agrouf, so I just need to add:

bash -c "cat /proc/kmsg >/dev/tty11"

to the bottom of my inittab?
 
Old 02-26-2009, 12:04 PM   #5
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
In inittab, you add a line like (in you are running standard sysV init):
c7:2345:respawn:bash -c "cat /proc/kmsg >/dev/tty11"
or you can add it anywhere in your boot process (like in /etc/rc.d or anywhere your distro execute the code)

Last edited by Agrouf; 02-26-2009 at 12:05 PM.
 
Old 02-26-2009, 12:24 PM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
try adding the following to the kernel arguments in /boot/grub/menu.lst

console=tty11
 
Old 02-26-2009, 04:09 PM   #7
joeuser123
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
I have tried placing the:

c7:2345:respawn:bash -c "cat /proc/kmsg >/dev/tty11"

line in the inittab and I get messages on tty1 saying that c7 will be halted for 5 min.
when I switch over to tty11 I see no output

also tried:

c7:2345:respawn:bash -c "dmesg -c >/dev/tty11"

while I was able to see the information I expected to see on tty11 but I was unable to scroll up or down, and I was still recieving the c7 will be halted for 5min messages on tty1


I like the output generated by dmesg, it is helpful when different events trigger... such as inserting a usb device ...it is also helpful to be able to see what is going on during the boot process, so I can learn how things are being loaded.

I must be missing something...

as for the console=tty11 setting, I do not have the /boot/grub/menu.lst file.

Last edited by joeuser123; 02-26-2009 at 04:11 PM.
 
Old 02-26-2009, 04:22 PM   #8
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
/boot/grub/grub.conf ?
 
Old 02-26-2009, 04:33 PM   #9
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
another thought would be to create a shell script
such as
Code:
#!/bin/bash
x=0
while ((x==0))
do
dmesg | tail
for ((z=1;z<=1000000;z++)) do y=3;done
done
log in to any existing tty that you don't plan to use
and run the script
the above example runs dmesg, waits, dumps dmesg again etc.. until you kill the program with ctl-c
or a more fancy example
Code:
#!/bin/bash
x=0
while ((x==0))
do
dmesg | tail --lines=(number of lines to dump) > /dev/tty11
for ((z=1;z<=1000000;z++)) do y=3;done
done
which would dump the last (number of lines) from dmesg to /dev/tty11
and could be run at any terminal by sh myscript.sh&

Last edited by frieza; 02-26-2009 at 04:38 PM.
 
Old 02-27-2009, 12:25 AM   #10
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
does it work if you just type bash -c "cat /proc/kmsg >/dev/tty11" on the terminal as root?
expected result: the command should hang and you should see kernel messages on /des/tty11 (only new messages, not old ones). At first if will not print anything but if you insert a module it should be printed there.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
my dmesg output looks really weird *Xenny* SUSE / openSUSE 7 08-10-2006 06:35 AM
please translate my dmesg output for me... Adrian Baker Linux - Software 2 07-27-2005 03:26 PM
cannot understand some dmesg output ninadb Slackware 8 06-29-2005 04:49 PM
dmesg output cranium2004 Linux - Newbie 1 01-27-2005 02:03 AM
dmesg output safrout Slackware 6 05-18-2003 11:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration