勉強前イメージ
あんま見ることないけど、結構時間わからんし読みづらいとこある
調査
そもそもdmesgとは
display message の略で、linuxで使われているコマンドまたはファイル。
カーネル 起動(ブート)時のログを表示します。
カーネルとはOSの中核を興師会するソフトウェアで、メモ地の割り振りなどソフトウェアとハードウェアの仲介を行います。
dmesgは リングバッファ を採用していて
上限に達すると古いものから消えてしまいます。
dmesgを見てみる
- 普通に見てみる
dmesgコマンドでも見てみました。
ちょっと見づらい
[root@localhost ~]# dmesg | tail
[362394.206653] 23:56:08.282800 control Session 0 is about to close ...
[362394.206856] 23:56:08.283389 control Stopping all guest processes ...
[362394.206990] 23:56:08.283507 control Closing all guest files ...
[362394.223095] 23:56:08.299573 control vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
[362394.563247] e1000: enp0s3 NIC Link is Down
[362394.567416] e1000: enp0s8 NIC Link is Down
[362396.528629] 11:01:09.710113 timesync vgsvcTimeSyncWorker: Radical host time change: 39 909 566 000 000ns (HostNow=1 649 156 469 710 000 000 ns HostLast=1 649 116 560 144 000 000 ns)
[362398.572653] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[362398.589702] e1000: enp0s8 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[362406.529397] 11:01:19.710897 timesync vgsvcTimeSyncWorker: Radical guest time change: 39 909 107 063 000ns (GuestNow=1 649 156 479 710 863 000 ns GuestLast=1 649 116 570 603 800 000 ns fSetTimeLastLoop=true )
- -Tオプション
人間が読みやすい形式になり、表示される時間が見えるようになりました。
[root@localhost ~]# dmesg -T | tail
[火 4月 5 19:59:03 2022] 23:56:08.282800 control Session 0 is about to close ...
[火 4月 5 19:59:03 2022] 23:56:08.283389 control Stopping all guest processes ...
[火 4月 5 19:59:03 2022] 23:56:08.283507 control Closing all guest files ...
[火 4月 5 19:59:03 2022] 23:56:08.299573 control vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
[火 4月 5 19:59:03 2022] e1000: enp0s3 NIC Link is Down
[火 4月 5 19:59:03 2022] e1000: enp0s8 NIC Link is Down
[火 4月 5 19:59:05 2022] 11:01:09.710113 timesync vgsvcTimeSyncWorker: Radical host time change: 39 909 566 000 000ns (HostNow=1 649 156 469 710 000 000 ns HostLast=1 649 116 560 144 000 000 ns)
[火 4月 5 19:59:07 2022] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[火 4月 5 19:59:07 2022] e1000: enp0s8 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[火 4月 5 19:59:15 2022] 11:01:19.710897 timesync vgsvcTimeSyncWorker: Radical guest time change: 39 909 107 063 000ns (GuestNow=1 649 156 479 710 863 000 ns GuestLast=1 649 116 570 603 800 000 ns fSetTimeLastLoop=true )
- -l オプション
メッセージレベルにを指定して出力します。
緊急度が高い順からemerge,alart,crit,err,warn,notice,info,debug になっており、
以下の例だとerrまでのメッセージを出力しています。
[root@localhost ~]# dmesg -l emerg,alert,crit,err | tail
[310107.032369] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:33:plane-0] flip_done timed out
[310117.034931] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:37:crtc-0] flip_done timed out
[310127.038206] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:33:plane-0] flip_done timed out
[310137.041047] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:37:crtc-0] flip_done timed out
[310147.044129] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:33:plane-0] flip_done timed out
[310157.051263] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:37:crtc-0] flip_done timed out
[310167.054184] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:33:plane-0] flip_done timed out
[310177.056995] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:37:crtc-0] flip_done timed out
[310187.063627] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:33:plane-0] flip_done timed out
[310197.071139] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:37:crtc-0] flip_done timed out
- -x オプション
各レベルの表示を行います。
コレでdebugなのかwarnなのかがわかりやすくなりました。
[root@localhost ~]# dmesg -x | tail
kern :warn : [362394.206653] 23:56:08.282800 control Session 0 is about to close ...
kern :warn : [362394.206856] 23:56:08.283389 control Stopping all guest processes ...
kern :warn : [362394.206990] 23:56:08.283507 control Closing all guest files ...
kern :warn : [362394.223095] 23:56:08.299573 control vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
kern :info : [362394.563247] e1000: enp0s3 NIC Link is Down
kern :info : [362394.567416] e1000: enp0s8 NIC Link is Down
kern :warn : [362396.528629] 11:01:09.710113 timesync vgsvcTimeSyncWorker: Radical host time change: 39 909 566 000 000ns (HostNow=1 649 156 469 710 000 000 ns HostLast=1 649 116 560 144 000 000 ns)
kern :info : [362398.572653] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
kern :info : [362398.589702] e1000: enp0s8 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
kern :warn : [362406.529397] 11:01:19.710897 timesync vgsvcTimeSyncWorker: Radical guest time change: 39 909 107 063 000ns (GuestNow=1 649 156 479 710 863 000 ns GuestLast=1 649 116 570 603 800 000 ns fSetTimeLastLoop=true )
勉強後イメージ
タイムスタンプがあるだけでなぜ読みやすくなるんだろう・・・
気分次第かな。。。
ネットワークが上がってなかったり、USBが反応しないときに見るイメージ