Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

What commands does Thunar use to mount drives?

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
itmicp
Posts: 38
Joined: 2013-05-11 04:45
Location: France
Has thanked: 6 times
Been thanked: 6 times

Re: What commands does Thunar use to mount drives?

#21 Post by itmicp »

Hi
sunrat wrote: 2023-09-21 02:01…I created a polkit rule to mount any other partitions without password just by clicking their name in Dolphin sidebar. …
For file systems on removable devices, without having to create a polkit rule you can simply add the user account to the disk group.

Code: Select all

su -l -c 'usermod -a -G disk '$USER

CwF
Global Moderator
Global Moderator
Posts: 2720
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: What commands does Thunar use to mount drives?

#22 Post by CwF »

itmicp wrote: 2023-09-21 12:28 simply add the user account to the disk group.
Yo Sarge, another entry for group think! Thanks itmicp. There is a elegant simplicity in user group rights.
None1975 wrote: 2023-09-21 11:41 Also, you can check automounting with systemd.
I may have been premature testing on this over a year back, I couldn't really find much elegance in the method.

Well @bitrat, you are getting the overview!

CwF
Global Moderator
Global Moderator
Posts: 2720
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: What commands does Thunar use to mount drives?

#23 Post by CwF »

Concerning cross tool use I just tested Thunar's ability to umount using the 'Devices' drop down menu.
Terminal is shown here, on creation Thunar shows the 'device', clicking for the menu, unmount is an option, and it fails. Sure it would be nice, but I still argue unnecessary. Also note this is a user terminal, no passwords

Code: Select all

$ systemd-mount -t tmpfs -o size=100M tram ~/Public/test
Started unit home-user-Public-test.mount for mount point: /home/user/Public/test
$  df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             4088260        0   4088260   0% /dev
tmpfs             820328     1688    818640   1% /run
/dev/vda1       24663932 14376700   9180468  62% /
tmpfs            4101636        0   4101636   0% /dev/shm
tmpfs               5120        8      5112   1% /run/lock
tmpfs             820324       80    820244   1% /run/user/1001
dram             4194304    92440   4101864   3% /home/user/Downloads
tram              102400        0    102400   0% /home/user/Public/test
$ systemd-umount ~/Public/test
Stopped unit home-user-Public-test.mount for mount point: /home/user/Public/test
sunrat wrote: 2023-09-21 06:17 IIRC from using Xfce years ago, Thunar requires gvfs to display drives in its sidebar.
Confirmed, I tested without sudo/udisk/gvfs and it works the same for the user terminal while Thunar does not show 'Devices' in the left pane

itmicp
Posts: 38
Joined: 2013-05-11 04:45
Location: France
Has thanked: 6 times
Been thanked: 6 times

Re: What commands does Thunar use to mount drives?

#24 Post by itmicp »

Hi
bitrat wrote: 2023-09-20 04:49 …When Thunar mounts a drive, it apparently creates the necessary mount directory and removes it after unmounting. Should I mimic that behaviour if mounting manually? …
You can list the paths of links using file system label names
by running the following command line :

Code: Select all

ls -l /dev/disk/by-label/
and you can use these links path to mount these file systems:

Code: Select all

username@myhostname:~$ udisksctl mount -b /dev/disk/by-label/BACKUP
Mounted /dev/sdd1 at /media/username/BACKUP
username@myhostname:~$ 
username@myhostname:~$ udisksctl mount -b /dev/disk/by-label/OS
Mounted /dev/sda1 at /media/username/OS
username@myhostname:~$ 
… and then unmount them:

Code: Select all

username@myhostname:~$  udisksctl unmount -b /dev/disk/by-label/BACKUP
Unmounted /dev/sdd1.
username@myhostname:~$ 
username@myhostname:~$  udisksctl unmount -b /dev/disk/by-label/OS
Unmounted /dev/sda1.
username@myhostname:~$ 
The directory to be used as a mount point will be automatically created when the file system will be mounted
and automatically destroyed when the file system will be unmounted.

You can use the same method with links named by file system UUID that you will find in /dev/disk/by-uuid
Last edited by itmicp on 2023-09-23 13:37, edited 1 time in total.

bitrat
Posts: 80
Joined: 2023-07-20 09:41

Re: What commands does Thunar use to mount drives?

#25 Post by bitrat »

None1975 wrote: 2023-09-21 11:41 .
.
In this case, I would use fstab method. Also, you can check automounting with systemd. More info here. But I've never tried this method, so I can't say anything more.
.
.
PCManFM uses same mechanism as Thunar FM. It using udisks2. Dolphin file manager uses kio (KDE Input/Output framework provides a single API for operating on files, whether local or on a remote server. Additionally, KIO Slaves provide support for individual protocols. Some particularly useful ones are http, ftp, sftp, smb, nfs, ssh (fish), man, tar and zip. ).
.
.
I think there is no need to dive into such a depth. Unless you're a programmer. It is enough to know how to use the Internet search, and reading manual pages is also very useful
.
.
I simply entered the phrase

Code: Select all

thunar debian package
in an internet search and researched what is included in this package.
For example this is thunar file manager with all dependencies.
Thanks for this. It's all very helpful. Good idea to look at the packages, lol! Actually I used to use aptitude, and it kept me more alert to dependencies. Now I use apt or apt-get and the details just kind of scroll past my eyeballs without me paying too much attention.

I'm pretty efficient at trawling through source code, though, and it has a bit more structure than a dependency list. Usually I just drill down to the bits that do the actual work and look at the headers. Sometimes a whole library is included for the darnedest little thing and that can be misleading when it appears as if a program vitally depends on its services!

bitrat
Posts: 80
Joined: 2023-07-20 09:41

Re: What commands does Thunar use to mount drives?

#26 Post by bitrat »

None1975 wrote: 2023-09-21 11:45 I don't want to interfere, but I would advise you not to bother with poolkit rules (unless you really know what you're doing) and simply use udisks2, which uses VERY little memory and takes up VERY LITTLE disk space.
Yep, thanks. Having looked at it, I think it would be overkill, even though it would probably accomplish wiw. don't think I need another daemon looking over my shoulder.

bitrat
Posts: 80
Joined: 2023-07-20 09:41

Re: What commands does Thunar use to mount drives?

#27 Post by bitrat »

CwF wrote: 2023-09-21 15:18
itmicp wrote: 2023-09-21 12:28 simply add the user account to the disk group.
Yo Sarge, another entry for group think! Thanks itmicp. There is a elegant simplicity in user group rights.
None1975 wrote: 2023-09-21 11:41 Also, you can check automounting with systemd.
I may have been premature testing on this over a year back, I couldn't really find much elegance in the method.

Well @bitrat, you are getting the overview!

Yes, and I agree about the disks group. Definitely a good option for me! Thanks itmicp. :-)
Last edited by bitrat on 2023-09-22 08:07, edited 1 time in total.

bitrat
Posts: 80
Joined: 2023-07-20 09:41

Re: What commands does Thunar use to mount drives?

#28 Post by bitrat »

itmicp wrote: 2023-09-21 23:21

Code: Select all

user@myhostname:~$ udisksctl mount -b /dev/disk/by-label/BACKUP
Thanks for this. It looks like udisksctl uses polkit though. Is that by necessity?

itmicp
Posts: 38
Joined: 2013-05-11 04:45
Location: France
Has thanked: 6 times
Been thanked: 6 times

Re: What commands does Thunar use to mount drives?

#29 Post by itmicp »

udisks uses polkit to gain access privileges (among other things) to device files.

Post Reply