ivan-hc / ArchImage

Build AppImage packages for all distributions but including Arch Linux packages. Powered by JuNest.
GNU General Public License v3.0
123 stars 2 forks source link

Portability issue #1

Closed ivan-hc closed 1 year ago

ivan-hc commented 1 year ago

How to reproduce the error

In my tests I'm focused on OBS Studio, to get the script and made it executable

wget https://raw.githubusercontent.com/ivan-hc/ArchImage/main/apps/obs-junest.sh
chmod a+x ./obs-junest.sh

Once downloaded the script to create OBS Studio, uncomment the lines 56 and 57, this way

rm -R -f ./$APP.AppDir/.junest/home
ln -s /home ./$APP.AppDir/.junest/home

This step is needed to prevent that Junest creates a directory /home/$USER in it.

Save the script and run it

./obs-studio.sh

Issue

JuNest use bwrap to containerize Arch Linux.

By running the AppRun, after the steps above, I get this message:

./obs-studio.AppDir/AppRun 
bwrap: Can't mkdir /home/ivan: No such file or directory

By running the AppImage instead

./*AppImage
bwrap: Can't mkdir /home/ivan: No such file or directory

Plus an additional message that normally appears also when this kind of AppImage is created normally, the one you create by default, with lines 56 and 57 commented. Just to be precise:

 /tmp/.mount_OBS_St5J66Th/.local/share/junest/lib/core/wrappers.sh: line 30: /tmp/.mount_OBS_St5J66Th/.junest/usr/bin/junest_wrapper: Read-only file system

We can ignore this message.

AppImages can be containerized by creating a directory with the same name of the AppImage, near it, example:

AppImage= ./OBS-Studio_29.1.1-2-x86_64.AppImage
Directory= ./OBS-Studio_29.1.1-2-x86_64.AppImage.home 

For this kind of AppImage this method does not work, this is the output:

Setting $HOME to /home/ivan/Scrivania/tmp/OBS-Studio_29.1.1-2-x86_64.AppImage.home
bwrap: Can't mkdir /home/ivan/Scrivania/tmp/OBS-Studio_29.1.1-2-x86_64.AppImage.home: Read-only file system

NOTE: I had all the same issues above when using this script wit Github Actions, the first time I created it

So, to work the AppImage needs to be compiled on the same directory of $USER

This is important, because if you compile this script as root, the AppImage will not work with the normal user.

Conclusions

The issue is this message:

bwrap: Can't mkdir /home/ivan: No such file or directory
ivan-hc commented 1 year ago

https://github.com/fsquillace/junest/issues/334

ivan-hc commented 1 year ago

the AppRun content is this

#!/bin/sh
HERE="$(dirname "$(readlink -f $0)")"
export UNION_PRELOAD=$HERE
export JUNEST_HOME=$HERE/.junest
export PATH=$HERE/.local/share/junest/bin/:$PATH
echo "obs $@" | $HERE/.local/share/junest/bin/junest -n
ivan-hc commented 1 year ago

@TheAssassin @probonopd @azubieta any idea on what should I do?

probonopd commented 1 year ago

Hi @ivan-hc, it seems like this is not an issue with the AppImage file format but an issue with obs-junest.sh, or with its dependency, junest, or with its dependency, bwrap. I am not familiar with neither, so I can't be of much help here.

From a quick glance at the junest documentation, it seems like Proot can be used as a backend for junest instead of bwrap, did you try that already?

ivan-hc commented 1 year ago

I can't test now, because on the Arch Linux side they have a dependency problem that is not related to the AppImage, i.e.

obs: error while loading shared libraries: libicui18n.so.73: cannot open shared object file: No such file or directory

However, I've not tested proot, I've not understand how to do, it gaves me always the same error when I try to do so:

fakeroot: preload library `libfakeroot.so' not found, aborting.

But libfakeroot is installed on the host, Debian, and the main Debian repo only provides:

/usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-0.so
/usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so
/usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-tcp.so
ivan-hc commented 1 year ago

I have changed the AppRun this way now:

#!/bin/sh
HERE="$(dirname "$(readlink -f $0)")"
export UNION_PRELOAD=$HERE
export JUNEST_HOME=$HERE/.junest
export PATH=$HERE/.local/share/junest/bin/:$PATH
echo "obs $@" | $HERE/.local/share/junest/bin/junest proot -n

in my first tests the AppImage works on my PC and into a *.home directory

Now I've uploaded my script on my other repository, this is the script:

https://raw.githubusercontent.com/ivan-hc/OBS-Studio-appimage/main/obs-junest.sh

The AppImage will be downloaded from here after GH Actions have finished:

https://github.com/ivan-hc/OBS-Studio-appimage/releases

ivan-hc commented 1 year ago

IT WORKS GREAT NOW!

Just downloaded from https://github.com/ivan-hc/OBS-Studio-appimage/releases and it works without issues!

@probonopd this time the biggest job will be deleting the excessive files, not guessing what dependencies the package needs to work!

Anyway I'm so happy now! I've been trying to build OBS Studio AppImage for a year! Thank you!

ivan-hc commented 10 months ago

Hi @probonopd , how are you?

I'm contacting you to tell you that I improved the ArchImage project by eliminating proot in favor of bwrap (Bubblewrap).

All its left to do is letting the bundle use host's hardware accelleration. Someone from the "Bottles" project is helping me with this.

Great improvements are expected.

I would be happy if you could participate.