Bug 195904

Summary: floppy can't unmount or change to another disk
Product: [Unmaintained] kfile Reporter: Javier G. <jagarni1983>
Component: kfileplacesviewAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: afiestas, andresbajotierra, d.account, d_k, geierb, muzerakascooby, nate
Priority: NOR Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Javier G. 2009-06-10 17:04:53 UTC
Version:           1.2.80 (using 4.2.91 (KDE 4.2.91 (KDE 4.3 >= 20090609)), Project Neon)
Compiler:          cc
OS:                Linux (i686) release 2.6.28-11-generic

"PC Floppy Drive" icon in "Places" is fully broken:
- You can click to the icon to mount a floppy only 1 time but you can't unmount it. Because of this you can't use another floppy disk because the device is busy/mounted... (with a bit of luck because not always works "umount /dev/fd0") if you are an advanced user you can unmount it using a terminal like Konsole to unmount the device.
And the icon can't be used anymore because the device is busy/mounted (inclusive if is the same initial floppy disk).
- and where is the unmount button like other media devices has? This bug exist in KDE 4.3 beta 1 and the stable 4.2.x ...
Comment 1 Dario Andres 2009-06-10 20:44:13 UTC
Does this also happen in the Places bar in the file dialog of any KDE app (like KWrite) ?
Thanks
Comment 2 Javier G. 2009-06-10 21:52:34 UTC
Yes, I tried dolphin, amarok, kwrite, gwenview, ktorrent open dialogs and that icon in Places has the same problem.
Comment 3 Dario Andres 2009-06-10 22:05:35 UTC
Thanks
Comment 4 Murray Colpman 2009-09-22 22:46:08 UTC
*** Bug 208195 has been marked as a duplicate of this bug. ***
Comment 5 Murray Colpman 2009-09-22 22:46:54 UTC
So you know, this has still not yet been fixed.
Comment 6 Bernhard Geier 2009-10-04 21:14:51 UTC
I have the same problem on KDE 4.3.1 (debian testing, i386).
This bug could be a duplicate of 153923.
If that's the case it seems like HAL is broken.
Comment 7 d.account 2010-01-22 01:40:13 UTC
This is further information on a reproducible error in Dolphin version 1.3 found in KDE 4.3.1.  Source was the released version of openSUSE 11.2.

I have compared the actions of Dolphin and mount/umount commands for a floppy drive and a USB drive (which works successfully).  I have done this for two scenarios, one where there is no drive entry in fstab and one where there is an entry and a permanent mount point folder setup in /media.  This leads to 16 cases, where the actions are detailed below for the developers.

Summarizing the findings, normally Dolphin will create mounting point folders if needed (no fstab entry) or use the fstab entry folder; the mount command will use only the fstab entry folder. They both will update the file etc/mtab; and if no entry exists in fstab then Dolphin will also create or update media/.hal-mtab with entries for the mounted drives.  They both will change the icon in Dolphin places panel to mounted, add a unmount option to the icon context menu, and change the icon click action from mounting to displaying a listing of the files on the drive.  When using the unmounting action of Dolphin or the umount command the entries in etc/mtab and media/.hal-mtab are removed, and the mounting folders in media/ are deleted if there is no fstab entry (fstab requires permanent folders which are set to empty instead).  The icon in Dolphin places panel is changed to unmounted, the unmount option is deleted from the context menu, and the icon click action is reset to mounting.

The error in Dolphin when mounting a floppy drive is that while it successfully mounts the drive -- it never updates the icon area.  It does not change the icon to mounted, add an unmount item to the icon context menu, or change the icon click action from mounting to file display.  Therefore clicking again on the icon simply tries to remount the floppy drive and creates a cascade of errors.

There is a second error, within the umount command when used for floppy drives which do not have an etc/fstab entry.  It does not delete the floppy entry in the media/.hal-tab file nor delete the folder created in media/ for the mounting point. This error may be within umount or it may be a response to something not properly set by the Dolphin mounting action. It should be noted that this causes a series of dead entries in media/.hal-tab and a growing collection of mounting point folders within media/. For the USB drive all entries and folders were successfully cleaned up by the umount command.

Also seen were some issues within Dolphin on maintaining the correct file listing when mounting/unmounting/remounting removable drives which require pressing the reload button to update.  This is explained in another bug reports.

--------------------------------------------------------------------

