Having done some tests with various drives, I have come to believe that
it is actually safe to ignore the error messages produced by sg3-utils.
I think so for the following reasons:

1. I could not find evidence that Hardy Heron (the release I used before Lucid) 
made use of sg3-utils to flush caches/stop devices before unmounting USB 
devices. And still, the filesystems were closed cleanly.
2. Even if Hardy made use of the problematic sg3-utils functions 
("sg_ll_sync_cache_10" and "sg_ll_start_stop_unit"), they still would have 
failed, because the relevant code is identical.
3. Even though the sg3 functions fail, udisks-daemon still invokes the "umount" 
command, so the filesystem is not left in an inconsistent state, when the 
device is removed.

For these reasons, I slightly modified udisks-helper-drive-detach to
simply not report back error messages to the user. It still invokes the
error-producing sg3 functions, but does not pass the errors on to the
user. This way, the functions are still called for devices where they
can be executed successfully. And for the devices where they fail, it is
not any different - only that the user does not know anything about
this. Anyhow, I have come to believe that the errors are caused by a
crappy implementation of the SCSI protocol by my USB disk, which is in
arbitrary 3.5" disk in a cheap disk enclosure, which I bought
separately. The controller of the enclosure seems to produce errors no
matter what command you throw at it. :-/

I am attaching the modified version of "job-drive-detach.c", which only
differs from the original version ("job-drive-detach.c.orig") by one
statement (setting return value to success; line 213). For your
convenience, I'm also attaching a precompiled version of "udisks-helper-
drive-detach", which is responsible for passing the error to the user.
If you are fed up with the error messages like me, place the file in
/usr/lib/udisks and you won't be bothered anymore. Make sure to create a
backup of the original file. Also you will have to place my modified
version there, whenever an update overwrites it (which doesn't happen
too often anyway).

Please note that this is not really a patch, as it does not fix the
underlying problem. But I don't really mind, since it wasn't any
different in Hardy. The only difference is that I didn't notice it back
then and now I am bothered with it every time I unplug a device. If you
think so, too, then you are welcome to use my modified version of
"udisks-helper-drive-detach".

-- 
secure remove of external USB-HDD produces error
https://bugs.launchpad.net/bugs/466575
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to