Unsafe device removal warning pops-up after resuming from suspend

Bug #92091 reported by Huygens on 2007-03-13
Affects Status Importance Assigned to Milestone
hal (Ubuntu)

Bug Description

It perhaps has some similarities with bug #73679 (https://bugs.launchpad.net/ubuntu/+source/gnome-volume-manager/+bug/73679) but is still quite different (at least from my point of view) that I decide to report it in a separate bug.

What happens:
I have a USB hard disk (NTFS and read only) that is most of the time plugged on my laptop.
My laptop is configured to go to sleep (suspend mode) after an hour. When I resume the session (and since the update of today or yesterday) I get a warning message that the external hard disk has not been properly removed. (see attached screenshot)

How to reproduce:
Plug a USB external storage, put the computer in suspend mode, resume from the suspend mode, log back to Gnome session and the bug is visible.

Low: I am using the default ntfs driver in read only mode, so there is no data loss. Also after a while (10-20 sec once logged back in the session) the drive is detected again and mounted.

Huygens (huygens-25) wrote :

I forgot to mention that I'm using Ubuntu Feisty Fawn. And that this week-end this bug was not present (I mean there was no warning after resuming).

Brian Murray (brian-murray) wrote :

Thanks for taking the time to report this bug and helping to make Ubuntu better. I am a little bit unclear on whether or not you mean that this didn't used to happen or this is not happening any more. Please let us know. Thanks in advance.

Huygens (huygens-25) wrote :

It did not use to happen before, but now it does.

As I have seen some new updates, I can try to perform the test again. But I will do so later on this day. I will keep you post.
I will also try to use the older kernel (2.6.20-9) instead of the latest one.

Huygens (huygens-25) wrote :

OK here are the results of my new tests:

With all updates as of 2007/03/15 09h00 UTC, the bug is still present. I mean that after suspend and resume, I still have a warning message telling me that I had performed an unsafe removal of my external hard disk.

I have tried to reproduce it with the previous kernel (2.6.20-9) and I cannot reproduce the bug, so the problem is maybe not on HAL, but on the kernel itself. To clarify things, for this particular test, I have reboot the machine, at grub, I have selected previous kernel, starting every thing else as usual. I have then perform the test to suspend and resume the computer, and after the resume, I did not have the warning about unsafe removal.

N.B.: I did not try to perform a similar test yet with a USB memory stick...

Changed in hal:
assignee: brian-murray → nobody
status: Needs Info → Confirmed
Huygens (huygens-25) wrote :

The behaviour is still present with the newest kernel: 2.6.20-12

Huygens (huygens-25) wrote :

Just wanted to let you know that the bug is still present with Kernel 2.6.20-15

As I mentioned earlier, if I'm booting with kernel 2.6.20-9 I do not have the problem.

Anonimoes (s-kasper) wrote :

I'm experiencing quite the same bug on my desktop computer. I configured my pc to go to sleep after an idle time of 30min. If I start my computer again and the session is resumed I get the 'unsafe device removal' warning as well, of course only if my usb flash disk is plugged in. The same thing happens when I put my machine in hybernate manually.

I don't know if any data loss has occurred but it seems to me this has not happend, still this bug is a bit worrying of course...

NB: I use feisty fawn (7.04) and have installed all available updates.

Cycom (cycomos) wrote :

I am also in Feisty Fawn (7.04). I just got suspend working correctly in general, but this error message pops up for me, as well. In this case, I am not using a USB device, but a SD card plugged into my Ricoh card reader. I tried the fix suggested at http://ubuntuforums.org/showthread.php?p=2474560#post2474560, but this did not seem to correct the issue.

Anonimoes (s-kasper) wrote :

On top of the "unsafe device removal" warning I get another one now, I don't know if this is the symptom of the same issue but I thought I'd post it here with a screenshot. I'd be happy to report this as a seperate bug if it's really something different then the bug debated here.

