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.

confusarama 11-28-2008 12:05 PM

Ah! Didnt see the "edit" button. Doh!

tredegar 11-28-2008 12:25 PM

IP is gone. No harm done.
The output from env is a little sparse compared to mine.
To note: /opt/bin is not in your PATH
Your SHELL is /bin/sh but what is that linked to? Mine is /bin/bash
Quote:

fsck -N
Errr, my man fsck doesn't have that option.
But when I try it:
Code:

tred@vaio:~$ fsck -N
fsck 1.40.8 (13-Mar-2008)
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 UUID=7591fe5b-8907-407f-854e-321684957104
tred@vaio:~$

shutdown used to have a F ( or was it f option ?) that would force a fsck at the next boot. That doesn't seem to be available to me since about a year ago, but you might try it.

shutdown -rF now or maybe shutdown -rf now

to reboot and check (and repair) the filesystems as linux comes up. Then check your kernel logs.

Otherwise, you'll have to unmount the filesystem, and then check it.

Quote:

Yes, file is missing, cant install it either (get an error).
What "error", the more information you provide, the faster we'll find the cause of the problems. If we ever find them.
Quote:

This is an unusual distro.
Looks like it. How old is it? Why are you running it?

confusarama 11-28-2008 12:58 PM

Code:

/ # shutdown -?
/bin/sh: shutdown: not found

Its the distro that comes with a bit of kit called a Freecom Network Drive Pro (ARM based network storage supporting SMB). Bought it because its actually a Linux box underneath and has preinstalled Apache, PHP, MySQL. However my Linux skills are basic (actually bragging now) so I should have started with something a bit more "standard".

tredegar 11-28-2008 01:55 PM

Ah!
Now I am beginning to understand your frustrations. We assumed (always a bad thing to do) that you were running some "mainstream" distro.

The linux installed on your device will be a minimal install to save on space (& cost). It will not come with any development tools (C compiler, kernel source-code etc.) and many basic things like file will have been omitted, because they are not needed for the device to function (probably very well, as long as you do not break it).

In short, you are setting yourself a very hard task if you are new to linux, and want to play with it (IMHO the best way to learn linux is to play with it until you break it, then start again: like a bicycle - at first you keep falling off, but soon you wonder why everybody can't just ride one, the same as you can - it's EASY!).

You may well break the fuctionality of your device if you play with it without knowing what you are doing. Please take care, especially if you are working as root, which you have been doing.

I do not know where you found your lynx executable, but maybe it was not compiled for your ARM system: linux isn't windows - you can't just drop in an exe file and expect it to work. This is one of the many advantages of linux. (Drop in a virus: it doesn't work. Nothing happens).

If you'd like to learn linux to the level that you can hack linux-powered devices, start with a mainstream distro, and dual-boot with that "other" OS, until you earn your wings.

Start here http://distrowatch.com/ and pick any distro in the top ten. Maybe try them all.
I am currently recommending kubuntu 8.04 but make your own choice, and play as you wish.

Search-engine (or search this board) for dual boot linux to see what I am talking about.

I'm sure you'll have a lot of fun, and learn to appreciate all linux has to offer. Then you can play with hacking linux-powered devices.
That's fun too: My jailbroken iTouch! Whooo Hooo! I rarely listen to music, but hacking it was fun.

Explore a mainstream distro. Try others. Have fun. Good luck.

{BBI}Nexus{BBI} 11-28-2008 03:28 PM

Quote:

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

Lol. Just to echo what tredegar has said, keep it simple to start with, use one of the mainstream distros until your find you feet.

Welcome to the world of the Penguin. :D

i92guboj 11-28-2008 07:13 PM

Code:

mount | grep noexec
If there's any output, you probably have the cause of your problem there.

confusarama 12-01-2008 11:36 AM

Thanks for all your advice guys, I still cant get it to work but I have learnt some stuff and the advice to start simple and build up is certainly useful. I am going to setup what I need on a Debian VM to practice, then reimplement on a freshly wiped Network Drive Pro once I have the prerequisite skills. No pain no gain :)

FYI: mount | grep noexec returned nothing, however

Code:

/ # mount
/dev/root on / type ext3 (rw,noatime,nodiratime,data=ordered)
proc on /proc type proc (rw,nodiratime)
sysfs on /sys type sysfs (rw)
none on /proc/bus/usb type usbfs (rw)
none on /ramdisk type tmpfs (rw)
/dev/hdd4 on /home type ext3 (rw,noatime,nodiratime,data=ordered,usrquota)
/dev/hdd4 on /opt type ext3 (rw,noatime,nodiratime,data=ordered,usrquota)

If I ever do figure it out then I will post the answer here.

Cheers,
Paul


All times are GMT -5. The time now is 06:09 AM.