Announcement

Collapse
No announcement yet.

'find' not found?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    'find' not found?

    I have a shell script that makes use of the 'find' command, which is part of the findutils package. However, I've noticed recently that my shell script reports that 'find' is not found (oddly enough).

    I tried re-installing the package from Synaptic, and got the following output:

    Code:
    dpkg: warning: 'find' not found in PATH or not executable.
    dpkg: error: 1 expected program not found in PATH or not executable.
    Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
    E: Sub-process /usr/bin/dpkg returned an error code (2)
    A package failed to install.  Trying to recover:
    dpkg: warning: 'find' not found in PATH or not executable.
    dpkg: error: 1 expected program not found in PATH or not executable.
    Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
    My path is as follows:

    Code:
    frank@rhino:~$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    frank@rhino:~$
    I've done a manual check for 'find' in some of the above listed directories. Dolphin doesn't see it, but locate finds it at /usr/bin/find. I've updated the database for locate, and it still sees it there.

    Weird.

    In a root konsole I did the following:

    Code:
    root@rhino:~# find
    The program 'find' is currently not installed.  You can install it by typing:
    apt-get install findutils
    root@rhino:~# apt-get install findutils
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    findutils is already the newest version.
    The following packages were automatically installed and are no longer required:
      ubufox libgpds0 libaccess-bridge-java-jni libaccess-bridge-java dcraw
      libnautilus-extension1
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.
    root@rhino:~#
    So, using 'find' says it is not installed. Trying to install 'findutils' says it is already there. Dolphin can't see 'find' in /usr/bin, but locate says it is there.

    Any suggestions?

    Frank.
    Linux: Powerful, open, elegant. Its all I use.

    #2
    ...findutils is already the newest version...
    Try with the reinstall:

    man apt-get:
    --reinstall
    Re-install packages that are already installed and at the newest version.
    ---Edit---

    It seems that the dpkg is using the find i.e. renaming the find and trying to reinstall:
    dpkg: warning: 'find' not found in PATH or not executable
    dpkg: error: 1 expected program not found in PATH or not executable
    Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
    E: Sub-process /usr/bin/dpkg returned an error code (2)
    There should be the oldfind ( http://packages.ubuntu.com/search?se...eiric&arch=any )

    Making a symlink:
    Code:
    sudo ln -s /usr/bin/oldfind /usr/bin/find
    ls -l /usr/bin/find
    lrwxrwxrwx 1 root root 16 Sep 18 17:33 /usr/bin/find -> /usr/bin/oldfind
    Trying to reinstall the findutils:
    Code:
    sudo apt-get install --reinstall findutils
    and the reinstallation is working:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
    Need to get 0 B/391 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    (Reading database ... 260085 files and directories currently installed.)
    Preparing to replace findutils 4.4.2-4ubuntu1 (using .../findutils_4.4.2-4ubuntu1_amd64.deb) ...
    Unpacking replacement findutils ...
    Processing triggers for install-info ...
    Processing triggers for man-db ...
    Setting up findutils (4.4.2-4ubuntu1) ...
    and the find is now:
    ls -l /usr/bin/find
    -rwxr-xr-x 1 root root 229896 Jan 24 2012 /usr/bin/find

    Alternative if the oldfind is also gone

    Unpack the findutils (/var/cache/apt/archives/)



    and move the find to the right place.
    Last edited by OneLine; Sep 18, 2012, 08:50 AM.
    Have you tried ?

    - How to Ask a Question on the Internet and Get It Answered
    - How To Ask Questions The Smart Way

    Comment


      #3
      Have you tried using it at the command line? I would look into your script and see if something needs to be changed. Maybe a recent update changed something....

      Please Read Me

      Comment


        #4
        locate's database could be out of date. Even after re-scanning I would be suspicious.

        What do you get from
        Code:
        which find
        ls -l /usr/bin/find
        sudo ls -l /usr/bin/find
        I'm suspecting either /usr/bin/find has been deleted, or it's lost some permissions.
        I'd rather be locked out than locked in.

        Comment


          #5
          SecretCode:

          Code:
          root@rhino:~# which find
          root@rhino:~# ls -l /usr/bin/find
          ls: cannot access /usr/bin/find: No such file or directory
          root@rhino:~# sudo ls -l /usr/bin/find
          As this is a root terminal, the last two lines you had me run are identical. Which find returns nothing.

          Frank.
          Linux: Powerful, open, elegant. Its all I use.

          Comment


            #6
            MasterSkribe:

            Yep.

            Once 'oldfind' was renamed and findutils was reinstalled, all is now working again!

            I assume that something must have 'choked' during an update for this to have happened. 'find' got renamed to 'oldfind', but the complete update never took place.

            Strange that updating the locate database did not work -- unless it uses 'find', which was not installed.

            Interesting catch-22.

            Thank you for your kind help!

            By the way, my script now runs correctly.

            Frank.
            Linux: Powerful, open, elegant. Its all I use.

            Comment

            Working...
            X