On Wed, 1 May 2024 11:15:42 +0200 'justanotherquber' via qubes-users wrote:
> Hi, I've been trying to get a dvm to open media files in mplayer in a
> disposable qube. Starting the disposable media qube from dom0 with
> qvm-run --dispvm media-dvm --service -- qubes.StartApp+st works.
> Copying files(same as the ones used to test
> qvm-open-in-vm/qvm-open-in-dvm) to the vm with qvm-copy works.
> Opening the copied files with xdg-open or qubes-open works in the
> dvm. Opening media files in mplayer in the disposable qube with
> qvm-open-in-dvm used to work.
Same here.
> It stopped working after I switched the media qube's template from
> debian-11-minimal to debian-12-minimal.
I am not sure if that per se is the reason. It used to work for me in
debian-12-minimal too.
Here is what I get when I "Open in VM" a text file (VM is based on
debian-12-minimal with thunar, xpdf and mpv installed).
[ 277.623816] systemctl[1176]: Failed to connect to bus: No medium found
[ 277.649127] qubes.OpenInVM+-storage[1187]: xdg-mime: mimetype argument
missing
[ 277.649430] qubes.OpenInVM+-storage[1187]: Try 'xdg-mime --help' for more
information.
[ 277.678605] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
x-www-browser: not found
[ 277.679554] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: firefox:
not found
[ 277.680597] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
iceweasel: not found
[ 277.681603] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
seamonkey: not found
[ 277.682573] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: mozilla:
not found
[ 277.683527] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: epiphany:
not found
[ 277.684437] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
konqueror: not found
[ 277.685364] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: chromium:
not found
[ 277.686320] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
chromium-browser: not found
[ 277.687446] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
google-chrome: not found
[ 277.688471] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882:
www-browser: not found
[ 277.689353] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: links2:
not found
[ 277.690593] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: elinks:
not found
[ 277.691631] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: links:
not found
[ 277.692557] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: lynx: not
found
[ 277.693781] qubes.OpenInVM+-storage[1187]: /usr/bin/xdg-open: 882: w3m: not
found
[ 277.693832] qubes.OpenInVM+-storage[1187]: xdg-open: no method available for
opening '/tmp/storage-LVDbTK/TEST.pdf'
Trying to copy the file first and then 'xdg-open TEST.pdf' in the
target VM, I get the same series of errors:
$ xdg-open TEST.pdf
xdg-mime: mimetype argument missing
Try 'xdg-mime --help' for more information.
/usr/bin/xdg-open: 882: x-www-browser: not found
/usr/bin/xdg-open: 882: firefox: not found
/usr/bin/xdg-open: 882: iceweasel: not found
/usr/bin/xdg-open: 882: seamonkey: not found
/usr/bin/xdg-open: 882: mozilla: not found
/usr/bin/xdg-open: 882: epiphany: not found
/usr/bin/xdg-open: 882: konqueror: not found
/usr/bin/xdg-open: 882: chromium: not found
/usr/bin/xdg-open: 882: chromium-browser: not found
/usr/bin/xdg-open: 882: google-chrome: not found
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'TEST.pdf'
Then I tried this:
https://unix.stackexchange.com/a/59088
but it changed nothing. Tested with an mp4 file - same result.
I can open the files through thunar, where I can set default app for
the type too. However, thunar does not use xdg-open but exo-open.
Next, I looked at the code of xdg-open (it is a shell script) and I saw
it used some form of desktop environment (DE) detection and acted based
on that.
So, to see what exactly happens:
$ bash -x xdg-open TEST.pdf
...
+ DEBUG 2 'Selected DE gnome3'
...
+ open_gnome3 TEST.pdf
+ gio help open
+ gvfs-open --help
+ open_generic TEST.pdf
...
And there it is: xdg-open wrongly detects gnome3 which is not
installed. Then I checked:
$ printenv | grep XDG_CURRENT_DESKTOP
XDG_CURRENT_DESKTOP=X-QUBES ## NOT XFCE, which is the correct value
After:
$ export XDG_CURRENT_DESKTOP=XFCE
xdg-open works as expected in the current session.
To have "Open in VM" work as well, obviously the above must be set
persistently.
Speculation 1 (needs checking and confirmation):
Since I see in a fedora-xfce-template-based qubes the
XDG_CURRENT_DESKTOP=XFCE, I suppose it is somehow set when XFCE itself
is installed (and not just thunar), so perhaps the fact of the Debian
template being "-minimal" (and not "-xfce") is related to this