Skip to content

Appimage does not launch (execv error: No such file or directory) #1004

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

Open
prog-amateur opened this issue Nov 15, 2019 · 10 comments
Open

Appimage does not launch (execv error: No such file or directory) #1004

prog-amateur opened this issue Nov 15, 2019 · 10 comments

Comments

@prog-amateur
Copy link

prog-amateur commented Nov 15, 2019

History :
Hello, I am sure you know Veracrypt app. It has a very useful portable version for Windows (to make it executable from a USB device) but not for Linux.
Thank to the developer, there is a generic installer with tar.bz2 which can extract the files instead of installing on the computer (it means there is binaries, images, and desktop file included).

Problem :
AppImage is the ideal tool to make it executable as a portable app, but... I am not a developer (if only you knew about my job, it has nothing to do with it).

I followed step by step an excellent tutorial from @probonopd , everything goes well (I even have a Success message at the end). Unfortunately, when I launch Veracrypt.AppImage, absolutely nothing happens. From the CLI, the message is as bellow:
execv error: No such file or directory

What do you think of that? I can't find the reason for this bug, however, I'm sure I'm very close to succeeding, it's frustrating. Thank you very much for your help!

Information about the step-by-step procedure I have followed :

# 1. Make the AppDir : 

cd ~/Documents
mkdir -p veracrypt/veracrypt.AppDir


# 2. Download the generic Veracrypt linux installer : 

wget -c https://launchpad.net/veracrypt/trunk/1.24-hotfix1/+download/veracrypt-1.24-Hotfix1-setup.tar.bz2
tar -xf veracrypt-1.24-Hotfix1-setup.tar.bz2 -C veracrypt_archive/
cd veracrypt_archive
./veracrypt-1.24-Hotfix1-setup-gui-x64 


# 3. Accept the license, select extract and go to /tmp to extract the tar.gz content into the AppDir : 

cd /tmp
tar -xf veracrypt_1.24-Hotfix1_amd64.tar.gz -C ~/Documents/veracrypt/veracrypt.AppDir/

# 4. In "/usr/share/applications/veracrypt.desktop" file, add "Version=1.0" below "Encoding=UTF-8" line and edit "Categories" line as "Categories=Utility;". Otherwise, I have "deprecated" error messages. 


# 5. Organize the AppDir and make the AppRun executable : 

cd ~/Documents/veracrypt/veracrypt.AppDir/
cp ./usr/share/pixmaps/veracrypt.xpm .
cp ./usr/share/applications/veracrypt.desktop .
wget -c https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-x86_64
chmod a+x AppRun-x86_64

# 6. Package the AppDir as an AppImage : 

cd ..
wget -c https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
chmod a+x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage veracrypt.AppDir ./Veracrypt-x86_64.AppImage

# 7. Launch Veracrypt-x86_64.AppImage (this is where I have the error message : execv error: No such file or directory) : 

./Veracrypt-x86_64.AppImage

@prog-amateur
Copy link
Author

prog-amateur commented Nov 15, 2019

Also just to say that after changing name from AppRun-x86_64 to AppRun, the error message seems to be "better" : I suspect a path issue in the desktop file :

Error: Error executing '/usr/bin/veracrypt': No such file or directory

@prog-amateur
Copy link
Author

OK ! I have found a workaround : I have copy-paste veracrypt bin into the veracrypt.AppDirfolder.
Then, I have edited the veracrypt.desktop file as below :

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=VeraCrypt
GenericName=VeraCrypt
Comment=VeraCrypt
Exec=veracrypt
Icon=veracrypt
Terminal=false
Type=Application
Categories=Utility;

I still don't understand why the path was marked as an error. I leave this issue opened a few time in order to let you answer me, and I hope to not forget to close it if you don't answer. Once again, thank you for your help.

@TheAssassin
Copy link
Member

You should never use absolute paths in a desktop file. It might work when installed on a system, but for AppImages it's a no-go.

The runtime shouldn't write execv error, we could check for the existence of AppRun and write a proper error message. In fact, both the runtime and appimagetool should write proper error messages.

You should try to get rid of this AppRun binary thing. Perhaps you can switch to linuxdeploy?

@prog-amateur
Copy link
Author

I have succeed to make it work only if I put the binary on the AppDir folder.
Do you succeed to make AppImage executable from USB drive (kind of portable mode) ? I can use my AppImage runs only out of my USB drive (it seems like a security from Linux). Do you have a tip or a tutorial link to make me run it from USB drive ? thank you very much.

@probonopd
Copy link
Member

Nothing special should be needed to run an AppImage from a USB drive. However, if your USB drive is FAT formatted, you may need this ugly workaround:
storaged-project/udisks#707

@HiranChaudhuri
Copy link

HiranChaudhuri commented Jan 21, 2022

Today I also perceive the same issue. This is my first AppImage so I have no successful projects to compare with.
I read https://docs.appimage.org/packaging-guide/index.html
I especially followed https://docs.appimage.org/packaging-guide/manual.html
When I was ready to package my AppDir, I was searching how to run it (that seems not part of the guide) but found https://github.com/AppImage/AppImageKit/blob/master/README.md
I got surprised by the fact that the presence of the custom keys triggered error messages, so I removed them again...
...and ended up with a file ending in .appimage.

When trying to run this appimage, I get the following output:

$ ls -l *.appimage
-rwxr-xr-x 1 hiran hiran 59212992 Jan 21 11:12 Nexus-1.0-SNAPSHOT-x86_64.appimage
$ ./Nexus-1.0-SNAPSHOT-x86_64.appimage 
execv error: No such file or directory
$ 

I validated the application starts up correctly when running from the AppDir. Right now I have no idea what to troubleshoot.
Any advice welcome

@HiranChaudhuri
Copy link

HiranChaudhuri commented Jan 21, 2022

Without further knowledge I simply started the appimage using strace:

$ strace ./Nexus-1.0-SNAPSHOT-x86_64.appimage

and stumbled over this line:

execve("/tmp/.mount_Nexus-rJ3MLl/AppRun", ["target/Nexus-1.0-SNAPSHOT-x86_64"...], 0x1dd61c0 /* 65 vars */) = -1 ENOENT (No such file or directory)
dup(2)                                  = 4
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1), ...}) = 0
write(4, "execv error: No such file or dir"..., 39execv error: No such file or directory

which told me that the entrypoint literally has to be named AppDir. From the documentation I feel this was not entirely clear since after all some of the files in AppDir have to be named according to the application you want to wrap.

Renaming my entry point application to AppDir resolved the issue.
Such a dumb error could and should have been caught when running appimagetool.

Also please add a documentation section about troubleshooting in the packaging guide.

@TheAssassin
Copy link
Member

It's AppRun, not AppDir. This has been documented in the AppDir specification, see https://docs.appimage.org/reference/appdir.html#general-description.

Feel free to send a PR that validates AppRun in some ways.

@JunchongTang
Copy link

这么写Exec=/usr/bin/my_flutter_app,执行 ./my_flutter_app-x86_64.AppImage 将会报错:

~/AndroidStudioProjects/my_flutter_app$ ./my_flutter_app-x86_64.AppImage 
execv error: No such file or directory

需要写启动脚本 ./appdir/AppRun

#!/bin/bash
current_path=$(dirname "$0")

echo "current path:$current_path"

$current_path/usr/bin/my_flutter_app

./appdir/my_flutter_app.desktop写法:

[Desktop Entry]
Categories=Development;
Comment=my flutter app
Encoding=UTF-8
Exec=AppRun
GenericName=my_flutter_app
Icon=flutter
Name=my_flutter_app
StartupNotify=false
Terminal=false
Type=Application

@probonopd
Copy link
Member

probonopd commented Jun 18, 2023

chmod +x ./appdir/AppRun
./appdir/AppRun

Works?

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

5 participants