21

(Dist: Debian 10)

I have a reoccurring error message that mainly pops up when using systemctl (also when installing a package, and occasionally in a few other places that escape me),

Unit -.mount is masked.

Sometimes (depending on what command called the error message) it is more verbose, such as

Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.

This error doesn't impede installing packages or any systemd services which are enabled already (and as such are loaded at boot), but using systemctl or service to restart, start or stop a service fails. This means I have to reboot the whole server to restart a service, which can be a little annoying.

Trying to unmask the root mount with systemctl unmask -- -.mount appears to work (nothing is returned), but systemctl status -- -.mount still outputs the following after:

● -.mount - Root Mount
   Loaded: masked (Reason: Unit -.mount is masked.)
   Active: active (mounted) since Mon 2019-08-05 15:03:38 AEST; 4h 8min ago
    Where: /
     What: /dev/sde1
    Tasks: 0 (limit: 4915)
   Memory: 0B
   CGroup: /system.slice/-.mount

Any ideas? I'm don't want to start from a fresh install for this server, so either I find a fix or just deal with having to restart if I need to reload a service.

4 Answers 4

23

I was getting the same while performing step 6 in this answer: https://askubuntu.com/a/1028709/1003629.

By trial and error I found this was no longer an issue if I closed GParted.

Edit after I got three upvotes: it would appear gparted locks something, perhaps access to the partition table or a file that holds it, it would be great if someone can edit my answer to clarify this.

Edit: 29-Jul-2023: Mike Fleetwood (GParted Developer)

GParted temporarily sets runtime masks of systemd mount units for block device backed file systems and temporarily creates blank runtime udev rules for Linux Software (mdadm) RAID arrays and Bcache devices. These are cleared when GParted is closed.

It does this to prevent automatic file system mounting and storage layer activation behind it's back; to prevent operations from failing.

3
  • 2
    Wow, how you ever found this is beyond me. Nice work! Mar 14, 2020 at 0:16
  • @jdk1.0 It's ironic then that I'm totally stuck on a java problem atm.
    – pateksan
    Mar 25, 2020 at 12:34
  • 1
    Thank you. I'm playing with my new Pi 4 and was trying to figure out how to a) clone the root partition, b) play with a bunch of stuff, c) blow it up, and d) restore, lather-rinse-repeat. I found partclone but the apt install partclone kept bombing. Only other program running? gparted. I killed it and everything went smooth as glass. Oct 11, 2020 at 0:15
11

You could try removing the -.mount

sudo rm /run/systemd/system/-.mount

and then reloading systemd

sudo systemctl daemon-reload

2

Had the same problem. I added sudo like this:

sudo systemctl unmask  -- -.mount

But the changes were not visible to me until I refreshed systemctl:

sudo systemctl daemon-reload

But still the changes were not visible when running systemctl unmask -- -.mount:

● -.mount - Root Mount
   Loaded: masked (Reason: Unit -.mount is masked.)
   Active: active (mounted) since Thu 2019-02-14 04:11:58 CST; 6 months 14 days ago
    Where: /
     What: /dev/mmcblk0p2
    Tasks: 0 (limit: 2077)
   Memory: 0B
   CGroup: /system.slice/-.mount

I had to reboot the system before systemctl unmask -- -.mount displayed anything different:

● -.mount - /
   Loaded: loaded (/etc/fstab; generated)
   Active: active (mounted) since Thu 2019-02-14 04:11:58 CST; 6 months 14 days 
    Where: /
     What: /dev/mmcblk0p2
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
1
  • From what you describe that worked OK after a reboot. However, the action: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked -- I unmasking your ROOT directory: "/". Check man systemd first, if you want to do this.
    – will
    Oct 5, 2019 at 15:23
0

This command works for me to remove runtime-masked units:

systemctl --runtime unmask -- -.mount

To list all runtime-masked units:

ls -l /var/run/systemd/system | grep '/dev/null'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .