ytop icon indicating copy to clipboard operation
ytop copied to clipboard

run ytop in wsl ubuntu, but doesn`t work

Open Dongshan-git opened this issue 4 years ago • 7 comments

Installed package ytop v0.6.2 (executable ytop) *******> ytop

Backtrace omitted. Run with RUST_BACKTRACE=1 to display it. Run with RUST_BACKTRACE=full to include source snippets.

The application panicked (crashed). called Result::unwrap() on an Err value: MissingData { path: "/proc/meminfo", contents: "MemTotal: 16112436 kB\nMemFree: 7029116 kB\nBuffers: 34032 kB\nCached: 188576 kB\nSwapCached: 0 kB\nActive: 167556 kB\nInactive: 157876 kB\nActive(anon): 103104 kB\nInactive(anon): 17440 kB\nActive(file): 64452 kB\nInactive(file): 140436 kB\nUnevictable: 0 kB\nMlocked: 0 kB\nSwapTotal: 13107196 kB\nSwapFree: 12628476 kB\nDirty: 0 kB\nWriteback: 0 kB\nAnonPages: 102824 kB\nMapped: 71404 kB\nShmem: 17720 kB\nSlab: 13868 kB\nSReclaimable: 6744 kB\nSUnreclaim: 7124 kB\nKernelStack: 2848 kB\nPageTables: 2524 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 515524 kB\nCommitted_AS: 3450064 kB\nVmallocTotal: 122880 kB\nVmallocUsed: 21296 kB\nVmallocChunk: 66044 kB\nHardwareCorrupted: 0 kB\nAnonHugePages: 2048 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nDirectMap4k: 12280 kB\nDirectMap4M: 897024 kB\n" } in /home/ds/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/ytop-0.6.2/src/widgets/mem.rs, line 71 thread: main

Dongshan-git avatar Jul 29 '20 07:07 Dongshan-git

It's also crashing for me on startup in WSL Ubuntu with the same error. Here's a more complete backtrace:

Backtrace (most recent call first):
  File "rust:src/libcore/option.rs", line 1268, in core::option::expect_none_failed
  File "<unknown>", line 0, in <ytop::widgets::mem::MemWidget as ytop::update::UpdatableWidget>::update
  File "<unknown>", line 0, in ytop::update::update_widgets
  File "<unknown>", line 0, in ytop::main
  File "<unknown>", line 0, in std::rt::lang_start::{{closure}}
  File "rust:src/libstd/rt.rs", line 52, in std::rt::lang_start_internal::{{closure}}
  File "rust:src/libstd/panicking.rs", line 331, in std::panicking::try::do_call
  File "rust:src/libstd/panicking.rs", line 274, in std::panicking::try
  File "rust:src/libstd/panic.rs", line 394, in std::panic::catch_unwind
  File "rust:src/libstd/rt.rs", line 51, in std::rt::lang_start_internal
  File "<unknown>", line 0, in main
  File "<unknown>", line 0, in __libc_start_main
  File "<unknown>", line 0, in _start

The application panicked (crashed).
  called `Result::unwrap()` on an `Err` value: MissingData { path: "/proc/meminfo", contents: "MemTotal:       67044320 kB\nMemFree:        45213192 kB\nBuffers:           34032 kB\nCached:           188576 kB\nSwapCached:            0 kB\nActive:           167556 kB\nInactive:         157876 kB\nActive(anon):     103104 kB\nInactive(anon):    17440 kB\nActive(file):      64452 kB\nInactive(file):   140436 kB\nUnevictable:           0 kB\nMlocked:               0 kB\nSwapTotal:     201326592 kB\nSwapFree:      201326592 kB\nDirty:                 0 kB\nWriteback:             0 kB\nAnonPages:        102824 kB\nMapped:            71404 kB\nShmem:             17720 kB\nSlab:              13868 kB\nSReclaimable:       6744 kB\nSUnreclaim:         7124 kB\nKernelStack:        2848 kB\nPageTables:         2524 kB\nNFS_Unstable:          0 kB\nBounce:                0 kB\nWritebackTmp:          0 kB\nCommitLimit:      515524 kB\nCommitted_AS:    3450064 kB\nVmallocTotal:     122880 kB\nVmallocUsed:       21296 kB\nVmallocChunk:      66044 kB\nHardwareCorrupted:     0 kB\nAnonHugePages:      2048 kB\nHugePages_Total:       0\nHugePages_Free:        0\nHugePages_Rsvd:        0\nHugePages_Surp:        0\nHugepagesize:       2048 kB\nDirectMap4k:       12280 kB\nDirectMap4M:      897024 kB\n" }
in <redacted>/ytop-0.6.2/src/widgets/mem.rs, line 71

zpconn avatar Jul 31 '20 21:07 zpconn

Also happens to me on wsl2, ubuntu 18.04 x86_64

  called `Result::unwrap()` on an `Err` value: MissingData { path: "/proc/meminfo", contents: "MemTotal:       16633412 kB\nMemFree:         7754832 kB\nBuffers:           34032 kB\nCached:           188576 kB\nSwapCached:            0 kB\nActive:           167556 kB\nInactive:         157876 kB\nActive(anon):     103104 kB\nInactive(anon):    17440 kB\nActive(file):      64452 kB\nInactive(file):   140436 kB\nUnevictable:           0 kB\nMlocked:               0 kB\nSwapTotal:      50331648 kB\nSwapFree:       50167312 kB\nDirty:                 0 kB\nWriteback:             0 kB\nAnonPages:        102824 kB\nMapped:            71404 kB\nShmem:             17720 kB\nSlab:              13868 kB\nSReclaimable:       6744 kB\nSUnreclaim:         7124 kB\nKernelStack:        2848 kB\nPageTables:         2524 kB\nNFS_Unstable:          0 kB\nBounce:                0 kB\nWritebackTmp:          0 kB\nCommitLimit:      515524 kB\nCommitted_AS:    3450064 kB\nVmallocTotal:     122880 kB\nVmallocUsed:       21296 kB\nVmallocChunk:      66044 kB\nHardwareCorrupted:     0 kB\nAnonHugePages:      2048 kB\nHugePages_Total:       0\nHugePages_Free:        0\nHugePages_Rsvd:        0\nHugePages_Surp:        0\nHugepagesize:       2048 kB\nDirectMap4k:       12280 kB\nDirectMap4M:      897024 kB\n" }

jcbritobr avatar Aug 02 '20 18:08 jcbritobr

This appears to be due to a missing MemAvailable field. From some searching, it looks like MemAvailable was added in kernel version 3.14 which is newer than whatever WSL is using. It looks like the field might be able to be approximated. I'll file an issue with the library used to get this information.

CosmicHorrorDev avatar Aug 05 '20 12:08 CosmicHorrorDev

Before I file an issue, can someone post their kernel version? Also, I'm not too familiar with WSL, is it possible to update to a newer kernel? 3.14 was released in 2014 so anything before that would be quite old.

CosmicHorrorDev avatar Aug 05 '20 12:08 CosmicHorrorDev

Here is my kernel version:

Linux DESKTOP-R20NE59 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux

jcbritobr avatar Aug 06 '20 22:08 jcbritobr

Before I file an issue, can someone post their kernel version? Also, I'm not too familiar with WSL, is it possible to update to a newer kernel? 3.14 was released in 2014 so anything before that would be quite old.

Well, WSL is just a lighweight vm. You can install the lastest ubuntu, or fedora, etc... in my tests i'm using ubuntu 18.04

jcbritobr avatar Aug 06 '20 23:08 jcbritobr

I filed an issue with the upstream library. From my brief reading on the topic, the missing value can be approximated from other values that all seem to be present, so it's possible that a fallback value can be calculated instead of returning an error on the missing data.

CosmicHorrorDev avatar Aug 07 '20 05:08 CosmicHorrorDev