Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On the exact same machine (AIX 6.1), in 2 different login shells (both ksh), with different user IDs, I can do uname -M; in one shell I get the system model. In the other shell I get BLANK! The only difference is the user ID and therefore the environment. I can't put the environment in here.

Example User 1 Shell:

$ uname -M
IBM,1234-567
$

Example User 2 Shell:

$ uname -M

$

I have done a truss in both shells. There is a difference, but I don't understand it. Here is the bad truss:

truss uname -M
.. a bunch of execve's ripped out as it was searching the PATH for uname.
execve("/bin/uname", 0x2FF2155C, 0x20012EF8)     argc: 2
__loadx(0x03480000, 0x2FF21380, 0x00000108, 0xF0713968, 0x20000CD0) = 0x00000000
__loadx(0x0A040000, 0xD042D064, 0x0000008A, 0x20001254, 0x00000000) = 0x00000000
sbrk(0x00000000)                                = 0x200013D0
vmgetinfo(0x2FF20530, 7, 16)                    = 0
sbrk(0x00000000)                                = 0x200013D0
__libc_sbrk(0x00000000)                         = 0x200013D0
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
__loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128
__loadx(0x01480180, 0x2FF1FEF0, 0x00000A50, 0xF068921C, 0xF068914C) = 0xF0759FA0
__loadx(0x07080000, 0xF06891EC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF3C
__loadx(0x07080000, 0xF068912C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF48
__loadx(0x07080000, 0xF06891FC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF78
__loadx(0x07080000, 0xF068913C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF84
__loadx(0x07080000, 0xF06891BC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF54
__loadx(0x07080000, 0xF068915C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF6C
__loadx(0x07080000, 0xF06891CC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AF90
__loadx(0x07080000, 0xF06891DC, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AFC0
__loadx(0x07080000, 0xF068916C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075AFA8
__loadx(0x07080000, 0xF068917C, 0xFFFFFFFF, 0xF0759FA0, 0x00000000) = 0xF075B020
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
__loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
__loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
__loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128
getuidx(4)                                      = 28633
getuidx(2)                                      = 28633
getuidx(1)                                      = 28633
getgidx(4)                                      = 100
getgidx(2)                                      = 100
getgidx(1)                                      = 100
__loadx(0x01480080, 0x2FF1FEF0, 0x00000A50, 0x2FF20A60, 0x2FF22ED1) = 0xD0538128
access("/usr/lib/nls/msg/en_US/uname.cat", 0)   = 0
_getpid()                                       = 7405946
uname(0x2000132C)                               = 0
statx("CuAt", 0x2FF20870, 76, 0)                Err#2  ENOENT
kopen("CuAt", O_RDONLY)                         Err#2  ENOENT
kioctl(1, 22528, 0x00000000, 0x00000000)        = 0

kwrite(1, "\n", 1)                              = 1
__loadx(0x04000000, 0x2FF20970, 0x00000800, 0x0000D032, 0x00000000) = 0x00000000
kfcntl(1, F_GETFL, 0x00000001)                  = 67110914
kfcntl(2, F_GETFL, 0x2FF22FFC)                  = 67110914
_exit(0)

You can see the kwrite at the end is only printing out a newline character, "\n".

In the good truss output, it looks like uname is getting the attribute from:

/etc/objrepos/CuAt

This lead me to the lsattr command and others.

Why is uname -M blank? What environment variables would affect this?

share|improve this question
    
Are all these __loadx with a non-zero return code because of a bad LIBPATH? –  Jess Apr 19 '13 at 20:33
    
The problem does not appear to be solely b/c of a PATH or LIBPATH. I just tried with those from my good shell. Still blank. –  Jess Apr 19 '13 at 20:43
1  
Could one of the shells have a builtin uname? Both are ksh? Can you add the environment of both shells, if it's not too long? –  ott-- Apr 19 '13 at 21:03
1  
Try running the command in a clean environment: env -i uname -M. –  paraxor Apr 20 '13 at 13:03
1  
are both shells same user? login shell? is by chance one of them (the second) a restricted shell? –  bdowning Apr 21 '13 at 12:22

1 Answer 1

up vote 1 down vote accepted

I got it. I was scanning through the 'good' environment and saw this env var:

export ODMDIR=/etc/objrepos

Knowing that the 'good truss' was looking in here for the machine model number, I ran this command in the bad shell and now uname -M works:

$ uname -M
IBM,1234-567

Sorry I did not post the environment, but it is huge and contains a lot of sensitive information.

share|improve this answer
    
You should accept this as your question's answer. –  paraxor Apr 22 '13 at 14:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.