Without an entry in etc/fstab and no permanent files in the mounting directory /media the behavior of the system is as follows.

Mounting USB drive using Dolphin:
   - create or update file /media/.hal-mtab with entry for usb drive
   - create new folder (disk-n where n=empty,1,2,etc.) in /media for mounting of usb drive and populate with drive contents
   - change usb drive icon in Dolphin places by overlaying emblem-mounted.png
   - context menu for usb drive updated with entry for safe removal (unmount)
   - update etc/mtab with entry for usb drive
   - modify usb icon behavior from "mount action" to "display file listing" when clicked

Unmounting USB drive using Dolphin:
   - update file /media/.hal-mtab removing entry for usb drive
   - delete folder (disk-n where n=empty,1,2,etc.) in /media which was used in mounting of usb drive
   - change usb drive icon in Dolphin places by removing emblem-mounted.png
   - context menu for usb drive updated by removing entry for safe removal (unmount)
   - update etc/mtab by removing entry for usb drive
   - modify usb icon behavior from "display file listing" to "mount action" when clicked

Mounting USB drive using mount command:
   - error no drive listing in fstab unable to mount  (expected error)

Unmounting USB drive using umount command (was previously mounted via Dolphin):
   - update file /media/.hal-mtab removing entry for usb drive
   - delete folder (disk-n where n=empty,1,2,etc.) in /media which was used in mounting of usb drive
   - change usb drive icon in Dolphin places by removing emblem-mounted.png
   - context menu for usb drive updated by removing entry for safe removal (unmount)
   - update etc/mtab by removing entry for usb drive
   - modify usb icon behavior from "display file listing" to "mount action" when clicked

Mounting floppy drive using Dolphin:
   - create or update file /media/.hal-mtab with entry for floppy drive
   - create new folder (disk-n where n=empty,1,2,etc.) in /media for mounting of floppy drive and populate with drive contents
   - update etc/mtab with entry for floppy drive

Unmounting floppy drive using Dolphin:
   - no context menu entry available for unmount when clicking floppy icon
   - clicking icon causes error message unable to mount - floppy already mounted

Mounting floppy drive using mount command:
   - error no drive listing in fstab unable to mount  (expected error)

Unmounting floppy drive using umount command (was previously mounted via Dolphin):
   - does not delete folder (disk-n where n=empty,1,2,etc.) in /media which was used in mounting of floppy drive; however folder is now empty
   - update etc/mtab by removing entry for floppy drive

---------------------------------------------------------------------

The following two entries were made in etc/fstab for the floppy and USB drive.  The indicated folders were made in the /media folder for drive mounting.
/dev/sdb1            /media/disk          auto       noauto,users,exec,utf8,rw,flush	0 0
/dev/fd0             /media/floppy        auto       noauto,users,sync,rw  		0 0
The actions of the system were as follows.

Mounting USB drive using Dolphin:
   - use folder /media/disk for mounting of usb drive and populate with drive contents
   - change usb drive icon in Dolphin places by overlaying emblem-mounted.png
   - context menu for usb drive updated with entry for safe removal (unmount)
   - update etc/mtab with entry for usb drive
   - modify usb icon behavior from "mount action" to "display file listing" when clicked

Unmounting USB drive using Dolphin (mounted via Dolphin or mount command):
   - clear the folder /media/disk of drive contents and keep the folder
   - change usb drive icon in Dolphin places by removing emblem-mounted.png
   - context menu for usb drive updated by removing entry for safe removal (unmount)
   - update etc/mtab by removing entry for usb drive
   - modify usb icon behavior from "display file listing" to "mount action" when clicked

Mounting USB drive using mount command:
   - use folder /media/disk for mounting of usb drive and populate with drive contents
   - change usb drive icon in Dolphin places by overlaying emblem-mounted.png
   - context menu for usb drive updated with entry for safe removal (unmount)
   - update etc/mtab with entry for usb drive
   - modify usb icon behavior from "mount action" to "display file listing" when clicked

Unmounting USB drive using umount command (mounted via Dolphin or mount command):
   - clear the folder /media/disk of drive contents and keep the folder
   - change usb drive icon in Dolphin places by removing emblem-mounted.png
   - context menu for usb drive updated by removing entry for safe removal (unmount)
   - update etc/mtab by removing entry for usb drive
   - modify usb icon behavior from "display file listing" to "mount action" when clicked

