GlowInTheDark
Posts: 690
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 5:18 am

It is a particularly nice touch that in most of these cases it is smart enough not to show the eject icon ("menu"?), but still remembers to complain when the device is removed. The eject icon also disappears very smartly following a CLI umount.
Yes, I'd noticed that, too. The instant you do the "umount", the "eject" icon disappears from the panel. So, the funny thing is, at that point, you couldn't do the GUI eject thing (even if you wanted to).

Thanks for the tip; I'll try the editing the file (*) thing when I get a chance...

(*) /etc/xdg/lxpanel/LXDE-pi/panels/panel does indeed contain that stanza. BTW, is there a "local" (i.e., stored in ~pi/.config or something like that) version of this file?
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

fanoush
Posts: 544
Joined: Mon Feb 27, 2012 2:37 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 7:44 am

Oh so long thread and still no mention of real cause. I am not near the pi now but there are two things
1. unmount filesystem and 2. get rid of device node e.g. /dev/sda and /dev/sda1 partition for usb. When ejecting via gui it does both things, with umount command you are doing only one. It is possible to remove the device node 'properly' too and maybe that will help with avoiding the message (or maybe not). I think I solved it somehow but don't remember the command to 'eject' the device node now.

GlowInTheDark
Posts: 690
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 2:52 pm

fanoush wrote:
Thu Jul 02, 2020 7:44 am
Oh so long thread and still no mention of real cause.
I think it is pretty obvious what the real cause is. It is what we in the software biz call a "bug".

Clearly, the program that emits the "You fool! You forgot to unmount the device before pulling it" message needs to check to see if the thing is still mounted - and not emit the (bogus) error message if it is no longer mounted. Clearly, a simply programming oversight.
I am not near the pi now but there are two things
1. unmount filesystem and 2. get rid of device node e.g. /dev/sda and /dev/sda1 partition for usb. When ejecting via gui it does both things, with umount command you are doing only one.
No. The same mechanism that scans the USB ports and creates those device nodes when you insert something is the same mechanism that removes the device nodes when you remove something. That part all works and it works fine. No need for any changes there.
It is possible to remove the device node 'properly' too and maybe that will help with avoiding the message (or maybe not). I think I solved it somehow but don't remember the command to 'eject' the device node now.
Not necessary - see above.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

fanoush
Posts: 544
Joined: Mon Feb 27, 2012 2:37 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 5:52 pm

Oh, OK, if it is so clearly obvious and you already know everything than don't bother reading further.

However the message does not tell you you forgot to unmount it. And unmount may not be enough to let the device finish all operations and power off safely. There is interesting discussion here https://unix.stackexchange.com/question ... ct-command

Both "udisksctl power-off -b /dev/sda" and "echo offline >/sys/block/sda/device/state" seem to work on the pi after unmounting it and removes device nodes and allows the device to finish what is is doing before cutting power by physically removing it. Also there is "sudo eject /media/pi/<volumename>" which also unmounts it first and then ejects it. However I still see the dialog after that so there is also bug in the applet because this time I really did what was needed.

User avatar
jojopi
Posts: 3272
Joined: Tue Oct 11, 2011 8:38 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 6:57 pm

fanoush wrote:
Thu Jul 02, 2020 5:52 pm
Both "udisksctl power-off -b /dev/sda" and "echo offline >/sys/block/sda/device/state" seem to work on the pi after unmounting it and removes device nodes and allows the device to finish what is is doing before cutting power by physically removing it.
udisksctl power-off actually triggers the spurious pop up—even if the drive was not mounted.

Neither of your other suggestions avoids the warning later when you unplug. Again: I get the message even if I dismount the way it tells me to.
However I still see the dialog after that so there is also bug in the applet because this time I really did what was needed.
Yes, there is really a bug in the panel plugin. I am of half a mind that the bug is the fact that it exists.

For anyone not reading between the lines of my previous post, this panel feature is something that is specific to Raspberry Pi Desktop. It does not exist in upstream Debian, Raspbian, or LXDE.

If you must add helpful messages to an existing system, you have a special responsibility to ensure that they are helpful and not spurious. Especially given that your non-standard warnings will likely never be translated from British English like most other messages are.

fanoush
Posts: 544
Joined: Mon Feb 27, 2012 2:37 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 7:52 pm