See the screenshot for the messages.

Sam V. (sambo-the-ninja) wrote :

I'm getting the same problem though with a vfat USB2 Seagate drive in Feisty. It's also mounting in a new folder after suspend.

Changed in hal:
importance: Undecided → Medium
Jeanphe (jeanphe-gmail) wrote :

getting same error message on Feisty using 2 gig Kingston SD, though the same error happens every time I read from the SD card.
It will transfer a couple of files then act like I just yanked the SD out of the slot, returning:

[Error "I/O error" while copying]

Mark Grandi (markgrandi) wrote :

This happens to me as well. A 500 gb usb hard drive plugged in, every time i go into suspend or hibernate and come back and login (to unlock screen) i get the libnotify popups saying that the drives were not properly unmounted.

 A temporary fix for this is to of course unmount the usb drives before you go into suspend/hibernate, they remount after you come back. (at least for me)

Im running feisty, with the latest kernel in the repos.

AlesUbu123 (ales-maver) wrote :

Same happens here. After hibernation there is a report similar to one you can see on the screenshot by Huygens. Running Ubuntu 7.04 with all the updates and kernel 2.6.20-16. I have experienced no data loss after this so far.

Mark Grandi (markgrandi) wrote :

Just to add this still happens in Gutsy Tribe 5 (or 6 or whatever its on) fully updated, using kernel 2.6.22-12-generic

Jussi Nykanen (jussin) wrote :

Still happens in current Gutsy (I have all the latest updates installed). I was wondering if someone who knows better how the kernel / file system works, could try (or provide us others with a test case) if the device removal really is unsafe or if bug is in the "message showing rule". Idea is to write something on the disk that would not be written immediately completely (I've understood that this is how Linux often works) on it and then (right after write was done according to the user dialog) do a suspend + resume and see if everything actually got written on the disk as supposed (bug in message rule) or not (bug in suspending).

Jussi Nykanen (jussin) wrote :

My bet would be that the bug is in suspending (the device removal is not safe) cause everything works fine if - as already pointed out by Polygon - one unmounts the drive manually before suspending.

André Pirard (a.pirard) wrote :

Experiencing the same message on 7.10 (gutsy), FAT USB disk & CD-ROM.
The "Unsafe..." message didn't appear in xfce until I installed ubuntu-desktop on top of an Xubuntu installation (now appears in both gnome and xfce).
BTW, the message doesn't say which device is unsafe, which may be important if the user did nothing like in this case or in fortuitous device disconnection.
Laptop too : Toshiba Tecra 8000 : no ACPI (kernel cannot detect date, just before 2000 anyway, loop problem to be solved with acpi=force)
So, suspend via the software button (and probably automatic one too) does not work, but the power switch does suspend (and is amazingly fast, both off and on).
I imagine is I can only enjoy a hardware initiated suspend.

Impact : I'm reporting for everyone's sake, so the first thing I would say is that the common user shouldn't be taken into the habit of ignoring error messages.
I doubt I would loose data, since I guess it's only the habit of another system to write directory information a full load of seconds after the data was written (a joy to go on holidays with a camera memory card whose space has been freed but whose directory contains leftover files pointing to new shots at random).
Yet, this USB disk structure was messed up some day and I dunno why.

Also, launching a new File Explorer on each resume could be done without.

Hearty André (Hearty like every Heron should be !!!)

adpatter (adpatter) wrote :

Adding "umount /media/[NAME OF DRIVE]" to /etc/acpi/prepare.sh stopped the "unsafe device removal" from being displayed. Should the solution for this issue reside in the scripts?

Patricio (patricio-stwing) wrote :

Mine looks like this:

for SCRIPT in /etc/acpi/suspend.d/*.sh; do
    if [ -x $SCRIPT ]; then

Should I add "umount /media/[NAME OF DRIVE]" after all that?

Is this the reason for bug 230671?

Thanks ( I am new)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers