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

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

Closed
slrslr opened this issue Aug 12, 2024 · 28 comments
Closed

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

slrslr opened this issue Aug 12, 2024 · 28 comments

Comments

@slrslr
Copy link

slrslr commented Aug 12, 2024

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
Copy link
Owner

ivan-hc commented Aug 12, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

@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...

@slrslr slrslr changed the title VLC has no access outside of the Downloads directory VLC has no access to a mountpoints like ZFS filesystem mountpoint Aug 14, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

and then run the AppRun script, from terminal

@ivan-hc
Copy link
Owner

ivan-hc commented Aug 14, 2024

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

@slrslr
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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

@slrslr
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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

@ivan-hc
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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 "$@"
  1. go in the Actions tab of your fork and run the workflow "Release VLC Appimage"

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

  3. if all goes well, consider submitting a pull request

@ivan-hc
Copy link
Owner

ivan-hc commented Aug 14, 2024

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

@slrslr
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Author

slrslr commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 14, 2024

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
Copy link
Owner

ivan-hc commented Aug 16, 2024

following your suggestions, I added /dev in the AppRun

please, test the new release and let me know

@slrslr
Copy link
Author

slrslr commented Aug 16, 2024

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
Copy link
Owner

ivan-hc commented Aug 16, 2024

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
Copy link
Author

slrslr commented Aug 16, 2024

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.

@ivan-hc ivan-hc pinned this issue Oct 10, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Oct 10, 2024

I close this issue for inactivity

As suggested here, it is better to fork this repo and add the custom mountpoints as you like, and get a new release from there.

In case you would install and manage these forks using AM or AppMan, use the option -e as suggested here

https://github.com/ivan-hc/AM#install-appimages-not-listed-in-this-database-but-available-in-other-github-repos

@slrslr thank you for cooperation. Feel free to reopen thi issue in case of you discover other code that we can implement, or let me know if the new release solves this issue completelly... or reopen another issue. See you next.

@ivan-hc ivan-hc closed this as completed Oct 10, 2024
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

2 participants