Original Message:
Sent: Wed March 12, 2025 10:25 AM
From: Ayappan P
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
We (AIX Toolbox team) have raised this issue internally with AIX libc team and they are working on it (The issue is genuine and it is acknowledged by them).
------------------------------
Ayappan P
Original Message:
Sent: Wed March 12, 2025 10:19 AM
From: Jozef Riha
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
IBM is turning their back on me refusing to admit it's an OS problem and rather pointing me towards (expensive) lab services.
I was able to pinpoint the issue to shr.o inside libc.a - a patched version of libc is working.
# commands executed on TL3 with libc copied from TL2
mkdir /tmp/patchedlibc && cd /tmp/patchedlibc
ar -X32_64 xv /usr/lib/libc.a
# /tmp/73tl2.libc contains libc.a extracted from 7.3TL2SP01
cp ../73tl2.libc/_shr_64.o ../73tl2.libc/shr_64.o .
rm libc.a
# repack libc
ar -X32_64 -v -q libc.a *
LIBPATH=. ../test.bin
# returns 1741082496.000000
------------------------------
Jozef Riha
Original Message:
Sent: Wed March 12, 2025 02:28 AM
From: Jozef Riha
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
Thank you, this is truly helpful. I did start to compile the c-program previously. But.. forgot the 64 flag. Compiling with 32-bit works:
$ /opt/IBM/xlc/16.1.0/bin/xlc_r -o test.bin test.c; ./test.bin
boot time = 1741082496.000000$
$
$ /opt/IBM/xlc/16.1.0/bin/xlc_r -o test.bin -q64 test.c; ./test.bin
can't determine boot time$
$
I will reopen the case.
------------------------------
Jozef Riha
Original Message:
Sent: Tue March 11, 2025 10:22 AM
From: Ayappan P
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
May be you want to just say getutxent is not working as expected in AIX 7.3 TL3 and share the below example.,
test.c
=====
#include<utmpx.h>
int main(){
float boot_time = 0.0;
struct utmpx *ut;
setutxent();
while (NULL != (ut = getutxent())) {
if (ut->ut_type == BOOT_TIME) {
boot_time = (float)ut->ut_tv.tv_sec;
break;
}
}
endutxent();
if (boot_time == 0.0) {
/* could not find BOOT_TIME in getutxent loop */
printf("can't determine boot time");
return NULL;
} else {
printf("boot time = %f", boot_time);
return 0;
}
}
xlc_r -q64 test.c
or
gcc -maix64 test.c
# ./a.out
can't determine boot time
------------------------------
Ayappan P
Original Message:
Sent: Tue March 11, 2025 10:05 AM
From: Jozef Riha
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
Thank you Shubham,
I did raise this to IBM support and tried really hard to make them look into this. No luck. Their response (repeated a few time) was:
> Note that this issue is still handled by opensource as this issue is with python modules and not handled by AIX Support teams
> Kindly note that we cannot see any issues from OS side and such an issue is handled by Opensource community.
The ticket was closed the next day.
------------------------------
Jozef Riha
Original Message:
Sent: Fri March 07, 2025 04:17 AM
From: Shubham Gupta
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
Hi Jozef,
This is the source of psutil which is used to provide boot_time.
psutil_boot_time(PyObject *self, PyObject *args) {
float boot_time = 0.0;
struct utmpx *ut;
setutxent();
while (NULL != (ut = getutxent())) {
if (ut->ut_type == BOOT_TIME) {
boot_time = (float)ut->ut_tv.tv_sec;
break;
}
}
endutxent();
The API getutxent is failing in AIX 7.3 TL3 as you have observed.
Please raise a case against IBM for this issue.
------------------------------
Shubham Gupta
Original Message:
Sent: Thu March 06, 2025 03:47 AM
From: Jozef Riha
Subject: psutil.boot_time stopped working after an update to AIX 7.3 TL3
We had this with AIX 7.3 TL2 (example /opt/freeware/bin/python3 and DNF repo-supplied psutil but we can easily reproduce this with AIX's native python3 and compiled module):
>>> import psutil
>>> psutil.boot_time()
1736354304.0
Since update to AIX 7.3 TL3:
>>> import psutil
>>> psutil.boot_time()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/freeware/lib64/python3.9/site-packages/psutil/__init__.py", line 2310, in boot_time
return _psplatform.boot_time()
File "/opt/freeware/lib64/python3.9/site-packages/psutil/_psaix.py", line 272, in boot_time
return cext.boot_time()
RuntimeError: can't determine boot time
Developer of psutil is unable to debug this due to his lack of access to an AIX box.
Could someone please confirm the same? Wonder if this may be an issue only with certain settings/configuration.
Thanks, j
------------------------------
Jozef Riha
------------------------------