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

Unable to Run AppImages without appimagelauncher Installed or binfmt-bypass #107

Closed
nazdridoy opened this issue Jan 18, 2024 · 34 comments
Closed

Comments

@nazdridoy
Copy link
Contributor

nazdridoy commented Jan 18, 2024

Description

Issue Summary

I'm encountering difficulties running AppImages without having appimagelauncher installed. Whenever I attempt to run an AppImage, I receive an error message stating "no such file or directory," even though I can visibly see the file in question. Interestingly, I found that if I have a copy of /usr/lib/appimagelauncher/binfmt-bypass from appimagelauncher, I can successfully run the AppImages using the command ./binfmt-bypass demo.appimage.

Steps to Reproduce

  1. Try running an AppImage without appimagelauncher installed.
  2. Observe the error message indicating "no such file or directory."

Environment

  • Operating System: Archlinux

Additional Information

2024-01-19_04-14

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 18, 2024

Have you installed it using AppMan?

This may be a duplicated of ivan-hc/AppMan#25 and ivan-hc/AppMan#26

In brief you should check your ~/.profile and ~/.bashrc file to put ~/.local/bin at the end of echo $PATH (I don't know what to do about ZSH)

EDIT: AppMan already do these patches when you use it, using the following function

function _patch_bashrc_and_profile(){
	if $(! grep -q 'export PATH=$PATH:$(xdg-user-dir USER)/.local/bin' $HOME/.bashrc); then
		echo 'export PATH=$(echo $PATH | tr ":" "\n" | grep -v "/.local/bin" | tr "\n" ":" | sed ''s/.$//'')' >> $HOME/.bashrc
		echo -e 'export PATH=$PATH:$(xdg-user-dir USER)/.local/bin\n' >> $HOME/.bashrc
	fi
	if $( grep -q 'PATH="$HOME/.local/bin:$PATH"' $HOME/.profile); then
		sed -i 's#PATH="$HOME/.local/bin:$PATH"#PATH="$PATH:$HOME/.local/bin"#g' $HOME/.profile
	fi
}

@nazdridoy
Copy link
Contributor Author

I've tried both AM and AppMan. and i don't think its about the PATH variable or specific to zsh or bash shell.

2024-01-19_10-16
2024-01-19_10-13

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

is this happening only with obsidian or with all other appimages?

@nazdridoy
Copy link
Contributor Author

No, I've encountered this issue with every AppImage I've tested so far. I had to uninstall AppImageLauncher for some reason, and I'm experiencing the problem. The only workaround I've found is to run AppImages with binfmt-bypass

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

I suppose that you're using a minimal DE or just a WM with as less packages installed as possible. Isn't it?

@nazdridoy
Copy link
Contributor Author

no i'm running KDE Plasma 5.27.10 with Packages: 2087 (pacman), 18 (flatpak)

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

is fuse2 or fuse3 installed?

@nazdridoy
Copy link
Contributor Author

yes

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

have you tried to revert the order of $PATH in your ~/.profile file?

sed -i 's#PATH="$HOME/.local/bin:$PATH"#PATH="$PATH:$HOME/.local/bin"#g' $HOME/.profile

from the screenshot it seems not

@nazdridoy
Copy link
Contributor Author

yes.

2024-01-19_11-13

again, i don't think its about PATH.

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

I've never seen so many paths into a echo $PATH

However, you must edit your ~/.profile.

If it is not available, add this at the end of the file:

if [ -d "$HOME/.local/bin" ] ; then
    PATH="$PATH:$HOME/.local/bin"
fi

this is my ~/.profile file

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$PATH:$HOME/.local/bin"
fi

it is a priority over ~/.bashrc

to have the following line in ~/.bashrc is not enough

export PATH=$PATH:$(xdg-user-dir USER)/.local/bin

@nazdridoy
Copy link
Contributor Author

2024-01-19_11-31

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

I don't really know why all this happens.

@nazdridoy
Copy link
Contributor Author

is it possible to package binfmt-bypass with AM? so that we can bypass

awkward workarounds like a FUSE filesystem.

and remove dependency on AppimageLauncher.

P.S i want AM to be the ultmate tool for appimage. i've uninstall AppimageLauncher, bauh, appimagePool

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

How you install/use it? Give me as much info as possible and I'll tri to implement it somewhere.

Now I go sleep, its 7 am here. I'll read it later.

@nazdridoy
Copy link
Contributor Author

nazdridoy commented Jan 19, 2024

you can build it from source or extract binfmt-bypass and libbinfmt-bypass-preload.so from appimageLauncher release package (MIT license)

I've created an issue at appimageLauncher. lets see if i can get more info from appimageLauncher team

ref:

  1. https://github.com/TheAssassin/AppImageLauncher/tree/master/src/binfmt-bypass
  2. https://github.com/TheAssassin/appimage-binfmt-bypass
  3. https://github.com/TheAssassin/AppImageLauncher/releases
  4. Unable to Run AppImages without appimagelauncher Installed or binfmt-bypass TheAssassin/AppImageLauncher#620

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

I would test this, if you have installed binutils and tar, do:

wget https://github.com/TheAssassin/AppImageLauncher/releases/download/v2.2.0/appimagelauncher_2.2.0-travis995.0f91801.xenial_amd64.deb
ar x appimagelauncher_2.2.0-travis995.0f91801.xenial_amd64.deb
tar fx tar fx data.tar.xz

then

export LD_LIBRARY_PATH=/path/to/usr/lib/x86_64-linux-gnu/appimagelauncher/:"${LD_LIBRARY_PATH}"

then try to exec a program and tell me if this works for you

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

I have seen that AppImageLaunhcer installs a service from "/usr/lib/systemd/user/" named "appimagelauncherd.service" that redirects to "/urs/bin/appimagelauncherd".

If the step I've suggested previously is not enoug, you should export also $PATH

EDIT: I hope that exporting libraries is enough, I don't like the idea of a third party daemon running on my system.

@nazdridoy
Copy link
Contributor Author

then try to exec a program and tell me if this works for you

2024-01-20_02-20

nope. doesn't seem to work

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

so it works without the daemon... interesting.

If @TheAssassin authorizes me, I could write an option in AM to solve the problem using his libraries

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

is binfmt-bypass a standalone binary that works without libbinfmt-bypass-preload.so or needs it?

@TheAssassin
Copy link

You need both. The preload library is injected by binfmt-bypass into the target AppImage using LD_PRELOAD.

@nazdridoy
Copy link
Contributor Author

is binfmt-bypass a standalone binary that works without libbinfmt-bypass-preload.so or needs it?

both

@TheAssassin
Copy link

That said, why do you need to worry about these at all anyway? If you want to suppress AppImageLauncher ('s GUI) you can just export an environment variable.

@nazdridoy
Copy link
Contributor Author

That said, why do you need to worry about these at all anyway? If you want to suppress AppImageLauncher ('s GUI) you can just export an environment variable.

to be honest I was trying to understand why i can't run appimages without binfmt-bypass

@TheAssassin
Copy link

Have you ever had installed AppImageLauncher? Then it might be some leftover binfmt_misc configuration.

> cat /proc/sys/fs/binfmt_misc/appimage-type*
enabled
interpreter /usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-interpreter
flags: F
offset 8
magic 414901
enabled
interpreter /usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-interpreter
flags: F
offset 8
magic 414902

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

@TheAssassin its exactly what I was thinking about, maybe...

echo 'export LD_LIBRARY_PATH=/path/to/usr/lib/x86_64-linux-gnu/appimagelauncher/:"${LD_LIBRARY_PATH}"' >> $HOME/.bashrc
echo 'export LD_PRELOAD=/path/to/usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-bypass' >> $HOME/.bashrc

is this correct?

@nazdridoy
Copy link
Contributor Author

Have you ever had installed AppImageLauncher? Then it might be some leftover binfmt_misc configuration.

> cat /proc/sys/fs/binfmt_misc/appimage-type*
enabled
interpreter /usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-interpreter
flags: F
offset 8
magic 414901
enabled
interpreter /usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-interpreter
flags: F
offset 8
magic 414902

yes it all started after i uninstalled appimagrlauncher for some reason

> cat /proc/sys/fs/binfmt_misc/appimage-type*
enabled
interpreter /usr/bin/AppImageLauncher
flags: 
offset 8
magic 414901
enabled
interpreter /usr/bin/AppImageLauncher
flags: 
offset 8
magic 414902

@TheAssassin
Copy link

TheAssassin commented Jan 19, 2024

@ivan-hc if they do not intend to use AppImageLauncher, there is no reason to worry about binfmt-bypass. I think you may not have entirely understood yet what it is good for. It is just needed with AppImageLauncher's own binfmt-bypass rules, which should not be active if AppImageLauncher is not installed.

@nazdridoy for a quick test, I suggest you disable binfmt_misc temporary using sudo systemctl stop systemd-binfmt.service.

You may have to reboot to get rid of those rules if you had AppImageLauncher installed in the meantime. While systemd's binfmt_misc integration enables new rules very quickly, it doesn't recognize that the configuration files were deleted and thus does not remove those rules. If you do not want to reboot and are on Debian, you can use sudo update-binfmts --disable appimage-type2 and sudo update-binfmts --disable appimage-type1 to disable them until you reboot.

Edit: AppImageLauncher's packaging scripts request a reboot from the user in a short message. They also set a flag on the system so that Ubuntu, Debian etc. suggest restarting like any other package would. Sometimes, people overlook those messages, though.

@nazdridoy
Copy link
Contributor Author

sudo systemctl stop systemd-binfmt.service

yeap that fixed the issue.

Edit: AppImageLauncher's packaging scripts request a reboot from the user in a short message. They also set a flag on the system so that Ubuntu, Debian etc. suggest restarting like any other package would. Sometimes, people overlook those messages, though.

hmm. i don't remeber seeing any warning. but thank you for the clearification. am going to close both of the issue.

@ivan-hc
Copy link
Owner

ivan-hc commented Jan 19, 2024

@nazdridoy I've not understood, was it the active service that prevented you from running the Appimages?

@TheAssassin
Copy link

TheAssassin commented Jan 19, 2024

@ivan-hc re-reading #107 (comment), I suggest you remove those comments. They are quite misleading and could cause people more harm than good. As said, binfmt-bypass is a component only AppImageLauncher itself should ever use directly. That's why it's not exposed to the user but "hidden" in /usr/lib.

was it the active service that prevented you from running the Appimages?

It was a left-over from a previous AppImageLauncher installation paired with a user who clearly doesn't know the internals of AppImageLauncher (who I don't blame for that, by the way, you shouldn't need to know). Most of the discussion was leading away from the first fact, causing you to chase red herrings.

@nazdridoy
Copy link
Contributor Author

@nazdridoy I've not understood, was it the active service that prevented you from running the Appimages?

umm.. as far as i understand. yes. some leftover from the appimagelauncher was causing the issue. and binfmt-bypass was jut bypassing binfmt_misc.

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