Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 12.04LTS system where the uptime command produces no output when run by a normal (that is, not root,) user:

bbx@bard:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.3 LTS
Release:    12.04
Codename:   precise
bbx@bard:~$ id
uid=1000(bbx) gid=1000(bbx) groups=1000(bbx),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(lpadmin),112(sambashare)
bbx@bard:~$ w
 10:42:56 up 21 days, 21:31,  1 user,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    redacted          10:35    0.00s  0.35s  0.00s w
bbx@bard:~$ uptime
bbx@bard:~$ echo $?


bbx@bard:~$ ls -l /proc/uptime /proc/loadavg
-r--r--r-- 1 root root 0 Jan 21 12:57 /proc/loadavg
-r--r--r-- 1 root root 0 Jan 21 12:57 /proc/uptime

And strace output is available from PasteBin.

Meanwhile, uptime works fine, (output matches the w(1) command,) when invoked by root:

root@bard:~# id
uid=0(root) gid=0(root) groups=0(root)
root@bard:~# uptime
 10:45:49 up 21 days, 21:34,  1 user,  load average: 0.00, 0.01, 0.05

Anyone know why?

share|improve this question
Could you add the output of ls -l /proc/uptime /proc/loadavg to your question? And while you're at it, run strace uptime > ~/strace-uptime.txt 2>&1, upload the ~/strace-uptime.txt file somewhere and link it here. – gertvdijk Jan 21 '14 at 15:50
up vote 2 down vote accepted

Look at the strace provided by you:

bbx@bard:~$ more strace-uptime.txt
execve("/home/bbx/bin/uptime", ["uptime"], [/* 15 vars */]) = 0

Your non-root user bbx has a script in ~/bin/uptime that gets executed. When ran as root, another uptime program gets executed. To solve this, check what /home/bbx/bin/uptime is doing there and remove it if possible. Otherwise, use the full path (/usr/bin/uptime).

share|improve this answer
<light bulb> Oh, yes, of course. I forgot that script was in the path for that user. Thanks for looking! – Craig Constantine Jan 21 '14 at 18:16

Your Answer


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.