What linux distro are you running? Cura is probably going to assume a debian-based environment, and if you're running RedHat, CentOS, OpenSUSE - then you're probably going to have problems. Answer from StandNaive4540 on reddit.com
Top answer
1 of 2
1

Does the code block? If it doesn't, there should be no ramifications of running it in the main thread. You can, however, do that from another thread, with:

Context.runOnUiThread(new Runnable() {
    getPathOfExecutable();
});

This is the cleanest work around I can think of, short of editing the permissions of your file (that you can't get the path of without running your code on the main thread anyways) because you have r/w privileges on /proc/self/exe.

This is very weird, and I am still researching the permission differences in different threads on android.

If you can get it working in the main thread, my opinion would be to just do it in the main thread, and not worry much about optimization, as the performance is no different on different threads.

2 of 2
0

What would be a workaround to get the path of the current executable?

Since every Android app is forked from Zygote, which is the first Java vm process when the virtual machine created by /system/bin/app_process at system booting.

If you try to read the /proc/self/exe from your Android app, the actual executable will be /system/bin/app_process. Even if you read this outside of your app's main thread, the result is the same and it wouldn't have the permission error in theory.

The question you asked is a kind of weird problem, I have tested with the following code on Android 2.3.3 and worked fine.

new Thread() {

    /* (non-Javadoc)
     * @see java.lang.Thread#run()
     */
    @Override
    public void run() {
        // TODO Auto-generated method stub
        super.run();
        try {
            Log.d(TAG, new File("/proc/self/exe").getCanonicalFile().getPath());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}.start();
🌐
Reddit
reddit.com › r/linuxquestions › [ubuntu 18.04.4 lts] can't execute appimage file. no matter what i've googled i can't fix this.
r/linuxquestions on Reddit: [Ubuntu 18.04.4 LTS] Can't execute AppImage file. No matter what I've googled I can't fix this.
March 30, 2020 -

I want to install clipgrab from clipgrab.org. I download the AppImage file, make sure I click "Allow executing file as program" checkbox in the properties for the file, I double click it and I get this message:

Cannot mount AppImage, please check your FUSE setup

So I uninstall and reinstall FUSE:

sudo apt-get purge fuse

sudo apt-get install fuse

I try again and I get the same message. What do I do? I'm honestly stuck. I can install clipgrab with:

sudo apt-get install clipgrab

but that doesn't give me the latest version. I haven't been able to update it also even though I added the ppa from launchpad. This is just eternally frustrating. Every guide I tried leads nowhere. I just want the latest version of clipgrab and a method to update it when a new version comes out. Thanks for anyone who could help.

🌐
GitHub
github.com › keepassxreboot › keepassxc › issues › 5138
AppImage does not launch without sudo · Issue #5138 · keepassxreboot/keepassxc
July 20, 2020 - Overview When I run AppImage executable, I get following error: Cannot open /proc/self/exe: Permission denied Failed to get fs offset for /proc/self/exe However it is working with sudo. Steps to Reproduce ./KeePassXC-2.6.0-x86_64.AppImag...
Author   keepassxreboot
🌐
GitHub
github.com › AdguardTeam › AdGuardHome › issues › 4509
panic: readlink /proc/self/exe: permission denied · Issue #4509 · AdguardTeam/AdGuardHome
April 20, 2022 - Issue Details With AdGuard Home v0.107.6 I get the following error: panic: readlink /proc/self/exe: permission denied goroutine 1 [running]: github.com/AdguardTeam/AdGuardHome/internal/home.initWorkingDir({0x0, {0x0, 0x0}, {0x0, 0x0}, {0...
Author   AdguardTeam
🌐
Plan
saxonica.plan.io › issues › 2176
Support #2176: Unable to read link /proc/self/exe : Permission denied (errno 13) - SaxonC - Saxonica Developer Community - SaxonC - Saxonica Developer Community - SaxonC - Saxonica Developer Community
Probably, this special user (but not the user that runs the application) has not enough rights for accessing "/proc/self/exe". Also, please ask the user if SELinux is installed on the target system. SELinux provides extended permissions for system files and utilities, so it could be the root ...
🌐
Stack Overflow
stackoverflow.com › questions › 41675809 › permission-denied-while-accessing-proc-pid-exe
linux - Permission denied while accessing /proc/<pid>/exe - Stack Overflow
I am having trouble accessing the file in /proc filesystem My process once started writes in a log file .My process was stopped and when i checked the logfile to see where it encountered the problem and found "permission denied". it goes to the /proc directory ,fetches PID via getPID() and fires open() using O_RDONLY to read /proc/<pid>/exe but after firing i get an error "Permission denied".
🌐
GitHub
github.com › moby › moby › issues › 18883
readlink /proc/self/exe permission denied inside created thread of container entry point · Issue #18883 · moby/moby
December 23, 2015 - The results I received: Calls to readlink() on anything that's a link inside of /proc/self return permission denied, for my entrypoint process in a docker container (using the ubuntu container as a base), and if I'm calling it from a thread other than the main thread. The results I expected: Calls to readlink() on valid links inside /proc/self work correctly from any thread in my process, even if my process is a docker entrypoint. Additional info I think is important: Here's a simple test program that uses /proc/self/exe:
Author   moby
🌐
Stack Exchange
unix.stackexchange.com › questions › 588488 › failure-to-stat-proc-self-map-files-symlink-permission-denied
linux - failure to stat /proc/self/map_files symlink - permission denied? - Unix & Linux Stack Exchange
May 23, 2020 - So I can lstat the original symlink, I can stat the target file, but regular stat on the symlink fails. I guess the problem is related to the following section of the man page: No permissions are required on the file itself, but—in the case of stat(), fstatat(), and lstat()—execute (search) permission is required on all of the directories in pathname that lead to the file. It seems that /proc/$PID/map_files/ itself is not +x, so the process does not have the permissions to stat any of these symlinks?
Find elsewhere
🌐
Google Groups
groups.google.com › a › lbl.gov › g › singularity › c › mQDBffIYFhQ
with singularity version 3.0.0 : Cant' open /proc/self/auxv: Permission denied
November 14, 2018 - Can we also see (assuming /usr/local prefix): ls -l /usr/local/libexecdir/singularity/bin/ ls -l /proc/self/auxv Something doesn't look quite right in the output ... It's running `is_suid` .. but it _should_ be running as root (U=0) if starter-suid is being called, and the permissions on it are correct. But again, that doesn't explain why you're getting a permission denied error on opening /proc/self/auxv ...
🌐
GitHub
github.com › rootless-containers › rootlesskit › issues › 68
failed to start the child: fork/exec /proc/self/exe: permission denied · Issue #68 · rootless-containers/rootlesskit
June 12, 2019 - $ rootlesskit sh [rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: permission denied $ rootlesskit -v rootlesskit version 0.4.1
Author   rootless-containers
🌐
Red Hat
access.redhat.com › solutions › 1446823
Permission denied when reading /proc/$PID/* owned by the user - Red Hat Customer Portal
August 5, 2024 - When reading /proc/$PID/environ, Permission denied is received even though process is owned by the user trying to read, and file permissions indicate it can read the file $ ls -l /proc/3039/environ -r--------. 1 test root 0 May 21 14:02 /proc/3039/environ $ id uid=500(test) gid=501(test) ...
🌐
KDE Bug Tracker
bugs.kde.org › show_bug.cgi
442057 – AppImage won't start
September 18, 2021 - KDE Bugtracking System – Bug 442057 AppImage won't start Last modified: 2021-09-18 16:24:22 UTC · New · Browse · Search · Reports · Requests · Help · New Account · Log In · Forgot Password
🌐
Docker Community
forums.docker.com › docker engine › general
Docker run error: /proc/self/fd/6: permission denied - General - Docker Community Forums
January 18, 2026 - Hi, I’m pretty new to docker and was trying to install it and run the hello-world container on a new Ubuntu 25.10 machine. I followed the steps listed here: Ubuntu | Docker Docs and used the “apt” install method (I am not using docker desktop). Here is the result of docker --version and ...
🌐
GNU
lists.gnu.org › archive › html › linphone-users › 2020-09 › msg00007.html
Re: [Linphone-users] (Linux) Desktop 4.2.2 - Qt5.12.5 - Cannot open /pro
September 12, 2020 - On Fri, Sep 11, 2020 at 09:29:37PM ... get fs offset for /proc/self/exe The first thing is to check what he sees with ls -l /proc/sys/exe "exe Link to the executable of this process" - from Documentation/filesystems/proc.rst in the kernel source....
🌐
Red Hat
access.redhat.com › solutions › 3662981
Executing a process in a container fails with error "fork/exec /proc/self/exe: no such file or directory" - Red Hat Customer Portal
Trying to execute a new process ... restart For this issue to be triggered, the affected container had to be still running when the docker daemon was stopped the last time....
🌐
Samba
bugzilla.samba.org › show_bug.cgi
15004 – btrfs_fget_compression: /proc open of /proc/self/fd/48 failed: Permission denied
March 8, 2022 - The Samba-Bugzilla – Bug 15004 btrfs_fget_compression: /proc open of /proc/self/fd/48 failed: Permission denied Last modified: 2022-06-14 18:28:07 UTC
🌐
GitHub
github.com › Revolutionary-Games › Thrive-Launcher › issues › 151
Linux Launcher fails to run (chrome sandbox) · Issue #151 · Revolutionary-Games/Thrive-Launcher
March 21, 2022 - Cannot open /proc/self/exe: Permission denied Failed to get fs offset for /proc/self/exe
Author   Revolutionary-Games
🌐
Linux Questions
linuxquestions.org › questions › linux-software-2 › proc-permission-is-denied-4175700024
[SOLVED] proc permission is denied.
When I run Visual Studio Code. It gives the error: Code: grep: /proc/version: Permission denied . Somewhere on the internet I found that entering [CODE