Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: File structure and permission assitance

  1. #11
    Join Date
    Jun 2021
    Beans
    4

    Re: File structure and permission assitance

    I think I followed everything that you guys were discussing here. I am now stuck on not being able to execute the program and it keeps saying no such file or directory. The file is on my desktop and has the proper execute permissions. Any thoughts on what is going on?
    Attached Images Attached Images

  2. #12
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: File structure and permission assitance

    Quote Originally Posted by zzbeakerzz View Post
    Any thoughts on what is going on?
    Images that aren't attached inline don't display on the mobile site, so no, not a clue.

    Terminal output enclosed by CODE tags is, by far, the best way to provide information.

  3. #13
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: File structure and permission assitance

    Quote Originally Posted by zzbeakerzz View Post
    I think I followed everything that you guys were discussing here. I am now stuck on not being able to execute the program and it keeps saying no such file or directory. The file is on my desktop and has the proper execute permissions. Any thoughts on what is going on?
    All Unix-like OSes use a PATH environment variable just the exact way that MS-Windows does, so there is nothing new happening. Your Desktop isn't in the path, so if you want to run a program located there, you have 3 choices.
    • Make ~/Desktop part of your PATH.
    • Move the program to a directory that is already in the PATH.
    • Fully specify the exact location of the program to be run.


    The first option isn't normally done. Typically, a Desktop is for data files and directories, not programs. Personal programs/script are often placed into ~/bin/ - which is the same as $HOME/bin/. This directory isn't created automatically, but you can make it and add it to your PATH in your startup files.

    To check the value of the PATH, use echo $PATH. This is exactly the same as on Windows, BTW. Nothing new.

    The 2nd option is to move the program to a directory already in your PATH. For something downloaded, NOT installed using the normal Ubuntu package manager, I would put into my ~/bin/ directory if it was only to be used by my userid or into /usr/local/bin/ if it was to be shared by all users on the system. There is a "Linux File System Heirachy Standards Document" which spells out clearly what goes where on a Unix/Linux file system. All the popular distros follow this document. The wikipedia article on it has a table, which is 99% all we need to read.

    The last option is to specify the exact location of the program to be run.
    "program" isn't an exact location.
    "./program" is or
    "~/Desktop/program" or
    "$HOME/Desktop/program" or
    "/home/thefu/Desktop/program"
    All of those are either relative or absolute paths to programs. The first is relative and depends on the PWD/CWD value.

    You can learn all the basic stuff if seems aren't on the top of your head here: http://linuxcommand.org/tlcl.php

    Trying to learn Linux on a microcontroller is much harder than trying to learn it on a normal desktop Linux install. The learning curve will be very steep.

    File and directory permissions are core to all Unix security. Spend the 45 minutes learning that stuff now to avoid hours, days, weeks, months of frustration. There isn't any shortcut. Just learn it now, ASAP. Create 3 new userids and 2 groupids. Open 3 terminals, login to each terminal with one of those new userids and create a new directory - say /tmp/foo. cd all the userid terminals into that directory and try creating files using all three. Next work through every possible combination of permissions from 000 ---> 777 on the files and some subdirectories for each of the userids. Learn to read the permissions using ls -al. Understand that the parent directory permissions determine access to files inside that directory. Learn about groups and what being a member of the same group can and cannot accomplish.
    Doing all of this should take about 45 minutes, and that includes 15 minutes working through a file permissions tutorial first.
    After about 30 minutes total, the ah-ha moment should happen, then spend the remaining 15 minutes solidifying the new knowledge, testing the limitations. Use mkdir touch chmod chgrp chown commands. When you fully understand the power of chmod g+s, only then should you stop.

  4. #14
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,824
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: File structure and permission assitance

    In two of your commands in the screenshot you added a random sudo. Don't. sudo occasionally helps against "permission denied" errors, not against "no such file or directory" errors. And in any case, only use sudo when you know why you need it, not simply whenever it doesn't work without.

    In your first command, you began the command with ./. This means the path is to be interpreted relative to your current directory, which is your home directory. But the path you used is relative to the Desktop directory, so you should have gone to that directory first.

    In the second and third command, you write the full path, with a leading dot. The leading dot (or anything not a slash or something shorthand for something starting with a slash) indicated this is again a relative path, but this one is relative to the root directory. You should have gone to the root directory first, or simply omit the dot.

    Only in your final command you get the path right, but ldd doesn't execute the file. It tells you about dynamically linked libraries, which this executable doesn't have.

    So, think about absolute paths, relative paths and your current directory.

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: File structure and permission assitance

    And I couldn't read the image. Bad eyesight. Please post text for text output, wrapped in code tags. Make it easy for us to help.

  6. #16
    Join Date
    Jun 2021
    Beans
    4

    Re: File structure and permission assitance

    Hey guys,
    I have messed around with what was stated above (and am still struggling). Please see below for a few of the lines I have tried.

    nathan@thinkpad-t440p:~$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    nathan@thinkpad-t440p:~$ sudo mv '/usr/local/bin/TeensyduinoInstall.linux64' '/usr/bin'
    nathan@thinkpad-t440p:~$ ./TeensyduinoInstall.linux64
    bash: ./TeensyduinoInstall.linux64: No such file or directory
    nathan@thinkpad-t440p:~$ sudo mv '/usr/bin/TeensyduinoInstall.linux64' '/usr/local/bin'
    nathan@thinkpad-t440p:~$ ./TeensyduinoInstall.linux64
    bash: ./TeensyduinoInstall.linux64: No such file or directory

    Not sure what is going on now. Do you guys have an idea?

  7. #17
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: File structure and permission assitance

    Quote Originally Posted by zzbeakerzz View Post
    bash: ./TeensyduinoInstall.linux64: No such file or directory

    Not sure what is going on now.
    "." means "this directory," so "./TeensyduinoInstall.linux64" means "run the file called TeensyduinoInstall.linux64 in this directory." But that file isn't in this directory, because you've moved it to some other directory.

  8. #18
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: File structure and permission assitance

    Seems the understanding of absolute and relative paths in poor.

    At any prompt, type "pwd" to see what the current directory is if you don't understand how to read the prompt provided.

    I'll take a guess:
    Code:
    nathan@thinkpad-t440p:~$
    There is a method to that prompt.

    "nathan" is your current userid. Linux is a multi-user system, so there could be 60,000 different userids on a system. Chances are that a normal home Linux system will have less than 100. How many will depend on the number of programs installed and if those programs like to run under a different userid. Multi-user. Always remember that. My 20.04 desktop system has 54 userids, BTW. Also, usernames should always be lower-case and begin with an ASCII character, no numbers. There is probably a limit to how long a username can be. I just don't know it off the top of my head. For security reasons I want my real usename to be short, but random enough. "thefu482", for example. This is to prevent remote connections from being able to guess the login username. When I post here, I'll post with "thefu" as my username to simplify things.

    "@thinkbap-t440p" says that the hostname is thinkbap-t440p.

    ":" is just a separator like the @, but those are placed in specific locations to make ssh, scp, rsync and some other programs easier to use by select/paste (We don't need copy/paste - select/paste is enough).

    "~" is a shortcut for the current useids $HOME directory. echo $HOME will show the value. Every userid has a HOME.

    And lastly, "$" says this userid is a normal user, not root. To show a root login, convention is to use the "#" prompt.

    So, taken all together, nathan@thinkpad-t440p:~$ says
    nathan on thinkpad-t440p in directory ~ Pretty slick.

    What if the prompt where
    nathan@thinkpad-t440p:/etc$
    That tells use that the pwd is /etc/, but the user and hostname hasn't changed.

    Let me grab a few prompts from my open terminals:
    Code:
    thefu@hadar:~/V/DONE$
    thefu@regulus:~$
    thefu@istar:/d/D1/M$
    thefu@romulus:/tmp$
    See how the information in each might be helpful?
    Inside romulus:/tmp/ there was a file that I wanted in hadar:/tmp/ . I was on hadar, so I used scp to pull it over. Here was the command:
    Code:
    $ scp romulus:/tmp/blog44-2004.xml  /tmp/
    Because the usernames were the same on both systems, I didn't need to include them. Don't worry if this seems complex. The point is that those prompts have a specific reason for being the way they are, but we can completely customize them as much as we like. They are just environment variables - PS1, PS2, PS3, and PS4 are used by bash to setup the prompt in a terminal.

    Does that begin to make a little more sense?

    Moving on.

    $ sudo mv '/usr/local/bin/TeensyduinoInstall.linux64' '/usr/bin'

    Says to move a file from /usr/local/bin ---> /usr/bin/. That is probably a bad idea, since both of those directories are already in your PATH. Further, /usr/bin/ programs should come only from APT package installations, not from stuff we download off the internet. /usr/local/bin/ is a good location for that file, methinks. Why move it?

    Code:
    $ ./TeensyduinoInstall.linux64
    says to run the program/script in the PWD. If you type pwd, does that program exist in that directory? I bet it doesn't, which why the error bash: ./TeensyduinoInstall.linux64: No such file or directory is shown. Try it without the ./ , see if that helps. If the program is:
    a) in a directory in the PATH
    and
    b) has execute permissions for the current userid to have execute rights, then
    the program will attempt to run.

    The key thing to learn is to read the output from things that don't do what you want. Those error messages are usually clear, once you see them a few times.

    No such file or directory says where ever you tried to run the program from, it isn't there. Figure out where it is, then run it from the correct location. It could be that the program isn't on the system. Usually, that would mean it isn't installed or it was incorrectly installed or it was installed to somewhere NOT in the PATH.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •