ivan-hc / VLC-appimage

VLC Video and Media Player AppImages built from JuNest (Arch Linux) and PPA.
24 stars 4 forks source link

VLC has no access to a mountpoints like ZFS filesystem mountpoint #11

Open slrslr opened 1 month ago

slrslr commented 1 month ago

Hello,

I have https://github.com/ivan-hc/VLC-appimage/releases/download/continuous/VLC-media-player_3.0.21-2-archimage3.4-x86_64.AppImage

on Debian 11, KDE, Dolphin(file manager)

When I try to open the file from within VLC, then I am unable to browse beyond Downloads folder, other folders are gray/inactive.

File opened via Dolphin file manager: VLC GUI says: Your input can't be opened: ...

CLI:

[00007f7abc005eb0] filesystem stream error: cannot open file pathhere.mkv (No such file or directory)
dvdnav demux error: Couldn't find device name.

Please how to fix this? Any command line switch to use? AppImage file has executable permission.

ivan-hc commented 1 month ago

What does "opened via Dolphin" mean?

AppImage behavior should be agnostic.

Independent of the type of file manager you are using.

Istantanea_2024-08-12_17-34-29

Maybe you have some settings or a sandbox enabled somewhere.

Istantanea_2024-08-12_17-36-30

Same for external devices mounted.

I cannot reproduce your issue.

slrslr commented 1 month ago

What does "opened via Dolphin" mean?

That I am using this file manager to open a video file (is opened in a VLC).

I do not remember enabling any sandbox. No SELinux, no AppArmor service running.

I am not having Arch Linux and your AppImage mentions it in its name. Maybe your AppImage is incompatible with a Debian 11 (amd64 x86_64) + KDE. :-S This AppImage worked for me: https://github.com/cmatomic/VLCplayer-AppImage btw...

ivan-hc commented 1 month ago

I use Debian Testing, XFCE. No issues here. And the fact that it is an Archlimage, means that this is an Arch Linux container into an AppImage, and this made it compatible with all distros, also with the old kernel 2.6x, of 10 years ago.

The fact that it can't acceede to XDG directories is new to me.

ivan-hc commented 1 month ago

About Archimage, it uses its internal copy of BubbleWrap to bind/mount a selected range of directories

--bind /home /home
--bind-try /run/user /run/user
--bind /etc/resolv.conf /etc/resolv.conf 
--bind /media /media
--bind /mnt /mnt
--bind /opt /opt
--bind /usr/lib/locale /usr/lib/locale
--bind /usr/share/fonts /usr/share/fonts
--bind /usr/share/themes /usr/share/themes

so /home is already among the mounted directories.

I don't know if this depends on whether BubbleWrap is installed on your system or not.

slrslr commented 1 month ago

@ivan-hc I am sorry confusing You! I have found that it indeed opens and plays file from /home/user/desktop and from /tmp

It only does not display mountpoints like zfs: df -h output: poolname/datasetname zfs 123T 12T 1T 12% /mountpointname

mount:

poolname/datasetname on /mountpointname type zfs (rw,noatime,xattr,noacl)
pool on /poolname type zfs (rw,xattr,noacl)

other AppImage (older VLC version) https://github.com/cmatomic/VLCplayer-AppImage displays these mountpoints well...

ivan-hc commented 1 month ago

so this is an issue with mountpoints then

try to extract the AppImage and edit the last line of the AppRun from this

$HERE/.local/share/junest/bin/junest -n -b "$BINDS" -- $EXEC "$@"

to this

$HERE/.local/share/junest/bin/junest -n -b "$BINDS --bind-try /mountpointname /mountpointname " -- $EXEC "$@"

and be sure that the related directory is in squashfs-root/.junest, the latter is an hidden directory, wiith a dot.

ivan-hc commented 1 month ago

and then run the AppRun script, from terminal

ivan-hc commented 1 month ago

to extract the AppImage, use the command ./*.AppImage --appimage-extract

slrslr commented 1 month ago

Thank you,


cd /path/to/appimagesdirectory/
./VLC-media-player_3.0.21-2-archimage3.4-x86_64.AppImage --appimage-extract
cd squashfs-root
# edit file as You have said, I wanted to also add /dev/shm mount point.
mkdir .junest/{mymntpointname1,mymntpointname2}
./AppRun
-> bwrap: execvp /dev/shm: Permission denied
sudo ./AppRun
-> bwrap: Can't find source path /home/user/appimagesdirectory/squashfs-root/.junest: Permission denied

After removing /dev/shm from a AppRun file, it worked and i can also play this /dev/shm directory files.

BUT, for some reason only one of the ZFS mountpoints shows contents in VLC.

poolname/datasetname1 on /mountpointname1 type zfs (rw,noatime,xattr,noacl)
poolname/datasetname2 on /mountpointname2 type zfs (rw,noatime,xattr,noacl)   <<---- this one works

AppRun: $HERE/.local/share/junest/bin/junest -n -b "$BINDS --bind-try /mountpointname1 /mountpointname2" -- $EXEC "$@"

When I have switched the mount points in the AppRun line to be opposite order: $BINDS --bind-try /mountpointname2 /mountpointname1

it displayed mountpointname2 content under a mountpointname1 in VLC yet mountpointname1 content is missing in VLC. Drag & dropping the file from a mountpoint, which content VLC fails to display, returns: VLC is unable to open the MRL 'file:///mountpointname1/abc/xyz.Avi'. Check the log for details.

Btw. the AppImage should access all mountpoints automatically, do you have idea how to achieve that please?

Btw., the default folders still shows gray and has no content (not a big deal for me though): image (in filemanager Dolphin I have "Pictures" link in places quick launch folder sidebar, which is a symbolic link to a ZFS mountpoint /mountpointname2 which works in VLC. But also my username folder which is grayed and obfuscated is empty)

slrslr commented 1 month ago

depends on whether BubbleWrap is installed on your system

$ apt search BubbleWrap

bubblewrap/oldstable,now 0.4.1-3 amd64 [installed,automatic]
  utility for unprivileged chroot and namespace manipulation
xdg-dbus-proxy/oldstable,now 0.1.2-2 amd64 [installed,automatic]
  filtering D-Bus proxy
xdg-dbus-proxy-tests/oldstable 0.1.2-2 amd64
  filtering D-Bus proxy - as-installed tests
ivan-hc commented 1 month ago

why you run the AppRun with sudo? Are you doing the same with the AppImage? You don't need sudo at all.

slrslr commented 1 month ago

why you

just a layman action, since it complained about permissions. But my AppImage (which fails as I have described in above posts) is ran without sudo, I have mentioned removing /dev/shm from AppRun file, so it no longer complained about insufficient permission, allowing me to run ./AppRun without sudo prefix.

This is interesting to me:

$ ./AppRun
bwrap: execvp /home/user/: Permission denied
$ whoami
user
# that is when i use /home/user/ as a --bind-try parameter
ivan-hc commented 1 month ago

maybe you had to --bind-try /dev /dev

ivan-hc commented 1 month ago

once you use --bind-try /dev /dev, the container will see only the content of /dev on the host, no mater what is available on the guest

do a test

slrslr commented 1 month ago

use --bind-try /dev /dev

yes, this alone make AppImage run, but does not display content of the said ZFS mountpoints nor of the gray folders as shown in my previous posts with a screenshot. If you can use messenger https://getsession.org we can talk there.

Btw. maybe you can use following in AppRun, since it may automatically detect user mountpoints?

BINDS=$(mount | awk -v uid="$(id -u)" '$3 ~ /^\// {
    # Get the owner of the mountpoint using stat
    cmd = "stat -c %u " $3
    cmd | getline owner
    close(cmd)

    # Check if user is owner and has write permission
    if (owner == uid && system("test -w " $3) == 0) {
        print "--bind-try " $3
    }
}' | tr '\n' ' ')
echo "Binding the following paths: $BINDS"
#exit
exec $HERE/.local/share/junest/bin/junest -n -b "$BINDS" -- $EXEC "$@"

Binding the following paths: --bind-try /run/user/1000 --bind-try /mountpointname1 --bind-try /poolname --bind-try /mountpointname2

yet, in my case it complained: bwrap: execvp /mountpointname1: Permission denied

That mountpoint had 777 permission and ownership by my current regular user/group. I have tried to set it to 755 as other mountpoint2 (which content previously loaded in VLC), yet it does not prevent permission denied, chmod 755,777 on the .junest/mymntpointname1 does not fix it either. What helped to that permission denied issue: Replace above mentioned line: print "--bind-try " $3 by: print "--bind-try " $3; print "" $3 (in another words each --bind-try must have two same parameters (same mountpoints), like: --bind-try /mnt /mnt

ivan-hc commented 1 month ago

I suggest to to fork this repo and test the changes in your fork, because its totally different to compile this kind of AppImage on your PC or on GH actions:

  1. edit the vlc-junest.sh file by adding your changes to the AppRun, between lines 120 and 148
    
    #!/bin/sh
    HERE="$(dirname "$(readlink -f $0)")"
    export UNION_PRELOAD=$HERE
    export JUNEST_HOME=$HERE/.junest
    export PATH=$PATH:$HERE/.local/share/junest/bin

if test -f /etc/resolv.conf; then ETC_RESOLV=' --bind /etc/resolv.conf /etc/resolv.conf '; fi if test -d /media; then MNT_MEDIA_DIR=' --bind /media /media '; fi if test -d /mnt; then MNT_DIR=' --bind /mnt /mnt '; fi if test -d /opt; then OPT_DIR=' --bind /opt /opt '; fi if test -d /run/user; then USR_LIB_LOCALE_DIR=' --bind /usr/lib/locale /usr/lib/locale '; fi if test -d /usr/share/fonts; then USR_SHARE_FONTS_DIR=' --bind /usr/share/fonts /usr/share/fonts '; fi if test -d /usr/share/themes; then USR_SHARE_THEMES_DIR=' --bind /usr/share/themes /usr/share/themes '; fi

BINDS=" $ETC_RESOLV $MNT_MEDIA_DIR $MNT_DIR $OPT_DIR $USR_LIB_LOCALE_DIR $USR_SHARE_FONTS_DIR $USR_SHARE_THEMES_DIR "

if test -f $JUNEST_HOME/usr/lib/libselinux.so; then export LD_LIBRARY_PATH=/lib/:/lib64/:/lib/x86_64-linux-gnu/:/usr/lib/:"${LD_LIBRARY_PATH}" fi

EXEC=$(grep -e '^Exec=.' "${HERE}"/.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g') $HERE/.local/share/junest/bin/junest -n -b "$BINDS" -- $EXEC "$@"



2. go in the Actions tab of your fork and run the workflow "Release VLC Appimage"

3. wait 4 minutes or more, then download your AppImage from "latest", in your fork

4. if all goes well, consider submitting a pull request
ivan-hc commented 1 month ago

just seen that you forked the repo, contact me here in case of problems

slrslr commented 1 month ago

contact me

Why not using --bind-try instead of checking each folder/mountpoint existence and then doing --bind ? The "try" option cause "rather than failing, the command will succeed, and the bind mount will simply not occur."

Can I change that? If you can, message me on Session.

ivan-hc commented 1 month ago

sure, you can, this is a change I discovered too late, and I have 70+ repositories like this, I had not much time to care all of them...this is why I don't create many appimages as before

slrslr commented 1 month ago

Running the built AppImage returns: bwrap: Can't mkdir /mountpointname1: Read-only file system

After extracting that file and running ./squashfs-root/AppRun , it runs without problem and i can access that mountpoint (it is that ZFS one). The file ./squashfs-root/AppRun contains: exec $HERE/.local/share/junest/bin/junest -n -b "$BINDSA $BINDSB " -- $EXEC "$@"

The "stat" command on /mountpointname1 returns: Access: (6755/drwsr-sr-x) Uid: ( 1000/ user) Gid: ( 1000/ user)

and "mount" command returns: type zfs (rw,noatime,xattr,noacl)

"ls -ld /mountpointname1" command returns: drwsr-sr-x 13 user user 15 Jul 24 07:58 /mountpointname1

so I assume it is not a read only filesystem.

$ sestatus bash: sestatus: command not found

Runnin AppImage using sudo, returns: /bin/sh: 0: Illegal option --

$ head -n 4 ./squashfs-root/AppRun

#!/bin/sh
HERE="$(dirname "$(readlink -f $0)")"
export UNION_PRELOAD=$HERE
export JUNEST_HOME=$HERE/.junest

I want to note that helping me can mean spent more time than doing it yourself, I am not a developer and i forget learned things very quickly.

ivan-hc commented 1 month ago
BINDSA="--bind-try /etc/resolv.conf /etc/resolv.conf --bind-try /media /media --bind-try /mnt /mnt --bind-try /opt /opt --bind-try /usr/lib/locale /usr/lib/locale --bind-try /usr/share/fonts /usr/share/fonts --bind-try /usr/share/themes /usr/share/themes"
# Discover another user accessible mountpoints
BINDSB=$(mount | awk -v uid="$(id -u)" '$3 ~ /^\// {
    # Get the owner of the mountpoint using stat
    cmd = "stat -c %u " $3
    cmd | getline owner
    close(cmd)
    # Check if user is owner and has write permission
    if (owner == uid && system("test -r " $3) == 0) {
        print "--bind-try " $3; print "" $3
    }
}' | tr '\n' ' ')
#echo "Binding the following paths: $BINDSA $BINDSB ."
#exit
exec $HERE/.local/share/junest/bin/junest -n -b "$BINDSA $BINDSB " -- $EXEC "$@"

the above means already to be a developer better than me, I'm not a developer neither, and this is fun

slrslr commented 1 month ago

That mount command is a ChatGPT work ( https://pizzagpt.it/en OR https://chatgptfree.ai/ ). I have already asked it for help with that "Read-only file system" described in my previous comment and tried the suggestions, but that not helped and the search engine also no luck. If you have no idea and can not fix it, please let me know, i will delete the fork.

ivan-hc commented 1 month ago

I need more details on detection of alternative filesystems.

Right now I can only test on ext4. Otherwise, I should build another VM with zfs filesystem... or maybe I should change model to build AppImages.

ivan-hc commented 4 weeks ago

following your suggestions, I added /dev in the AppRun

please, test the new release and let me know

slrslr commented 4 weeks ago

I added /dev in the AppRun

I have tested. The ZFS mountpoints are still not visible in the listing of the root folder "/" nor in the /dev/disk/by-id/ and similar folders (such folders are empty in VLC, but shows disk names on Linux CLI). /dev/shm content is accessible by VLC !

ivan-hc commented 4 weeks ago

well, I don't know much about zfs.

I've tested this on EXT4 and my contributor tested it on BTRFS without problems.

I need a structure of the filesystem ZTF, yesterday I've searched more info about the filesystem structure... and I had only reviews -_- "

is there a guide or scheme that explain in detail the directories structure? For example /usr /var/ /sbin... ?

slrslr commented 4 weeks ago

I am on a Session messenger. Regarding a ZFS structure, I have it on external drive/s only and these are mounted to a /mountpointname (in the root directory of the system drive). Here you can read on how ZFS is setup/mounted (search for "mount"). It requires kernel module:

libzfs4linux/oldstable,now 2.0.3-9+deb11u1 amd64 [installed,automatic]
zfs-dkms/oldstable,oldstable,now 2.0.3-9+deb11u1 all [installed]
zfs-zed/oldstable,now 2.0.3-9+deb11u1 amd64 [installed,automatic]
zfsutils-linux/oldstable,now 2.0.3-9+deb11u1 amd64 [installed]

I am layman in this, possibly https://chatgptfree.ai/ knows more than me, but i can test if you need anything. For better communication ideally over mentioned messenger. I will reply once I am near the computer tomorrow.