Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using Kubuntu 22.04 and found that all partitions on three drives were being auto mounted. I found a site that said I could stop this by issuing the command:
Code:
systemctl mask udisks2
I did this, and it worked, and no drives were mounted on rebooting except those in fstab
However, when I plug in a usb drive, nothing happens. So I tried reversing the command with
Code:
systemctl unmask udisks2
I get an error
Quote:
Unit udisk2.service does not exist, proceeding anyway.
Failed to unmask unit: Connection timed out
Rebooting, no drives are mounted, and inserting a usb drive draws a blank.
I am using Kubuntu 22.04 and found that all partitions on three drives were being auto mounted.
That's not my experience with kubuntu 22.04. Items not listed in fstab are not auto mounted on both a fresh install of 22.04 and an upgrade install from 20.04. It's probably a kde configuration issue. Check in System Settings > Removable Devices > Attached Devices. You may be able to get your desired behavior re auto mounting by setting things up in there. Note, for me, something odd is going on in System Settings > Removable Devices > Attached Devices. Partitions which are not on removable media(i.e. are on drives installed in the box) are listed under Attached Devices.
Thank you kilgoretrout
It's all very confusing. Comparing initial installs: Kubuntu 20.04 does not auto mount partitions. However a Neon 5.6/Ubuntu 22.04 does auto mount available partitions. The Neon Settings/Hardware/Removable Storage/Attached Devices is not editable. I don't know why or when my Kubuntu 22.04 suddenly decided to mount other partitions. I suspect I have seen this happen on other Mint install also. Kubuntu 22.04 Settings has a menu item Storage Devices, which enables editing mount at log on. I have seen it stated on web sites:
Quote:
The Auto-mounting of disks in Debian-based Linux distros (and perhaps others) comes from a service called udisks2.
However, I created my problem making a typo, as indicated by the error message referred to in my first post. I omitted an 's' in udisks2, and restored usb mounting with:
I am still vexed by Kubuntu 22.04 insisting on mounting all partitions at boot.
System Settings, Removable Devices, lists all attached devices (partitions), with two columns of boxes on the right labelled 'On Login' and 'On Attach'. None of these is checked, which suggests none will be mounted. BUT on booting they are all mounted. Does this matter? Yes if you want to keep data on those partitions safe.
The only way I have found to stop auto mounting all partitions is to issue the command
Code:
systemctl mask udisks2
The problem then is that when plugging in a usb device it cannot be mounted!
This is puzzling. My 22.04 installations do not auto mount unless set to auto mount in fstab. And attached is a screenshot of System Settings>Removable Devices>Attached Devices. Even entries that have the "On Attached" box ticked do not auto mount without an entry in fstab.The only thing I would suggest as a workaround is to create entries in fstab for all partitions you don't want auto mounted and explicitly have them set noauto.
Thank you teckk
Normally, when a usb device is plugged in, it is detected and a window pops up at the bottom right with options. After issuing the command systemctl mask udisks2 that was not happening, and there was no option to mount the usb inspecting the usb widget. That is what I meant when I said the usb device could not be mounted. In other words, the usb removable device was masked.
and thank you kilgoretrout
Referring to your screenshot, on my system it does not matter whether all boxes are checked or unchecked (empty), on fresh boot 16 partitions are listed in Dolphin under Devices. Clicking any one opens the partition in /media/john/ without need of a password. This is what I referred to as auto mounting. Is this to be expected?? I have believed that generally mounting needs to be commanded by administrator directly or indirectly.
If I issue the command
Code:
systemctl mask udisks2
no partitions are listed in Dolphin under Devices. However plugging in a usb device does not initiate the pop up window at bottom right as explained to teckk
Clicking any one opens the partition in /media/john/ without need of a password. This is what I referred to as auto mounting. Is this to be expected?? I have believed that generally mounting needs to be commanded by administrator directly or indirectly.
OK. Now I get it. That's not what I would call auto mounting but rather user mountable without password in dolphin. Same behavior here. Also, I tried creating an entry in fstab for a partition with noauto and that didn't change that behavior; I could still mount the partition in dolphin without a password, although the mount point changed to the one designated in fstab. You can right click any item in dolphin > Devices and hide it as a workaround.
You're using systemctl udisks2 to modify this behavior. The udisks man page provides:
The "Access Control" section of the above provides in relevant part:
Quote:
Note that the x-udisks-auth option can be used in the /etc/fstab and /etc/crypttab files to specify
that additional authorization is required to mount resp. unlock the device (typically
requiring the user to authenticate as an administrator).
I'm not familiar with that option, but it may provide a way to do what you want. Also, polkit configuration may do it as well as indicated in the link posted by colorpurple.
Edit: Additional information. This appears to be a ubuntu configuration issue with respect to udisks and polkit. I checked this behavior in my installations of Mageia, Arch, OpenSuse and Debian. In every case, when I clicked on a partition in dolphin that was not mounted in fstab, I was prompted for a password before the partition would mount.
Last edited by kilgoretrout; 11-02-2022 at 12:20 PM.
Thank you colorpurple. I will experiment with you reference.
and kilgoretrout
Quote:
Edit: Additional information. This appears to be a ubuntu configuration issue with respect to udisks and polkit. I checked this behavior in my installations of Mageia, Arch, OpenSuse and Debian. In every case, when I clicked on a partition in dolphin that was not mounted in fstab, I was prompted for a password before the partition would mount.
Bingo! The Mageia, Suse, etc response is just the security behavior I was expecting and aiming at.
On rebooting, internal drives were listed in Dolphin. They were not open in /media/john.
Clicking a partition asked for password, and mounted in /media/john
Plugging in a usb device was recognised, and could be opened without a password.
Just what I was looking for.
Thank you all for baring with me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.