Bug 158264 - Terminal panel (konsole part) blocks the umount of removable media
Summary: Terminal panel (konsole part) blocks the umount of removable media
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: terminal (show other bugs)
Version: 16.12.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: reproducible
: 162937 172355 178380 188159 191262 200806 208974 230404 241512 277863 328448 348201 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-23 11:57 UTC by Richard Donkin
Modified: 2017-10-12 21:23 UTC (History)
30 users (show)

See Also:
Latest Commit:
Version Fixed In: 17.11.80


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Donkin 2008-02-23 11:57:04 UTC
Version:            (using KDE 4.0.1)
Installed from:    Compiled From Sources
Compiler:          GCC 4.1.1 
OS:                Linux

If I insert my USB flash disk, "New device notifier" gives me the option of mounting and opening it. I double-click on this
icon that has popped up, and my flash disk is mounted and shown in Dolphin, along with a terminal at the bottom of the window. The terminal is there because of my preferences (good) and has its current working directory at the root of the flash disk (also good).

Now, if I try and remove the flash disk, a message pops up saying "umount: /mnt/usb0: device is busy". This is because of the terminal open at that directory. The disk fails to unmount.

A workaround for this is to type "cd /" in the terminal and then immediately to remove the device. This works because the terminal is no longer using the directory where the disk is mounted.

My suggestion for Dolphin to allow the user to unmount more easily is the following set of steps when the user chooses to "safely remove":

1. Check if an associated terminal process is running. (This is possible even if the terminal toolbar is not shown.)

2. Check if the terminal is "idle", i.e. only the shell process is running.

3. If both of the above are true, "cd" in the terminal to the directory immediately above where the removable device is mounted. Then unmount. This is justified because the terminal was not really "busy" with anything meaningful.

4. If points 1 and 2 are not both true, pop up the message and fail to unmount as the current implementation does.
Comment 1 David Dempster 2008-07-22 14:06:57 UTC
I can confirm that this behaviour is annoying.  A newbie would be likely to be totally unaware of what was blocking the unmounting.  He would end up yanking the media out without unmounting.  A workaround such as that described above ought to be implemented.

