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

Do not hard error if libfuse is not present #123

Closed
probonopd opened this issue Mar 28, 2016 · 19 comments
Closed

Do not hard error if libfuse is not present #123

probonopd opened this issue Mar 28, 2016 · 19 comments

Comments

@probonopd
Copy link
Member

We could use dlopen ("/usr/lib64/libfuse.so.2", RTLD_LAZY); like on http://www.dwheeler.com/program-library/Program-Library-HOWTO/x172.html to print a nice message saying you can extract or mount the ISO if libfuse is not present.

Message:
It looks like libfuse is not installed on your system. To run this AppImage, you can loop-mount it or extract its contents, e.g. 7zx. See https://github.com/probonopd/AppImageKit/wiki/FUSE for more information.

@RazZziel
Copy link

Very interesting. According to the manual, dlopen("libfuse.so.2", RTLD_LAZY); would be more advisable, because it'd look for the library in the standard paths, although a fallback could be setup to find the library for instance in /tmp/libfuse.so.2, where we can download it without messing up the system, specially on 32bit AppImages on 64bit systems, where 32bit libfuse.so.2 is difficult to install.

@hideout
Copy link

hideout commented Mar 30, 2016

nice dlopen sounds good for that problem

2016-03-30 7:30 GMT+02:00 Ismael Barros² notifications@github.com:

Very interesting. According to the manual, dlopen("libfuse.so.2",
RTLD_LAZY); would be more advisable, because it'd look for the library in
the standard paths, although a fallback could be setup to find the library
for instance in /tmp/libfuse.so.2, where we can download it without messing
up the system, specially on 32bit AppImages on 64bit systems, where 32bit
libfuse.so.2 is difficult to install.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#123 (comment)

@probonopd
Copy link
Member Author

dlopen("libfuse.so.2", RTLD_LAZY); would be more advisable

Correct. Anyone volunteers to do a PR?

@crayxt
Copy link
Contributor

crayxt commented Apr 1, 2016

Will this cover the case when user is not a member of fuse group?

@RazZziel
Copy link

RazZziel commented Apr 1, 2016

I don't think so, but at least we can warn the user

@probonopd
Copy link
Member Author

KDevelop IRC thinks this would be a good idea, since a good error message helps in these cases.

@probonopd
Copy link
Member Author

Here is an example of how to do this:
https://github.com/Efreak/apt-cacher-ng/blob/bb751da674c03ea81f0b4381c606b537c853b679/fs/httpfs.cc#L783-L807

Now, how do I get this into https://github.com/probonopd/appimagetool/blob/master/runtime.c? Probably it has to go into squashfuse... hl.c looks similar to the one linked above in that it calls fuse_main() but we are using ll.c iirc - so probably we need to dlsym significantly more than in the example above.

@darealshinji
Copy link
Contributor

I have an idea:
You could build the main part of the runtime as a shared library (everything requiring libfuse). Create a header file from it (xxd -i AppImage.so > AppImage_so.h), include it in the the now smaller runtime binary, and when running the binary it will dump the library into a temporary file and try to dlopen() it. If it fails because libfuse is missing, print something useful.

@probonopd
Copy link
Member Author

Cool idea but makes the code larger and more complex, and is not so clean (clutters /tmp).

What do you think, could we somehow cleverly use weak symbols?

@darealshinji
Copy link
Contributor

I gave it a try: https://github.com/darealshinji/AppImageKit/tree/dlopen
The binaries are linked against libdl and not libfuse, but I didn't check if the runtime actually works when you build an AppImage with it.

@probonopd
Copy link
Member Author

Can you upload a build here? Thanks.

@darealshinji
Copy link
Contributor

build.zip

@probonopd
Copy link
Member Author

@darealshinji hats off, it works 👍 💯 🥇

Please send PR.

@darealshinji
Copy link
Contributor

Whoa, nice. Can you check what happens if libfuse is not present? Right now the invoked macros will call exit(1). I don't know if that's ok. Also, what kind of error message do you want? Something including a link to the wiki maybe?

@probonopd
Copy link
Member Author

probonopd commented Feb 24, 2017

This is the error message that appears when the library is not available:

me@host:~$ ./XChat_IRC-x86_64.AppImage 
dlopen(): error loading libfuse.so.2
execv error: No such file or directory

But even in this case, this works:

me@host:~$ ./XChat_IRC-x86_64.AppImage --appimage-extract

So as the message, how about this?

@probonopd
Copy link
Member Author

When libfuse is not present, we currently get

me@host:~$ /home/me/Downloads/appimagetool-x86_64.AppImage 
dlopen(): error loading libfuse.so.2
AppImages require FUSE to run. 
You might still be able to extract the contents of this AppImage 
if you run it with the --appimage-extract option. 
See https://github.com/probonopd/AppImageKit/wiki/FUSE 
for more information

execv error: No such file or directory

Can you get rid of the execv error: No such file or directory?

@darealshinji
Copy link
Contributor

#365

@TheAssassin
Copy link
Member

This has been solved in #365.

@DevRelMalima
Copy link

Try run this
me@host:~$ /home/me/Downloads/appimagetool-x86_64.AppImage --appimage-extract

this should work

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

No branches or pull requests

7 participants