Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyfetch fails to run on Termux due to missing '/usr/bin/env' #286

Closed
1 task done
icewithcola opened this issue May 15, 2024 · 4 comments
Closed
1 task done

Hyfetch fails to run on Termux due to missing '/usr/bin/env' #286

icewithcola opened this issue May 15, 2024 · 4 comments

Comments

@icewithcola
Copy link

Describe the bug

hyfetch cannot run on termux.

  • Does this issue still occur in the master branch? (Required)

Expected behavior

hyfetch should run normally on termux

Screenshots

Error: [Errno 2] No such file or directory: '/usr/bin/env'
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/main.py", line 424, in run
    asc = get_distro_ascii() if not args.ascii_file else Path(args.ascii_file).read_text("utf-8")
          ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/hyfetch/neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 1951, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/env'

Environment

Termux 0.118.0
Android 14
Python 3.11.8

Additional context

I made a simple fix and fixed my problem but haven't tested on other platforms.

@hykilpikonna
Copy link
Owner

Hmm didn't realize that termux doesn't have /usr/bin/env... Maybe a better way to fix this is testing if /usr/bin/env exists, use which bash if it doesn't exist

@hykilpikonna
Copy link
Owner

I think I fixed it. Please test it and lmk if it works or doesn't work

@icewithcola
Copy link
Author

I think I fixed it. Please test it and lmk if it works or doesn't work

It works now! Thanks for your fix.

@kurtbahartr
Copy link

Hmm didn't realize that termux doesn't have /usr/bin/env... Maybe a better way to fix this is testing if /usr/bin/env exists, use which bash if it doesn't exist

Just saw this issue in the release notes. Here's my two cents as to why.

  • Terminal emulators on Android, including Termux although more of a proot environment, always use Android's own rootfs when it comes to executions relative to root (/).
  • Android, being built different, has no /usr directory to begin with AFAIK. All executables that are there in Linux distros are scattered across system, product, vendor and sometimes oem/odm partitions. There's a /bin in the rootfs, of course, which is a symlink to /system/bin.
  • Termux works around this by adding its own usr directory, located in /data/data/com.termux/files/usr, into PATH while launching its profile within the app - This behavior could theoretically be replicated in a root shell, but I'm still yet to discover that.
  • Above is also the reason why Termux's package manager utilities, I.e. APT and PKG, refuse to work as root, because it would potentially impact the stability of or even completely break your ROM instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants