KDE: trying to create an iso-mounter Dolphin service

Since Dolphin browser still seems not being able to mount/unmount ISOs natively, I went looking for some alternatives for it.

And finally found this:

Since first sights it did seem old and probably discontinued, but taking a look at this

and making changes accordingly to both files of the Dolphin service, it still seems to work.

However I came with doubts regarding its coding, and seemingly the authors are no longer around… So was wondering if someone here could help a bit

Original contents of both files:
The .sh script:

#!/bin/bash

#################################################################
# For KDE-Services. 2012-2017.					#
# By Geovani Barzaga Rodriguez <igeo.cu@gmail.com>		#
# Improved by Victor Guardiola (vguardiola) Jan 5 2014		#
# 	-Fixed the problem of [dir|file]name with whitespaces.	#
#################################################################

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/$USER/bin
MOUNTEXIT=""

##############################
############ Main ############
##############################

cd "${1%/*}"

if [ "$1" == "${1%.*}.iso" ]; then
   fuseiso -p "$1" "${1%.iso}"
   MOUNTEXIT=$?
else
   rename .ISO .iso *
   kdialog --icon=ks-error --title="Mount ISO-9660 Image" \
                   --passivepopup="[Error] Can't mount ${1##*/}: Renamed extension of ISO image, because contain uppercase characters. Please try again."
   exit 1
fi

if [ "$MOUNTEXIT" = "0" ]; then
   kdialog --icon=ks-media-optical-mount --title="Mount ISO-9660 Image" --passivepopup="[Finished] ${1##*/} mounted."
else
   kdialog --icon=ks-error --title="Mount ISO-9660 Image" \
                   --passivepopup="[Error] Can't mount ${1##*/}: Already mount or check image integrity."
   exit 1
fi

exit 0

The .desktop service:

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/x-cd-image;model/x.stl-binary
Actions=mount;unmount;
X-KDE-Priority=TopLevel
X-KDE-StartupNotify=false
Icon=application-x-cd-image
X-KDE-Submenu=Mount/unmount image


[Desktop Action unmount]
Name=Unmount
Icon=edit-redo
Exec=which fuser fusermount; if [ "$?" != "0" ];then kdialog --icon=ks-error --title="Unmount ISO-9660 Image" --passivepopup="[Error] Please install fuser and fusermount command and try again."; exit 1; else fuser -k %f; fusermount -u "$(ls "%f"|sed 's/.iso$//')"; rm -fr "$(ls "%f"|sed 's/.iso$//')"; kdialog --icon=ks-media-optical-umount --title="Unmount ISO-9660 Image" --passivepopup="[Finished] $(basename %f) unmounted.";fi

[Desktop Action mount]
Name=Mount
Icon=circular-arrow-shape
Exec=which fuseiso; if [ "$?" != "0" ];then kdialog --icon=ks-error --title="Mount ISO-9660 Image" --passivepopup="[Error] Please install fuseiso command and try again."; exit 1; else ~/bin/iso_manager-mount-image.sh %F;fi

For the mounting action, “%F” is for Dolphin to forcibly take more than one selected item, and fuseiso can only work with one iso at a time. Why “%F” instead of just “%f” for single file?

For the unmounting action, if fuseiso was used with the -p option, when unmounting the iso’s mount point (with whichever valid tool for unmounting, not just fusermount -u) the mountpoint directory itself is automatically deleted once successfully unmounted.
Then what’s the point at all of “fuser -k mountpoint” and manually deleting the mountpoint? Hell, even I realized through some tests that “fuser -k” can even lead to buggy behaviors!

Hope someone can help.
Thanks.

@F_style:

I’m not quite sure about what it is you’re trying to achieve.

For example here – a bootable 32 GB USB stick with the openSUSE Leap 15.5 ISO image on it, written by the SUSE Studio Image Writer – mounted via KDE Plasma –

 > lsblk --fs 
NAME FSTYPE FSVER LABEL             UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sdd  iso966 Jolie openSUSE-Leap-15.5-DVD-x86_64491
│                                   2023-05-23-15-17-50-85                              
├─sdd1
│    vfat   FAT16 openSUSE-Leap-15.5-DVD-x86_64491
│                                   22D5-F49A                                           
└─sdd2
     iso966 Jolie openSUSE-Leap-15.5-DVD-x86_64491
                                    2023-05-23-15-17-43-38                     0   100% /run/media/xxx/openSUSE-Leap-15.5-DVD-x86_64491
 >

From Dolphin, the device size is 4.2 GiB and is an iso9660 File System with 5,194 files in 14 sub-directories.

You make me tell everything verbose in every single word…

I’m talking about ISO FILES

Well, that is the essence of describing your question/problem. I hope you will remember this next time you require help.

And while you are at it, you could explain what you mean with

where you seem to think that Dolphin should be able to do (whatever you mean with it) since ages already. What is that assumption build on?

It is just a file. And when it’s name has the extension of .osi, it seems that KDE associates it with K3B for burning it to a DVD.

I sometimes mount an iso file at the command line, with something like:

mount -o ro /path/to/isofilename.iso /mnt

which allows me to then browse what is on the iso.

As best I can tell, @F_style wants to do something similar but with a mouse click in Dolphin. I’m not sure why, given that the command line way is so simple, but I guess that’s his preference.

I’m not offending you sir, so please no offending from you neither.

I perfectly know how to do stuff from command line, but sometimes it’s unfortunately convenient having a built-in quick menu in browser for some stuff, such as mounting ISO files; on GNOME and XFCE their respective browsers do have it, while on KDE right-clicking gives at most “Open with…” options, which is not the same.

Furthermore, mount has the disadvantage of forcibly needing root; on the other hand I saw that Fuse tools felt slightly more user-friendly

With the Leap 15.5 system indicated below, when I mount the iso9660 File System via KDE Plasma, Dolphin shows me the ISO contents – the files …

Operating System: openSUSE Leap 15.5
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 5.14.21-150500.55.19-default (64-bit)
Graphics Platform: X11
Processors: 8 × AMD Ryzen 5 3400G with Radeon Vega Graphics
Memory: 29.3 GiB of RAM
Graphics Processor: AMD Radeon Vega 11 Graphics
Manufacturer: ASUS

How do you do it in your case?

@F_style:

Plugged the USB stick into a spare USB port – Plasma device pop-up – “mount and open” –


Download the openSUSE installer ISO, save it in a directory in your local file system, and work with that; not with a USB drive formatted as ISO

Using Dolphin, I can browse to that downloaded iso. When I click on the iso, what I see is similar to what @dcurtisfra posted above. However, when I check what is mounted, I note that the iso hasn’t actually been mounted. Apparently Dolphin is just looking inside anyway, without mounting.

This one?
right click—einhängen (mount)


lefts side doubleclick
Auswahl_202
and here:

All done as User.

It would seem that one precisely, but in my case I don’t have that context menu option at all! Nor ever had…

This 15.5 installation is actually upgrade from 15.4; and I also tried with different ISOs of different distributions and other stuff. No option at all in the menu!

Only spread options related to Ark or K3b

Then what on hell is going on here?

In the settings of dolphin:

Also dolphin-plugins and -lang are installed?

rpm -ql dolphin-plugins s| grep -i mount
/usr/lib64/qt5/plugins/kf5/kfileitemaction/mountisoaction.so
1 Like

Out of curiosity I checked my own system, and I didn’t see any options for mounting ISOs directly in Dolphin either - but I do now after installing dolphin-plugins.

I may see if there’s a way to add / request a change to the package description to include the ISO mounting feature, since I imagine that functionality might be hard to discover as-is?

Mounting through “dolphin > context menu > mount” indeed works:

 karl@erlangen:~> findmnt --types iso9660 
TARGET                       SOURCE       FSTYPE  OPTIONS
/media/Fedora-WS-Live-36-1-5 /dev/loop3p1 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=100,dmode=555,fmode=444,iocharset=utf8
karl@erlangen:~> 

No need to create yet another service.

Strange – I don’t have “dolphin-plugins” «Version control plugins for Dolphin» installed here but, I do have “dolphin-part” and “libdolphinvcs5” «KDE File Manager» installed.

My mistake – brain dead – once again.

  • If you mount a bootable device with an ISO image via the KDE Plasma Device Notifier then, a standard Dolphin will be able to access the contents of that ISO image.

  • To access an ISO image present as a file via Dolphin, you have to install the “ dolphin-plugins” package, to allow Dolphin to mount the ISO image directly.
    (I’m currently also installing that package, now … )

After reading all of this, I tried uninstalling the Dolphin custom service from OP and installing dolphin-plugins package.

Indeed, now there’s a “Mount/Unmount” native option in the right-click menu; I think this package should be made a mandatory dependency, better documentation, or something else, since until now this thing is nowhere intuitive.

And now I have a next problem: by mounting ISO with this option, I see that there’s now a new device “loop0p1”, but never mounted; nor anything else appears in the Dolphin “Places” left panel unlike @Sauerland 's examples.

The mountisoaction.so thing is installed, and this rig runs on KDE 5.27.4 and Dolphin 22.12.3.

What am I missing?