Is it possible to tell when /dev/kmsg has been ratelimited?

sourcejedi

The Linux kernel developers decided by default to ratelimit messages to /dev/kmsg. This was because they did not like the amount of messages written by systemd, particularly when debug is passed on the kernel command line.

systemd exceeds this limit even without enabling debug messages.

[    5.879211] systemd: 18 output lines suppressed due to ratelimiting

This is the only such message in my kernel log (dmesg) at the moment. So I might think it means that only 18 successive lines were lost, ending around t=5.879211. In some sense this would be a fairly limited loss. I probably wouldn't need to worry about it unless I noticed some of the very early boot units (pre-journald) were failing.

So, is that right? Is there a circumstance where this analysis could mislead me?

sourcejedi

Actually this idea is pretty wrong. Firstly, this message does not necessarily represent a single block of 18 successive systemd messages having been lost. Secondly, you can't tell when /dev/kmsg has been ratelimited if the process still has it open for writing. You only get a message about it once the process closes /dev/kmsg. The message shows a count of all the suppressed lines from that writer.


Each individual writer (file descriptor) to /dev/kmsg gets it's own ratelimit struct. And as part of the initialization...

ratelimit_set_flags(&user->rs, RATELIMIT_MSG_ON_RELEASE);

the ratelimit is set to only log on release. That is, when the file descriptor is closed. For a long-running process, this might be less than helpful... and the init system i.e. systemd definitely counts as a long-running process.

The reason you see this log message, is that systemd from the initrd closes /dev/kmsg before it exec()s systemd from the system's root filesystem.

So the messages lost during the initrd aren't necessarily lost as a block. There could be several different blocks of lost messages, so the log would not be as straightforward to analyze as I had thought.

Also any number of messages could have been lost later on, from the time between exec()ing systemd from the root filesystem, up to the point systemd stops logging to the /dev/kmsg altogether and switches to journald. And indeed they are, which we can see during shutdown (using a console that remains on, like a serial console). When systemd exec()s systemd-shutdown, /dev/kmsg is automatically closed, and we see

[  OK  ] Reached target Final Step.
         Starting Reboot...
[   76.318839] systemd-shutdow: 32 output lines suppressed due to ratelimiting
...

This is all in contrast to certain ratelimited messages from the kernel e.g. kauditd_printk_skb: 32 callbacks suppressed. In this case RATELIMIT_MSG_ON_RELEASE is not used.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Using KVO to tell when elements have been added to an array

分類Dev

Determining when a socket has been closed on Android

分類Dev

How to know when a block has been completed

分類Dev

Is there any way to tell if someone has been running Ubuntu live on my computer?

分類Dev

FFmpeg returns' Output must be specified' when it has been acknowledged

分類Dev

Change document title when title has been changed by another script

分類Dev

Recovering files when Windows 7 MBR has been corrupted

分類Dev

NameError when trying to use module that has been imported

分類Dev

How to execute code when ReactJS component has been applied to DOM

分類Dev

Connection property has not been initialized when filling a DataSet

分類Dev

bash script to execute a command,when RAID rebuilt has been finished

分類Dev

Add a class 'hidden' to my div when cookie has been set

分類Dev

tomcat has been stopped

分類Dev

How can I tell when a Layout (and all its child Views) has fully finished inflating?

分類Dev

how to tell rsync to preserve time stamp on files when source tree has a mounted point

分類Dev

Rubocop: Is it possible to tell Rubocop to return zero as exit code when only warnings are found?

分類Dev

Is it possible to be notified when ntpd has updated system time?

分類Dev

Spring Integration: start JPA polling only when all the results of last polling has been processed

分類Dev

How to proper ommit UnboundLocalError: Local variable '' referenced before assignment when exception has been thrown?

分類Dev

SQL Server 2016 - WHILE loop inside IF statement still occurring when condition has not been met

分類Dev

Pip version error when installing package even though pip has been updated

分類Dev

page doesn't display that text has been sent successfully when clicked on send button

分類Dev

Flutter: How to get a pop value when the original target page has been replaced?

分類Dev

Avoid app trying to call the Fragment's empty constructor when the app has been killed

分類Dev

How can I fsck a partition when the device reads as busy (but has been confirmed otherwise)?

分類Dev

angularjs : watch of array has been triggered when the array in initial load and not being changed

分類Dev

validate if checkbox has been checked

分類Dev

Untable a dataframe that has been aggregated

分類Dev

Check if a file has been changed

Related 関連記事

  1. 1

    Using KVO to tell when elements have been added to an array

  2. 2

    Determining when a socket has been closed on Android

  3. 3

    How to know when a block has been completed

  4. 4

    Is there any way to tell if someone has been running Ubuntu live on my computer?

  5. 5

    FFmpeg returns' Output must be specified' when it has been acknowledged

  6. 6

    Change document title when title has been changed by another script

  7. 7

    Recovering files when Windows 7 MBR has been corrupted

  8. 8

    NameError when trying to use module that has been imported

  9. 9

    How to execute code when ReactJS component has been applied to DOM

  10. 10

    Connection property has not been initialized when filling a DataSet

  11. 11

    bash script to execute a command,when RAID rebuilt has been finished

  12. 12

    Add a class 'hidden' to my div when cookie has been set

  13. 13

    tomcat has been stopped

  14. 14

    How can I tell when a Layout (and all its child Views) has fully finished inflating?

  15. 15

    how to tell rsync to preserve time stamp on files when source tree has a mounted point

  16. 16

    Rubocop: Is it possible to tell Rubocop to return zero as exit code when only warnings are found?

  17. 17

    Is it possible to be notified when ntpd has updated system time?

  18. 18

    Spring Integration: start JPA polling only when all the results of last polling has been processed

  19. 19

    How to proper ommit UnboundLocalError: Local variable '' referenced before assignment when exception has been thrown?

  20. 20

    SQL Server 2016 - WHILE loop inside IF statement still occurring when condition has not been met

  21. 21

    Pip version error when installing package even though pip has been updated

  22. 22

    page doesn't display that text has been sent successfully when clicked on send button

  23. 23

    Flutter: How to get a pop value when the original target page has been replaced?

  24. 24

    Avoid app trying to call the Fragment's empty constructor when the app has been killed

  25. 25

    How can I fsck a partition when the device reads as busy (but has been confirmed otherwise)?

  26. 26

    angularjs : watch of array has been triggered when the array in initial load and not being changed

  27. 27

    validate if checkbox has been checked

  28. 28

    Untable a dataframe that has been aggregated

  29. 29

    Check if a file has been changed

ホットタグ

アーカイブ