jojopi wrote:
Thu Jul 02, 2020 6:57 pm
Neither of your other suggestions avoids the warning later when you unplug. Again: I get the message even if I dismount the way it tells me to.
Sure, I know :-) The point was that just unmounting filesystem is not enough. And if you click the panel eject icon it does not just unmount filesystem but also does one of the actions I described because after you click it the device is gone and you cannot easily remount it again without removing and reinserting. Maybe it simply calls the eject command since it does both the unmount and put it offline.

So I would expect panel to warn you after just using 'umount' command and pulling it out but the bug is that it warns you also when you eject/put the device offline properly.

GlowInTheDark
Posts: 690
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to disable the "You have removed it without ejecting it" message?

Thu Jul 02, 2020 9:42 pm

As far as I'm concerned, umount-ing *IS* enough. You are free to disagree with that. Just be aware that we have a saying around our house:
I read it on the Internet; it might be true.
In short, just because something has a URL attached to it, don't mean it's true.


Anyway, I did some testing with "eject", and found that:

1) If you eject without "sudo", it is the same as umount. That is, it umounts it (which removes the "eject" icon from the panel), then gives an error message about not being able to access /dev/sda. The command "ls -lsa /dev/sd*" shows both /dev/sda and /dev/sda1 still in existence. Pulling the USB device out (still) generates the (bogus) error message which is the subject of this thread.

2) If you eject with "sudo eject", it gets a little farther, but still fails. You don't get the error message and it removes /dev/sda1 - but leaves /dev/sda intact. Again, pulling the USB device (still) generates the (bogus) error message which is the subject of this thread.

And so it goes... (Linda Ellerbee)
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

GlowInTheDark
Posts: 690
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to disable the "You have removed it without ejecting it" message?

Fri Jul 10, 2020 3:11 pm

Yes, there is really a bug in the panel plugin. I am of half a mind that the bug is the fact that it exists.
Indeed. I just tested, and indeed, the REAL bug is the fact that even if you DO DO the RIGHT things, it STILL scolds you. That is, you insert a USB device. You then use the "ejecter" panel thingie to eject it, you get the message that it is now safe to remove it. You remove it, and then it scolds you for not ejecting it before removing it.

My overall sense here is that whoever developed this didn't think it through very well. They didn't really analyze to figure out if it was necessary or not; they just followed MS's lead. I.e., it would take a lot of real thinking and planning - thinking about all the possible things users could do - in order to determine if this is needed functionality or not. It is much easier to just say "Well, MS must have done all that thinking and planning; they concluded it was necessary, so so should I".

Also note: Given that most removable devices (i.e., the kind that can and should be "hot-swapped" - on the Pi, this excludes normal hard disks, since the Pi has no facility for an "internal" hard disk) are formatted with some kind of FAT filesystem - and the whole point of FAT is to be "what you see is what you get" in terms of caching - i.e., it pretty much is always safe to just pull it, well, maybe this whole effort (to prevent users from doing this thing) is all pretty much moot and much ado about nothing.

Nitpickers note: In the previous paragraph, I said "most". I'm well aware that many of you may have removable devices formatted with other-than-FAT type filesystems. That's, however, beside the point.

And just to be even more explicit, the point of the "new" exFAT filesystem is to retain the "what you see is what you get" semantics of FAT while supporting large media. FWIW, when exFAT first came out, I was really confused; I didn't see what the point was since NTFS seems to do everything that exFAT was doing. But then I realized that the point is that NTFS is not "hot-swappable"; the point of exFAT was to be hot-swappable.

And that's all I have to say on that...
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

GlowInTheDark
Posts: 690
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to disable the "You have removed it without ejecting it" message?

Tue Jul 28, 2020 4:02 pm

If you must add helpful messages to an existing system, you have a special responsibility to ensure that they are helpful and not spurious. Especially given that your non-standard warnings will likely never be translated from British English like most other messages are.
This.

Incidentally, I can now confirm that even with that stanza in that config file commented out (and the Pi 4 rebooted), you still get that warning. So, commenting that out is not a fix for this problem.

P.S. Re: Your mention of "British English". I assume what you're really getting at is that it won't be translated into non-English languages, but your use of the phrase "British" English intrigues me. It didn't seem "British" to me; it seems entirely idiomatic to these American ears.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

Return to “Raspberry Pi OS”