Unfortunately, it is probably something to be done at the distro level, rather than the KDE level.
Comment 2 Dario Andres 2008-12-21 18:08:58 UTC
*** Bug 178380 has been marked as a duplicate of this bug. ***
Comment 3 SlashDevDsp 2008-12-23 00:58:19 UTC
this bug is still present in trunk :(
Comment 4 Frank Reininghaus 2009-03-25 23:13:23 UTC
*** Bug 162937 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-05-01 15:59:48 UTC
*** Bug 191262 has been marked as a duplicate of this bug. ***
Comment 6 Dario Andres 2009-07-19 22:38:29 UTC
*** Bug 200806 has been marked as a duplicate of this bug. ***
Comment 7 Dario Andres 2009-09-30 20:30:27 UTC
*** Bug 208974 has been marked as a duplicate of this bug. ***
Comment 8 Frank Reininghaus 2009-10-15 14:48:08 UTC
*** Bug 188159 has been marked as a duplicate of this bug. ***
Comment 9 Frank Reininghaus 2010-03-13 17:04:02 UTC
*** Bug 230404 has been marked as a duplicate of this bug. ***
Comment 10 George Goldberg 2010-08-01 17:15:09 UTC
*** Bug 241512 has been marked as a duplicate of this bug. ***
Comment 11 Peter Penz 2010-09-02 20:30:45 UTC
*** Bug 172355 has been marked as a duplicate of this bug. ***
Comment 12 Mark 2010-09-19 02:41:40 UTC
Is this still an issue with the latest stable version and/or the trunk? (trunk "might" differ since it's not using "udisks").
Comment 13 Parameshwara Bhat 2010-10-02 17:31:04 UTC
It is an issue as of Dolphin 1.4 and KDE 4.4.4 in Opensuse 11.3.Once you open a terminal in Dolphin at the mounted device and then close it, you cannot just release it or umount it,(safe remove) it.
Comment 14 Mike Vaughn 2011-05-18 06:59:28 UTC
Just chiming in to say that this highly annoying (and probably very perplexing to new *nix users) bug is still around in KDE SC 4.6.3. I already wrote this up before finding this post; not sure if it's been explained in exactly this way already so I'll just leave this here:
If a user closes Dolphin's built-in terminal while currently under an external device's directory tree, the terminal is still open in that directory, regardless of where the user navigates to within Dolphin. This triggers a not-so-obviously-solved error message when trying to unmount the device: "Could not unmount the following device: <device name> One or more files on this device are open within an application." This problem persists until the user re-opens Dolphin's built-in terminal while outside of the device's directory tree.
Comment 15 Sebastian Dörner 2011-05-25 23:55:38 UTC
Git commit 8d789f2626243ddc6c763c84e582e8e20afe7689 by Sebastian Dörner.
Committed on 25/05/2011 at 23:14.
Pushed by doerner into branch 'master'.

Don't let hidden terminals prevent unmounting

Previous state: When the terminal is hidden, the cwd is not updated
anymore. If it was on a removable device when hiding, the hidden
terminal might prevent unmounting this device.
This patch fixes that bug by changing the cwd to "/" when hiding the panel.

REVIEW: 101387
BUG: 158264
FIXED-IN: 4.7.0

M  +2    -0    dolphin/src/dolphinmainwindow.cpp     
M  +8    -0    dolphin/src/panels/terminal/terminalpanel.cpp     
M  +1    -0    dolphin/src/panels/terminal/terminalpanel.h     

http://commits.kde.org/kde-baseapps/8d789f2626243ddc6c763c84e582e8e20afe7689
Comment 16 Richard Donkin 2011-05-26 09:07:01 UTC
(In reply to comment #15)
This bug is not fixed!
Only the special case of comment #14 is fixed. The following more common case is not fixed:

When the user is viewing the flash disk, he may then choose to unmount it. Right-clicking the icon in the left panel and selecting 'safely remove' will give an error if he has the terminal panel open. This is not good behaviour, because actually the user is finished with the flash disk and doesn't want to look at it any more. Dolphin should act according to the user's instruction and unmount the flash disk, excercising control of its open terminal panel if necessary.

As I said in the initial post, Dolphin should "cd" up to the directory immediately above the flash disk's mount directory (or "/" if you like), and then attempt to unmount the disk.
Comment 17 Diego 2011-05-26 10:50:17 UTC
(In reply to comment #16)
> As I said in the initial post, Dolphin should "cd" up to the directory
> immediately above the flash disk's mount directory (or "/" if you like), and
> then attempt to unmount the disk.

What about cd-ing with no argument, that will cd to the home directory of the current terminal user? Or what about exit-ing before umount-ing / eject-ing?
Comment 18 Richard Donkin 2011-05-26 10:55:41 UTC
(In reply to comment #17)
> What about cd-ing with no argument, that will cd to the home directory of the
> current terminal user?

This sounds reasonable.

> Or what about exit-ing before umount-ing / eject-ing?

This is not correct behaviour, because the user may still want the terminal panel to stay open and follow him around as he navigates further.

Also, it must be remembered that the terminal may have spawned another process (such as "less"). So a "cd" command cannot be issued without first determining whether the  terminal is idle.
Comment 19 Sebastian Dörner 2011-05-26 23:30:17 UTC
Fair enough.
The remaining part of the bug depends on KFilePlacesView signalling that a device is to be unmounted. However, I don't know enough about Solid, maybe KFilePlacesView doesn't have access to this information either.
Comment 20 Frank Reininghaus 2011-07-17 17:48:01 UTC
*** Bug 277863 has been marked as a duplicate of this bug. ***
Comment 21 Lilian A. Moraru 2012-01-31 15:46:31 UTC
Confirming the bug in Dolphin 2.0 on KDE 4.8.0
Comment 22 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:19:47 UTC
Resetting assignee to default as per bug #305719
Comment 23 Bryan Cuneo 2012-10-26 00:09:10 UTC
[Part of the Dolphin Bug Weeks 2012]
I can confirm this with Dolphin 2.1/KDE SC 4.9.2.
Comment 24 sparhawk 2013-09-29 03:33:19 UTC
Still here in Dophin 2.2/KDE 4.10.5.
(Kubuntu 13.04)
Comment 25 Emmanuel Pescosta 2013-09-29 11:36:00 UTC
@sparhawk
Thanks for your feedback! :)
Comment 26 Frank Reininghaus 2013-12-05 13:09:16 UTC
*** Bug 328448 has been marked as a duplicate of this bug. ***
Comment 27 Arjun AK 2014-12-20 20:40:44 UTC
Patch to fix this: https://git.reviewboard.kde.org/r/121613/
Comment 28 Frank Reininghaus 2015-05-26 16:58:15 UTC
*** Bug 348201 has been marked as a duplicate of this bug. ***
Comment 29 sparhawk 2015-05-26 22:04:34 UTC
Looks like this is fixed in Plasma 5.3.
Comment 30 Hauke Laging 2016-11-25 15:46:05 UTC
This problem still exists in Dolphin 16.08.2 / KDE 5.27.0
Comment 31 Nate Graham 2017-06-21 02:16:45 UTC
Yep, still in Dolphin 16.12.3.
Comment 32 martonmiklos 2017-09-16 14:28:49 UTC
Proposed patch based on Arjun AK's work submitted to the Phabricator:
https://phabricator.kde.org/D7847
Comment 33 Elvis Angelaccio 2017-10-12 21:23:43 UTC
Git commit bd47eb2e6d80315115bb3f58987162fcb4911b10 by Elvis Angelaccio, on behalf of Miklos Marton.
Committed on 12/10/2017 at 21:21.
Pushed by elvisangelaccio into branch 'master'.

Don't block unmounting when terminal panel's cwd is the mountpoint

When unmounting a removable media Dolphin checks if there are
some files open on the device before performing the unmount.
If the terminal window in dolphin is open and the to be unmounted path is open,
 the unmount process will be blocked.

This patch sets the terminal window current path to the home directory upon unmount request
 if the terminal directory is set to the mount path.

The unmount request could came from two sources:

    The user could hit right click on the media in the dolphin's places panel and hit unmount.
    The user could request an unmount from the indicator applet

This patch was originally written by Arjun AK for the kdelibs4 version
of Dolphin: https://git.reviewboard.kde.org/r/121613/
FIXED-IN: 17.11.80

Differential Revision: https://phabricator.kde.org/D7847

M  +49   -19   src/dolphinmainwindow.cpp
M  +23   -0    src/dolphinmainwindow.h
M  +7    -0    src/panels/places/placesitem.cpp
M  +2    -0    src/panels/places/placesitem.h
M  +34   -10   src/panels/places/placesitemmodel.cpp
M  +8    -2    src/panels/places/placesitemmodel.h
M  +12   -0    src/panels/places/placesitemsignalhandler.cpp
M  +5    -0    src/panels/places/placesitemsignalhandler.h
M  +10   -1    src/panels/places/placespanel.cpp
M  +3    -0    src/panels/places/placespanel.h
M  +16   -2    src/panels/terminal/terminalpanel.cpp
M  +13   -1    src/panels/terminal/terminalpanel.h

https://commits.kde.org/dolphin/bd47eb2e6d80315115bb3f58987162fcb4911b10