LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why cant I execute certain files? (https://www.linuxquestions.org/questions/linux-newbie-8/why-cant-i-execute-certain-files-686864/)

confusarama 11-28-2008 09:29 AM

Why cant I execute certain files?
 
Apologies if this is a silly question, I have done a LOT of searching and fiddling around but cannot find an answer.

Basically I have installed lynx but cannot run it. Please see my latest attempt:

/opt/bin # ls -l lynx
-rwxr-xr-x 1 root root 1140456 Jan 20 2008 lynx
/opt/bin # ./lynx
/bin/sh: ./lynx: not found


As you can see I can see the lynx file and it looks like I have execute permissions (to my newb eyes), but when I try to run it I get "not found". Thanks in advance for any comments whatsoever, even insults would be welcome at the moment :)

Machine: Freecom Network Drive Pro
Distro: OpenFSG

{BBI}Nexus{BBI} 11-28-2008 09:59 AM

There's no need for ./ and you don't need to be in /opt/bin just type lynx when you start a terminal session.

confusarama 11-28-2008 10:06 AM

Thanks for the reply, but just tried your suggestion and got the same problem:

/opt/bin $ lynx
-sh: lynx: not found

salter 11-28-2008 10:12 AM

Based on your command-line output you are logged in as root and have lynx installed in /opt/bin and your lynx is owned by root. All in all it should work.

I had once problems accessing web files by the Apache browser due to some SELinux settings on the directory containing those files, which was solved by copying the files to a new directory and replacing the old directory with the new one. It was a weird solution to a weird problem.

In your case it seems easier to install lynx properly in /usr/bin uing some package manager.

{BBI}Nexus{BBI} 11-28-2008 10:14 AM

Try executing it from your /home/username directory. Type ~ then press enter, now type lynx. If that doesn't work try /opt/bin/lynx. If both ways fail, it is most likely because /opt/bin is not in your path. Type env and look for a line like this: PATH=/opt/bin.

confusarama 11-28-2008 10:25 AM

Tried your suggestions.

/home/.users $ ~
-sh: /home/.users/admin: Permission denied


Even though

/home/.users $ cd /home/.users/admin
~ $


works fine.

Also tried suggestion from {BBI}}NEXUS{BBI} to copy to /opt/bin but get the same problem. I reckon a hammer or an axe might be required soon...

tredegar 11-28-2008 10:44 AM

Quote:

/home/.users $ ~
-sh: /home/.users/admin: Permission denied
~ is not a command. But it means "my home".
So typing just ~ is like typing /home/.users/admin which also isn't a command. So you get "Permission denied "

cd is a command. It means change directory to ....
so you can cd ~ or cd /home/.users/admin

lynx doesn't work because as {BBI}Nexus{BBI} said, /opt/bin/ is not in root's path (and you were trying as the root user)

Please read {BBI}Nexus{BBI}'s post #5 again, and try /opt/bin/lynx

confusarama 11-28-2008 10:48 AM

Apologies I misquoted, I meant to say that I had tried salter's suggestion. I have also tried {BBI}Nexus{BBI} too:

/ # /opt/bin/lynx
/bin/sh: /opt/bin/lynx: not found

colucix 11-28-2008 11:17 AM

Just out of curiosity, what is the output of the following two commands?
Code:

file /opt/bin/lynx
ls -al /opt/bin

Please, use code tags to embed pieces of code or output. Just embed text in [CODE] and [/CODE]

tredegar 11-28-2008 11:18 AM

OK
What's the output of
Code:

ls  -l  /opt/bin/lynx
?

(That's "minus Ell" not "minus one")

confusarama 11-28-2008 11:25 AM

Code:

/ # file /opt/bin/lynx
/bin/sh: file: not found

and

Code:

/ # ls -al /opt/bin
drwxr-xr-x    2 root    root        4096 Nov 27 23:08 .
drwxr-xr-x  12 root    root        4096 Jan 21  2008 ..
lrwxrwxrwx    1 root    root            5 Nov 27 09:57 bzcat -> bzip2
lrwxrwxrwx    1 root    root          20 Nov 27 09:58 bzip2 -> /opt/bin/bzip2-bzip2
-rwxr-xr-x    1 root    root            0 Nov 28 17:55 bzip2-bzip2
-rwxr-xr-x    1 root    root        7568 Mar 21  2008 bzip2recover
lrwxrwxrwx    1 root    root            3 Nov 27 09:58 captoinfo -> tic
lrwxrwxrwx    1 root    root          22 Nov 27 09:58 clear -> /opt/bin/ncurses-clear
-rw-r--r--    1 root    root        5895 Nov 16 22:41 index.html
-rwxr-xr-x    1 root    root        44336 Nov 11 23:55 infocmp
lrwxrwxrwx    1 root    root            3 Nov 27 09:58 infotocap -> tic
-rwxr-xr-x    1 root    root      1140456 Jan 20  2008 lynx
lrwxrwxrwx    1 root    root          18 Mar 19  2008 nc -> /opt/bin/netcat-nc
-rwxr-xr-x    1 root    root            0 Nov 28 17:55 ncurses-clear
-rwxr-xr-x    1 root    root        4959 Nov 11 23:55 ncurses5-config
-rwx------    1 root    root            0 Nov 28 17:55 netcat-nc
-rwx------    1 root    root      325080 Sep 27 19:44 openssl
lrwxrwxrwx    1 root    root            4 Nov 27 09:58 reset -> tset
-rwx------    1 root    root      360480 Apr  8  2008 rsync
-rwx------    1 root    root      108156 Feb 21  2008 sudo
-rwxr-xr-x    1 root    root        44292 Nov 11 23:55 tic
-rwxr-xr-x    1 root    root        8612 Nov 11 23:55 toe
-rwxr-xr-x    1 root    root        8952 Nov 11 23:55 tput
-rwxr-xr-x    1 root    root        14412 Nov 11 23:55 tset
-rwx------    1 root    root        77248 Feb 21  2008 visudo
-rwxr-x--x    1 admin    root        16141 Jan 21  2008 wakelan


tredegar 11-28-2008 11:39 AM

Quote:

/ # file /opt/bin/lynx
/bin/sh: file: not found
Means you do not have the file command installed, or it is not on your PATH. This is unusual IMHO, but no matter.

In your listing of /opt/bin/ lynx is there, and is executable by all.
So it should work. But it doesn't.
What, please is the output of env
?
Is your filesystem corrupted? have you tried running fsck ?

confusarama 11-28-2008 11:59 AM

Yes, file is missing, cant install it either (get an error). This is an unusual distro.

Code:

/opt/bin # env
USER=admin
MAIL=/var/mail/admin
SSH_CLIENT=xxx.xxx.xxx.xxx 3939 22
OLDPWD=/
HOME=/home/.users/admin
SSH_TTY=/dev/ttyp0
LOGNAME=admin
TERM=xterm
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
SHELL=/bin/sh
PWD=/opt/bin
SSH_CONNECTION=xxx.xxx.xxx.xxx 3939 192.168.1.111 22
TZ=GMT0

and

Code:

/opt/bin # fsck -N
fsck 1.38 (30-Jun-2005)


confusarama 11-28-2008 12:01 PM

Oh bllx! Just gave out my ip address. Dont look :)

colucix 11-28-2008 12:03 PM

Quote:

Originally Posted by confusarama (Post 3357983)
Oh bllx! Just gave out my ip address. Dont look :)

You can always edit the message and change them to something like XXX.XXX.XXX.XXX.


All times are GMT -5. The time now is 10:28 PM.