Thanks, acerimusdux
I began this thread because I wanted to know what does Caja to safely remove, eject or extract an USB flash drive, after asking for it from the right-click context menu. But I made the thread more general, so me & any other person interested can know the command(s) that Caja calls, runs or executes when we click on any option of the right-click menu. And I'm still with that objective ... (yes, I like to learn & understand things, I'm curious ... something very human, not?). OK ...
1. Looking at external signs
* top: you have to be quick to see things here ... I've used screenshots to help me ... I've seen that just after clicking on "Safely Remove Drive" udisksd appears. This is not a command, but could be the abbreviation of udisks --detach . But no umount appears in the screenshots as it should (if udisksd stands for udisks --detach). Perhaps umount does appear in top but disappears too quick ...
* lastcomm| tail -50: [to install it you have to run sudo apt-get install acct]. just after clicking on "Safely Remove Drive" several umount appear, but no udisksd nor udisks --detach . Nevertheless several udisks-part-id appear, that could mean udisks --detach (they also appear after plugging the USB flash drive: in that case they could mean udisks --mount ).
In summary: as no eject appears after running these 2 commands, and according to what has been found, it seems that Caja runs umount first and udisks --detach later to safely remove the USB flash drives.
[As I said "strace caja" doesn't work here]
2. Looking at the origin
With mate-search-tool , using the option "Contains the text" with "FM_ACTION_EJECT_VOLUME" only 2 occurrences appear: one in /path/of/caja-1.8.1/src/file-manager/fm-actions.h (definition ot the action) and another in /path/of/caja-1.8.1/src/file-manager/fm-directory-view.c , from where the action is called. But if I search the text "udisks" 0 occurences appear (umount only appears in 3 translation files)!!??
Can somebody help to trace "FM_ACTION_EJECT_VOLUME" to umount + udisks --detach or the libraries that they use, please?
Regards
[SOLVED] View the commands that run from right-click menu
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Re: View the commands that run from right-click menu
Why not ask the source: http://forums.mate-desktop.org/
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Re: View the commands that run from right-click menu
Ahh well that's an easy one. You should have said this at the start and I would have told you:I began this thread because I wanted to know what does Caja to safely remove, eject or extract an USB flash drive, after asking for it from the right-click context menu.
(Probably) all Linux file mangers use the udisks system daemon, 'udisksd' for mounting/unmounting and possibly for all of the 'safely remove' process too. This is what the 'udisksd' you see in top refers to. It even has a man page:
Code: Select all
man udisksd
If you want a command line equivalent, the closest thing to it is:
Code: Select all
udisksctl power-off /dev/sdx
Re: View the commands that run from right-click menu
Thanks, Buzzsaw
The correct command is like this:
Before you have to unmount the partitions of the drive, like this:
or
But using mate-search-tool with the source code of Caja, using the option "Contains the text" with "udisksd" 0 occurrences appear. The same searching with "udisksctl". How is this possible?
The correct command is like this:
Code: Select all
udisksctl power-off --block-device /dev/sdc
Code: Select all
umount /dev/sdc1
umount /dev/sdc2
umount /dev/sdc3
Code: Select all
udisksctl unmount --block-device /dev/sdc1
udisksctl unmount --block-device /dev/sdc2
udisksctl unmount --block-device /dev/sdc3
Re: View the commands that run from right-click menu
Are you sure? According to the udisksctl man page:Before you have to unmount the partitions of the drive
This wouldn't be possible if the drive were first unmounted, since the buffers/caches would already be cleared.['power-off'] includes ensuring that no process is using the drive, then requesting that in-flight buffers and caches are committed to stable storage...
It possibly refers to udisksd by its process ID, or some other method. I'm not an expert in this department, so I might be wrong.But using mate-search-tool with the source code of Caja, using the option "Contains the text" with "udisksd" 0 occurrences appear. The same searching with "udisksctl". How is this possible?
Re: View the commands that run from right-click menu
Thanks, Buzzsaw
If I run ...
... before umounting I get ...
Until I unmount all the partitions of the drive I can't safely extract or remove it with that command.
I think that one command can have different process IDs. I think that these numbers are given randomly (or ...) when it's required. So ...
Where/how in the source code of Caja appear "udisksd", "udisksctl" or something related to them, please?
If I run ...
Code: Select all
udisksctl power-off --block-device /dev/sdc
Code: Select all
Error powering off drive: The drive in use: Device /dev/sdc3 is mounted (udisks-error-quark, 14)
I think that one command can have different process IDs. I think that these numbers are given randomly (or ...) when it's required. So ...
Where/how in the source code of Caja appear "udisksd", "udisksctl" or something related to them, please?
Re: View the commands that run from right-click menu
In MATE the applications seem to communicate between them using D-Bus: http://wiki.mate-desktop.org/matecorba_to_dbus . So this powerfull tool seems to make unnecessary commands (like udisks, or daemons like udisksd) to be in the source code (of Caja in this case).
This thread could be considered [SOLVED], in the end!!
Thanks to everybody!!
This thread could be considered [SOLVED], in the end!!
Thanks to everybody!!
Re: Re: View the commands that run from right-click menu
Dngrsone wrote:
I use Linux Mint 17 MATE. But in the preferences of the Caja file manager I see no way to customize the right-click context menu.
Any ideas?
1/ Add an executable script with your command(s) in and place it in /home/<username>/.config/caja/scripts
2/ Caja context-menu will now have an extra line in right-click-actions called Scripts.
3/ Follow this through and you will find your script that you have just written.
H.I.H. Joe
J.Evans
as@ May2022 - LM 19.3 Tricia, Cinnamon & Mate Ubuntu-Bionic
as@ May2022 - LM 19.3 Tricia, Cinnamon & Mate Ubuntu-Bionic