Mounting floppy drive using Dolphin:
   - use folder /media/floppy for mounting of usb drive and populate with drive contents
   - update etc/mtab with entry for floppy drive

Unmounting floppy drive using Dolphin (mounted via Dolphin or mount command):
   - no context menu entry available for unmount when clicking floppy icon
   - clicking icon causes error message unable to mount - floppy already mounted

Mounting floppy drive using mount command:
   - use folder /media/floppy for mounting of usb drive and populate with drive contents
   - update etc/mtab with entry for floppy drive

Unmounting floppy drive using umount command (mounted via Dolphin or mount command):
   - clear the folder /media/floppy of drive contents and keep the folder
   - update etc/mtab by removing entry for floppy drive
Comment 8 Dave Kaye 2010-01-23 20:27:39 UTC
I do have a workaround for this problem which is easier than the mount/umount command option.  If you create a floppy device on the desktop, it will allow you to mount, unmount and display floppy contents with a mouse click.

For the following actions, you must be root.  You will need to create an entry in the file /etc/fstab for the floppy drive.  You need to set the user or users option on the device.  This allows others to mount/unmount the floppy.  If you do not know fstab, check the web and you will find multiple explanations of this file.  I use the following line:

/dev/fd0    /media/floppy    auto    noauto,users,sync,rw    0 0

The /dev/fd0 is the device node, and is created automatically by the system upon boot by the program udev.  It has the permissions of  owner=root, group=floppy with read/write for owner and group.  These are sufficient, but if you want to change those permissions, see the information on udev.  (Warning-udev is buggy and there is a bug report on /dev/fdx creation at openSUSE.)  The mount point is /media/floppy and you must go to the media directory and make a permanent folder there called floppy with the same permissions.

Using YAST users/groups, add yourself to the group called floppy.

Here you must become a normal user again.  Right click on the desktop (or within the desktop folder if that is your display option) and from the menu select Create New> Link To Device> Floppy Device.  Fill in the window with the permissions (you as owner), both icons (floppy icons are in “actions” ) and whatever name you wish for the link.  Closing the window you should see an icon on your desktop with the same name.  You may have to redo the permissions a couple of times by right clicking the icon and selecting the permissions entry – they don't seem to stick on the initial creation.  Now click onto the icon and it will attempt to mount the drive – then error out stating you are not the root user.  If this happens, there is a trick to get around it.  Go into your home folder called desktop and find the entry with the name you gave the link.  Open it up with a text editor and remove the following line:

MountPoint=/media/floppy

This forces the mount program to access ftab to find the mount point and it reads the user/users permission option as well.  Now clicking on the icon should mount the floppy and open a Dolphin window with the floppy contents displayed.  If the floppy is mounted, clicking on the link will open a Dolphin window with the drive contents, not the floppy mount error message!  If you right click on the icon, within the context menu displayed you will find mount/unmount options depending on the state of your floppy drive.

That is all you have to do.  If multiple people access the floppy drive, you will simply have to create a desktop link for each of them while they are logged in, and use YAST to add them to the floppy group.

For myself, I added a couple of features.  I went into Dolphin and within the places panel I added a link to the folder /media/floppy.  Now after I mount the floppy I can use that link to get to the floppy contents from any program that uses the KDE base file chooser system.  I also hid the original floppy icon in the places panel so I would not accidentally use it.

This exercise shows several more minor bugs ; ).  When the file chooser window or Dolphin is displaying the floppy contents, that annoying original floppy device link re-appears in the places panel then disappears when another folder is displayed.  You must be careful not to use it.  Second, the link on the desktop should have a formatting menu option, one is called for in the device link actions area.  Need to look into that one, but for now adding the program kfloppy will allow you to format from your normal menu.  Finally, the desktop icon will not change between the mounted and unmounted images.  The weird thing is that if you look into the desktop folder using Dolphin, the icon displayed next to the link will change with mounting and unmounting - it just is never transferred to the main screen.  If you modify the link, then whatever state the drive is in will update the screen image.

Hope this helps.  It is kind of backward - I had to do it for the old 3.5 Konqueror program, but it worked.
Comment 9 Nate Graham 2018-06-28 22:22:48 UTC
Is this still an issue with KDE Frameworks 5.47 and Dolphin 18.04.x?
Comment 10 Andrew Crouthamel 2018-09-28 03:32:10 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 11 Andrew Crouthamel 2018-10-29 02:05:24 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!