控制台上的linux kprint消息 [英] linux kprint messages on console

查看:108
本文介绍了控制台上的linux kprint消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了在控制台上打印此消息,我用kill -SIGKILL <pid>命令杀死了klogd并用klogd -s -c 2重新启动了klogd 我仍然在控制台上看不到该消息.我在这里想念什么? 预先感谢.

In order to print this meesage on console, I killed klogd with kill -SIGKILL <pid>command and restarted klogd with klogd -s -c 2 I still don't see the message on console. What do I miss here? Thanks in advance.

printk(KERN_ALERT "Hello World\n");

推荐答案

您必须确保您处于完全终端模式(按Alt + Ctrl + f2或f3),而不是图形模式.

You have to make sure you're in full terminal mode( press Alt+Ctrl+f2 or f3) and not Graphical mode.

然后检查/proc/sys/kernel/printk是否具有正确的值

then check if the /proc/sys/kernel/printk is having right values

# cat /proc/sys/kernel/printk

# cat /proc/sys/kernel/printk

4 4 1 7

4 4 1 7

my current setting are above. You can use echo 8 > /proc/sys/kernel/printk to print everything. for kern_alert 4 is enough.

my current setting are above. You can use echo 8 > /proc/sys/kernel/printk to print everything. for kern_alert 4 is enough.

for testing you can use below from full terminal mode.

for testing you can use below from full terminal mode.

#echo "<1>Writing critical printk messages from userspace" >/dev/kmsg

#echo "<1>Writing critical printk messages from userspace" >/dev/kmsg

这将打印到终端

http://elinux.org/Debugging_by_printing

kern_alert可以打印到当前终端,而kern_emerg则可以打印到所有终端.

kern_alert with print to current terminal while kern_emerg will print to all terminals.

这篇关于控制台上的linux kprint消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