Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host.Users() cannot get information on arm64 #1129

Closed
xhsky opened this issue Sep 4, 2021 · 7 comments · Fixed by #1603
Closed

host.Users() cannot get information on arm64 #1129

xhsky opened this issue Sep 4, 2021 · 7 comments · Fixed by #1603

Comments

@xhsky
Copy link

xhsky commented Sep 4, 2021

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)

@Lomanic Lomanic changed the title Host.user() cannot get information on arm64 Host.Users() cannot get information on arm64 Sep 5, 2021
@Lomanic
Copy link
Collaborator

Lomanic commented Sep 5, 2021

host.Users() is defined here and retrieves its information from /var/run/utmp, could you upload this file here?

@Lomanic Lomanic changed the title Host.Users() cannot get information on arm64 host.Users() cannot get information on arm64 Sep 5, 2021
@xhsky
Copy link
Author

xhsky commented Sep 6, 2021

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

@aperum
Copy link

aperum commented Feb 6, 2022

It seems that Debian aarch64 writes 400 bytes utmp entries (raspberrypi/Raspberry-Pi-OS-64bit#140). sizeOfUtmp is hardcoded in host_linux_arm64.go to 384. Using C.sizeof_struct_utmp as sizeOfUtmp fixes reading the entries.

@radu-boboc
Copy link

I get the same error, Is there a fix for this?

@JosefRypacek
Copy link

I have the same issue on aarch64. @shirou, I can assist and provide any data from impacted system if you are interested.

@shirou
Copy link
Owner

shirou commented Mar 3, 2024

@JosefRypacek
Thank you for reminding us of this issue. Could you check #1603 works or not on your environment?

@JosefRypacek
Copy link

Replied to the PR thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants