Results 1 to 4 of 4

Thread: Installed lua 5.3.1 on openSUSE 13.1, but only sudo has access to it

  1. #1

    Default Installed lua 5.3.1 on openSUSE 13.1, but only sudo has access to it

    I am somewhat curious about how it really works.
    The original Lua 5.2.2 comes with the source but since it is not updated I downloaded Lua 5.3.1 myself and installed following the guide.
    However I found that I only have access to 5.3.1 when I am the root user or using sudo, otherwise when typing lua -v it still shows 5.2.2
    So I tried to uninstall 5.2.2 and install 5.3.1 again and nothing changed except I totally lose access to it when I am not root.
    When typing "lua" it shows

    /usr/bin/lua: No such file or directories

    and the makefile installed it automatically into /usr/local and separated into several different directories. While there does have a directories named Lua among them, it seems contains nothing inside.

    If I change its directory into /usr/bin/lua then it will be replaced by the lower version when updating the whole package, but I don't think I should use sudo every time to use lua. Did anyone have the same problem? How did you deal with it?

  2. #2

    Default Re: Installed lua 5.3.1 on openSUSE 13.1, but only sudo has access to it

    Quote Originally Posted by delta67 View Post
    I am somewhat curious about how it really works.
    The original Lua 5.2.2 comes with the source but since it is not updated I downloaded Lua 5.3.1 myself and installed following the guide.
    However I found that I only have access to 5.3.1 when I am the root user or using sudo, otherwise when typing lua -v it still shows 5.2.2
    So I tried to uninstall 5.2.2 and install 5.3.1 again and nothing changed except I totally lose access to it when I am not root.
    When typing "lua" it shows

    /usr/bin/lua: No such file or directories
    Close the terminal window and open a new one, that should fix it.
    The shell doesn't re-evaluate all path directories whenever you run a command. It found lua in /usr/bin/ before, so it tries to (only) run it from there now.

    That's probably also the reason why your newer lua was not found before.

    /usr/local/bin does come in the path before /usr/bin, so a lua installed there should be preferred over the system one in /usr/bin/.
    And that's the case for _all_ users, not only root, unless you modified your user's path manually.
    In your case, you probably ran lua (the one in /usr/bin/) already, so the shell kept running it from /usr/bin/, although a newer one existed in /usr/local/bin/.
    Running it via sudo started a new shell (as root), therefore the one in /usr/local/bin/ was found and used.
    Last edited by wolfi323; 03-Jul-2015 at 03:22.

  3. #3

    Default Re: Installed lua 5.3.1 on openSUSE 13.1, but only sudo has access to it

    Quote Originally Posted by wolfi323 View Post
    Close the terminal window and open a new one, that should fix it.
    The shell doesn't re-evaluate all path directories whenever you run a command. It found lua in /usr/bin/ before, so it tries to (only) run it from there now.

    That's probably also the reason why your newer lua was not found before.

    /usr/local/bin does come in the path before /usr/bin, so a lua installed there should be preferred over the system one in /usr/bin/.
    And that's the case for _all_ users, not only root, unless you modified your user's path manually.
    In your case, you probably ran lua (the one in /usr/bin/) already, so the shell kept running it from /usr/bin/, although a newer one existed in /usr/local/bin/.
    Running it via sudo started a new shell (as root), therefore the one in /usr/local/bin/ was found and used.
    WOW that's it. After re-open the terminal it is now ok. Thanks a lot! So it is the problem of something like a "path cache"?

  4. #4

    Default Re: Installed lua 5.3.1 on openSUSE 13.1, but only sudo has access to it

    Quote Originally Posted by delta67 View Post
    So it is the problem of something like a "path cache"?
    Yes.
    As mentioned, bash remembers where it found a command, and doesn't search for it in the whole path any more if it already knows (or believes to know) where to find it.
    This is probably done to speed up things for often called commands.

    See also: http://unix.stackexchange.com/questi...to-executables

Posting Permissions

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