Hide Unmount Button in Nemo

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Post Reply
AidenJames1995
Level 1
Level 1
Posts: 10
Joined: Fri Aug 19, 2022 6:08 am

Hide Unmount Button in Nemo

Post by AidenJames1995 »

I am looking for a way to hide the unmount button in nemo for internal disks. Any ideas? I do automated back-ups and I don't want these drives to come unmounted accidentally (I've had it happen before, rsync wrote almost 800GB to my system drive accidentally). I can always manage these drives in terminal or the disk utility when I know I want to explicitly unmount them.
Cosmo.
Level 24
Level 24
Posts: 22055
Joined: Sat Dec 06, 2014 7:34 am

Re: Hide Unmount Button in Nemo

Post by Cosmo. »

I don't think, that this is possible except by rewriting the source code.
But you can create mount points in /etc/fstab for every drive and add the option nouser for them. With this only root can unmount the drive.
Gotcha!
User avatar
AndyMH
Level 20
Level 20
Posts: 10760
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Hide Unmount Button in Nemo

Post by AndyMH »

Are you mounting them in /media?
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 4 x Thinkpad T430 Cinnamon 20.1, 2 x i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate
AidenJames1995
Level 1
Level 1
Posts: 10
Joined: Fri Aug 19, 2022 6:08 am

Re: Hide Unmount Button in Nemo

Post by AidenJames1995 »

