Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an embedded device with wdlinux (White Dwarf 2.0). I can access this linux using ssh or ftp.

Yesterday I performed updatedb 1>/dev/null 2>/dev/null manually. (It will be performed as cronjob everyday morning). Today the linux system behaves strangely:

  1. the command ls list no files any more. (If I log in using ftp, I can see all files)
  2. The command netstat shows nothing as well.

I just executed updatedb without any arguments again. After that ls worked one time and then does not work again.

I am now totally confused. Any hints are appreciated.

share|improve this question

migrated from stackoverflow.com Jul 16 '09 at 8:32

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

    
When "ls" doesn't work (exits without any output I assume), what does "pwd" show? Have you tried giving "ls" a file, that you know is there, as argument? –  Inshalla Jul 16 '09 at 8:22
    
Try cd / followed by echo * . –  kmarsh Jul 16 '09 at 12:24

7 Answers 7

up vote 3 down vote accepted

updatedb is not related to ls. It is used for locate. Check for where is ls located using command

which ls

or

type ls

Which ls should tell you it is in '/bin/ls' and the alias for ls command if it exists. Try dir command if it is present on that Linux. Just to see if someone messed up ls to create some kind of backdoor or ls executable is corrupted. dir might still be working perfectly. If dir is not there or gives strange output, I would suggest running fsck on the filesystem.

share|improve this answer
    
Executing /bin/ls might work, if there is an alias for it.. –  Dentrasi Jul 19 '09 at 10:00
    
Agreed, If it is problem with bad alias then executing ls with full path '/bin/ls' might work. –  Saurabh Barjatiya Jul 20 '09 at 12:44

Are they hidden files? If so try:

ls -la
share|improve this answer
1  
If your version was correct, the ftp command would not display it without an extra option. FTP clients normally hide hidden files per default. –  please delete me Jul 16 '09 at 8:26
    
@guerda - With some FTP servers, the behaviour can also be configured on the server side. For example proftpd with ListOptions "-a" will list hidden files by default (See: proftpd.org/docs/directives/linked/config_ref_ListOptions.html) –  StackKrish Jul 16 '09 at 9:42
    
StackKrish: K, haven't said anything. :) –  please delete me Jul 16 '09 at 11:26

Any chance your machine has been hacked? It's a bit blatant, but I've seen attacks that disable things like netstat to hide themselves.

Do you have disk space free? (df -h)

share|improve this answer

You did not mention what file system you are using.

If the current directory disappears "ls" will show nothing. For example:

$ mkdir tmp
$ cd tmp
$ cp /etc/passwd /etc/group .
$ ls
passwd group

$ rm -rf  $(pwd)
$ ls
(empty)
$ mkdir $(pwd); cp /etc/passwd /etc/group $(pwd)
$ ls
(empty)
$ ls $(pwd)
passwd group
$ ls -lid . $(pwd)
(show different inodes)
$ cd $(pwd)
$ ls
passwd group

For netstat to succeed, I believe you need to have /proc mounted.

Is there some strange side effect in the way you run the updatedb? If this is reproducible, maybe you would like to run updatedb without discarding the output, especially stderr, to see if you see something interesting?

share|improve this answer

Run find and see if it shows anything. If it does then something is wrong with your ls.

share|improve this answer

Compare the result of the following command if ls works and if not:

which ls

If the output change, something is very wrong with your system. If the output is the same, propably the file permissions are wrong.

share|improve this answer

Suspend this answer for now... I am trying to figure out what this implies.
Arjan makes a correct comment, you should hit a 'command not found' error if path resolution fails.


Old.
Many times embedded linuxes do not come with a proper environment setting and you could be running without any PATH references. First thing to do should be,

echo $PATH

if that does not show anything (which is what i suspect), you need to set up path properly before any command outside the shell (echo is part of the shell) will work.

share|improve this answer
    
I'd say that "ls list no files any more" indicates that the command is executed without any output? So, I guess there's no "command not found" but empty output. –  Arjan Jul 19 '09 at 10:48
1  
@Arjan, I think, I did not read the question quite well... –  nik Jul 19 '09 at 11:34

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.