Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So today I logged on to my root server and the first thing that greets me is:

-bash: id: command not found
-bash: [: : integer expression expected

I switched to root and tried to run nano, no success. After some research I found out that all commands are gone except the most basic ones. The last things I did was adding some lines to /etc/profile and /etc/environment. And I added a symbolic link to /usr/lib/grails or something. But I didn't notice any effect immediatly. As a normal user I still have all commands btw.

share|improve this question

migrated from stackoverflow.com Oct 17 '12 at 20:39

This question came from our site for professional and enthusiast programmers.

Sounds like whatever you changed in /etc/profile introduced some errors into the script. –  cdhowie Oct 17 '12 at 20:14
Your $PATH variable is probably corrupt -- did you blow it out when you changed /etc/profile? –  jmdeldin Oct 17 '12 at 20:14
I only added some lines at the end, at least that is what I tried to do. Can someone post me the default /etc/profile? –  Chris Oct 17 '12 at 20:15

2 Answers 2

First make sure you do something such as:

export PATH="/bin:/usr/bin:/sbin:/usr/sbin"

to be able to execute anything at all.

Next make sure you fix your /etc/profile file as you appear to have a syntax error in it ... the error suggests it is an if or another expression involving a [ operator.

It appears that your /usr/bin/id is missing. Is it on another partition that wasn't mounted, is mounted noexec or similar?

For anyone finding this later: it turns out after /etc/environment was malformed (didn't contain all needed lines) and thus the environment of bash before reading /etc/profile was already borked. From man ssh:

          This file is read into the environment at login (if
          it exists).  It can only contain empty lines,  com-
          ment  lines  (that  start with '#'), and assignment
          lines of the form name=value.  This  file  is  pro-
          cessed  in all environments (normal rsh/rlogin only
          process it on AIX and potentially some  other  sys-
          tems).   The  file should be writable only by root,
          and should be world-readable.

On a Debian (6.0.6) this was my default /etc/profile

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
      PS1='$ '

export PATH

umask 022
share|improve this answer
it's this line here: if [ "id -u" -eq 0 ]; then as the error suggest id is not found, but why? –  Chris Oct 17 '12 at 20:19
@Chris: see my comment in my answer: "It appears that your /usr/bin/id is missing. Is it on another partition that wasn't mounted, is mounted noexec or similar?" –  0xC0000022L Oct 17 '12 at 20:21
It's a virtual server so that's not possible, but it's there anyway. –  Chris Oct 17 '12 at 20:23
@Chris: on Debian nano is /usr/bin/nano. Giving the absolute path should allow you to execute it at least ... also please do ls -al /usr/bin/id ... and sure it'd be possible inside a VM, too. –  0xC0000022L Oct 17 '12 at 20:23
so /usr/bin/id is working, id alone not –  Chris Oct 17 '12 at 20:24

I failed to run an ant-script since the env variable pointing to the Java installation turned out to be empty.

I ran:

source /etc/profile

and then is was not empty anymore, so maybe /etc/profile is not run properly? Have you tried this? (No, I am not an expert, but I can be lucky sometimes... :-)

share|improve this answer

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.