diff --git a/components/dmesg/config.go b/components/dmesg/config.go index f9920fc1..5c4a7c58 100644 --- a/components/dmesg/config.go +++ b/components/dmesg/config.go @@ -50,11 +50,16 @@ const DefaultDmesgFile = "/var/log/dmesg" func DefaultConfig() Config { scanCommands := [][]string{ {"cat", DefaultDmesgFile}, - {"dmesg", "--ctime", "--nopager", "--buffer-size", "163920", "--since", "'1 hour ago'"}, + + // some old dmesg versions don't support --since, thus fall back to the one without --since and tail the last 200 lines + // ref. https://github.com/leptonai/gpud/issues/32 + {"dmesg --ctime --nopager --buffer-size 163920 --since '1 hour ago' || dmesg --ctime --nopager --buffer-size 163920 | tail -n 200"}, } if _, err := os.Stat(DefaultDmesgFile); os.IsNotExist(err) { scanCommands = [][]string{ - {"dmesg", "--ctime", "--nopager", "--buffer-size", "163920", "--since", "'1 hour ago'"}, + // some old dmesg versions don't support --since, thus fall back to the one without --since and tail the last 200 lines + // ref. https://github.com/leptonai/gpud/issues/32 + {"dmesg --ctime --nopager --buffer-size 163920 --since '1 hour ago' || dmesg --ctime --nopager --buffer-size 163920 | tail -n 200"}, } }