gopsutil
gopsutil copied to clipboard
host.Users() cannot get information on arm64
Describe the bug Host.user() cannot get information on arm64
To Reproduce
import "github.com/shirou/gopsutil/v3/host"
host.Users() // get: []
Environment (please complete the following information): cpu_arch: aarch64 os: Centos7/Ubuntu 20
Additional context Get information error here: unexpected EOF host_linux.go err := binary.Read(br, binary.LittleEndian, &u)
host.Users() is defined here and retrieves its information from /var/run/utmp, could you upload this file here?
Can load and read the content.
Get information error here: unexpected EOF host_linux.go err := binary.Read(br, binary.LittleEndian, &u) br: &{[66 10 0 0 0 0 0 0 253 197 36 97 0 0 0 0 103 32 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 40 58 0 0 112 116 115 47 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 116 115 47 48 114 111 111 116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 57 50 46 49 54 56 46 48 46 49 50 51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] 384 -1} u err: unexpected EOF
It seems that Debian aarch64 writes 400 bytes utmp entries (https://github.com/raspberrypi/Raspberry-Pi-OS-64bit/issues/140). sizeOfUtmp is hardcoded in host_linux_arm64.go to 384. Using C.sizeof_struct_utmp as sizeOfUtmp fixes reading the entries.
I get the same error, Is there a fix for this?