AndyMH wrote:
Thu Sep 22, 2022 2:26 pm
Are you mounting them in /media?
No, all my drives are on /mnt. I did see a post on superuser.com that moving from /media to /mnt on GNOME/Nautilus fixed it there (https://superuser.com/questions/973770/ ... -in-ubuntu), but doesn't seem to matter with Nemo.
mikeflan
Level 12
Level 12
Posts: 4196
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Hide Unmount Button in Nemo

Post by mikeflan »

I'm just recording that the unmount buttons are these:
um.png
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

I suppose these buttons will not show if the volume is mounted via fstab in a way that only root can unmount.
AidenJames1995
Level 1
Level 1
Posts: 10
Joined: Fri Aug 19, 2022 6:08 am

Re: Hide Unmount Button in Nemo

Post by AidenJames1995 »

vanadium wrote:
Sun Sep 25, 2022 8:07 am
I suppose these buttons will not show if the volume is mounted via fstab in a way that only root can unmount.
Nope. Everything is mounted at /mnt and everything is mounted as root at start-up.


Here's a portion of my fstab:

Code: Select all

/dev/mapper/vgmint-root / ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme1n1p2 during installation
UUID=********** /boot           ext4    defaults        0       2
# /boot/efi was on /dev/nvme1n1p1 during installation
UUID=**********  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/vgmint-swap_1 none            swap    sw              0       0
/dev/disk/by-uuid/************* /mnt/Files auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/************* /mnt/Game\040Storage auto nosuid,nodev,nofail,x-gvfs-show 0 0
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

Even if the buttons are there, it does not mean you can unmount.

Instead remove the "x-gvfs-show" options from fstab and create a bookmark to these volumes instead. Volumes are then reached equally easily, and no buttons will be shown.
AidenJames1995
Level 1
Level 1
Posts: 10
Joined: Fri Aug 19, 2022 6:08 am

Re: Hide Unmount Button in Nemo

Post by AidenJames1995 »

vanadium wrote:
Mon Sep 26, 2022 12:02 pm
Even if the buttons are there, it does not mean you can unmount.

Instead remove the "x-gvfs-show" options from fstab and create a bookmark to these volumes instead. Volumes are then reached equally easily, and no buttons will be shown.
Nevermind then, I'll just consider this to a bug with cinnamon/nemo and live it.
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

AidenJames1995 wrote:
Mon Sep 26, 2022 12:10 pm
vanadium wrote:
Mon Sep 26, 2022 12:02 pm
Even if the buttons are there, it does not mean you can unmount.

Instead remove the "x-gvfs-show" options from fstab and create a bookmark to these volumes instead. Volumes are then reached equally easily, and no buttons will be shown.
Nevermind then, I'll just consider this to a bug with cinnamon/nemo and live it.
It is your choice. Bookmarks are simple, though. Go to where the drive is mounted and hit Ctrl+D to create a bookmark in the left pane.
AidenJames1995
Level 1
Level 1
Posts: 10
Joined: Fri Aug 19, 2022 6:08 am

Re: Hide Unmount Button in Nemo

Post by AidenJames1995 »

vanadium wrote:
Tue Sep 27, 2022 7:18 am
AidenJames1995 wrote:
Mon Sep 26, 2022 12:10 pm
vanadium wrote:
Mon Sep 26, 2022 12:02 pm
Even if the buttons are there, it does not mean you can unmount.

Instead remove the "x-gvfs-show" options from fstab and create a bookmark to these volumes instead. Volumes are then reached equally easily, and no buttons will be shown.
Nevermind then, I'll just consider this to a bug with cinnamon/nemo and live it.
It is your choice. Bookmarks are simple, though. Go to where the drive is mounted and hit Ctrl+D to create a bookmark in the left pane.
I'm aware of how to make them, just don't have the time screw around with it for 6 different drives. I actually use my system for productivity, not to screw around trying to fix things that shouldn't even be a problem to begin with.
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

AidenJames1995 wrote:
Tue Sep 27, 2022 1:47 pm
I'm aware of how to make them, just don't have the time screw around with it for 6 different drives. I actually use my system for productivity, not to screw around trying to fix things that shouldn't even be a problem to begin with.
Six seconds for six drives. But again, it is entirely your call. Bookmarks are specifically made for what you want to achieve. Sometimes, the problem is with the user, not with the software.
User avatar
NM64
Level 3
Level 3
Posts: 131
Joined: Sat Feb 04, 2017 11:34 pm

Re: Hide Unmount Button in Nemo

Post by NM64 »

vanadium wrote:
Mon Sep 26, 2022 12:02 pm
Instead remove the "x-gvfs-show" options from fstab
If I may chime in for a moment, I'm running into the same issue as OP and, when using Mint's included "Disks" program, going into the mount options for a given partition, and unchecking "Show in user interface" (which removes the aforementioned x-gvfs-show) and then rebooting, the internal drive/partition is still listed.

This is particularly troublesome for me because I made a separate partition and mount point for /home/<user>/Documents on the primary internal drive, you know, the same physical disk that holds the root directory (aka /) and yet Mint seems to think that my Documents partition is its own hot-swappable SATA drive which, I assure you, it is not!

Nevertheless, Mint does seem to actually allow me to unmount the Documents partition, though it does ask me for the root password first. Therefore this is still something I would like to similarly solve but, considering what I said above, it's looking like this may in fact be a bug.

EDIT: Also this occurs regardless of whether it's a desktop or laptop, though both systems I tested on lack the BIOS options to configure SATA hot-swapping like I know exists on some motherboards - the only SATA option was the usual configuring SATA as IDE, RAID, or AHCI (I say "usual" but there are some OEM desktops and/or OEM laptops that lack the AHCI setting annoyingly enough even on chipsets that definitely support AHCI, meaning it's basically ewaste in our current SSD world due to AHCI being a requirement for trim)
Last edited by NM64 on Mon Oct 03, 2022 11:41 pm, edited 7 times in total.
motoryzen
Level 7
Level 7
Posts: 1902
Joined: Sun Dec 08, 2019 12:25 am

Re: Hide Unmount Button in Nemo

Post by motoryzen »

NM64...please create your own thread. given your comment about " this is on a laptop"
That alone tells me you have a different computer than the OP.

All good vibes meant, but the mods will tell you the same thing in that " no thread hijacking" is allowed. The main reason being is that your troubleshooting-to finding the final resolution= steps could end up being different.

Otherwise.it will be two different conversations within the same forum topic and would create much confusion.

Read the " how forum rules for more details " ( which no one does apparently -_- )
Primary rig:
asrock x570 taichi
ryzen 5900x
128GB of kingston fury at 3600mhz 1.44 volts 20-20-20 ( I forgot the rest) 1T timings
corsair mp600 pro xt NVME ssd 4TB
8GB rx580 sapphire nitro+ video card
Viewsonic Elite UHD 32" 144hz monitor
User avatar
NM64
Level 3
Level 3
Posts: 131
Joined: Sat Feb 04, 2017 11:34 pm

Re: Hide Unmount Button in Nemo

Post by NM64 »

Good news then - it happens on desktop too! This was easy enough to test by simply removing the 2.5" SATA drive from the laptop, plugging it into a desktop motherboard's internal SATA port (and power), booting from the drive and then observing that, yes, the behavior is 100% identical.

(protip: don't do this "swapping the same drive between different PC hardware" if Nvidia GPUs are involved; also you may need to install GRUB if the OS was installed via UEFI)


Also the motherboard in question didn't have any options to configure the hot-swapping of its internal SATA ports despite this very much being a DIY motherboard that even supports the "core unlocking" that was possible on some K10 CPUs (such as my own Phenom II x2 which unlocks to a quad core without issue, yes even after lengthy and rigorous stability testing - I'm talking 24+ hours of OCCT's "large data set" with the CPU running within 5c of tjmax).

The only SATA option on both systems was the usual configuring SATA as IDE, RAID, or AHCI (I say "usual" but there are some OEM desktops and/or OEM laptops that lack the AHCI setting annoyingly enough even on chipsets that definitely support AHCI, meaning it's basically ewaste in our current SSD world due to AHCI being a requirement for trim).
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

NM64 wrote:
Mon Oct 03, 2022 10:02 pm
If I may chime in for a moment, I'm running into the same issue as OP and, when using Mint's included "Disks" program, going into the mount options for a given partition, and unchecking "Show in user interface" (which removes the aforementioned x-gvfs-show) and then rebooting, the internal drive/partition is still listed.
The general behavior is that, by default, volumes mounted under /media or somewhere under your home directory are shown. To override that default behavior, you can add x-gvfs-hide.
User avatar
NM64
Level 3
Level 3
Posts: 131
Joined: Sat Feb 04, 2017 11:34 pm

Re: Hide Unmount Button in Nemo

Post by NM64 »

vanadium wrote:
Tue Oct 04, 2022 8:47 am
The general behavior is that, by default, volumes mounted under /media or somewhere under your home directory are shown. To override that default behavior, you can add x-gvfs-hide.
Well that was easy enough - it "just works"! I wonder if this would solve OP's issue as well?

AidenJames1995 wrote:
Thu Sep 22, 2022 5:43 am
I am looking for a way to hide the unmount button in nemo for internal disks. Any ideas?
Are you fine with the disk itself being unlisted in Nemo's left-side bar as well as the "safely eject removable disks" panel icon menu thing?

If so, then the simple solution configured right through the GUI (no terminal or editing of config files needed!) is to just use the GUI-based "Disks" program that comes pre-installed with Mint and takes all of like a minute to do (it probably takes more time to just read my extremely broken-out instructions).

In "Disks":
  1. click on your desired disk
  2. click on the corresponding partition
  3. click the gear icon located below the disk's partition layout
  4. click "Edit Mount Options..."
  5. uncheck "Use Session Defaults"
  6. Plan A: uncheck "Show in user interface"
  7. click OK and then check and see if your desired partition is now unlisted in Nemo or the like; if it is not, then continue to the next step:
  8. Plan B: repeat the steps above but skip step 7 (as in, do not press the "OK" button), then add x-gvfs-hide to the first-listed text box (it should be located directly below "Symbolic icon name")
  9. now click OK and then check and make sure that your desired partition is now unlisted in Nemo or the like
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Hide Unmount Button in Nemo

Post by vanadium »

That will probably not satisfy OP. OP does want buttons, however does not want to see the "eject" arrows on these buttons. The drives of OP are mounted under /mnt, so they are not shown by default. Here, they were made to show using the x-gvfs-show option.

I already proposed what you indicate, and advised to use bookmarks instead. These are functionally the same as the buttons, however without the eject buttons.
User avatar
NM64
Level 3
Level 3
Posts: 131
Joined: Sat Feb 04, 2017 11:34 pm

Re: Hide Unmount Button in Nemo

Post by NM64 »

vanadium wrote:
Tue Oct 04, 2022 4:34 pm
I already proposed what you indicate, and advised to use bookmarks instead. These are functionally the same as the buttons, however without the eject buttons.
I just realized that I'm actually doing just this for a network-attached disk that I just recently set up all of a couple of days ago. However, it seems that, as soon as I access the disk, it shows up like a USB disk with the whole "safely eject" icon and everything which is not something I desire.

Problem is, network drives don't appear in the "Disks" program, so I can't add x-gvfs-hide - what do?
Post Reply

Return to “Cinnamon”