1

I have created a mount, mnt-stoneshare.mount, placed in /etc/systemd/system:

[Unit]
Description=StoneOS Storage Mount

[Mount]
What=/dev/disk/by-uuid/62721034-29ee-4894-a19e-905bcbb20c7c
Where=/mnt/stoneshare

[Install]
WantedBy=local-fs.target

The file is being generated automatically by an installer of a software that I'm working on.

Apparently, right after generation (the system is running), if I attempt to start the mount by systemctl start /mnt/stoneshare or the equivalent systemctl start mnt-stoneshare.mount, the unit does not fail, but the mounting does not happen. Checking journalctl, there is some weirdness:

Nov 22 20:28:12 stone-development-arch systemd[367]: Unmounted /mnt/stoneshare.
Nov 22 20:28:12 stone-development-arch systemd[367]: Unmounting /mnt/stoneshare...
Nov 22 20:28:12 stone-development-arch systemd[367]: Unit mnt-stoneshare.mount is bound to inactive service. Stopping, too.
Nov 22 20:28:12 stone-development-arch kernel: EXT4-fs (md127): mounted filesystem with ordered data mode. Opts: (null)

First off, it says that it's mounted (therefore, I assume the exit code being 0 on mount), but immediately after, it's being unmounted.

And checking systemctl status /mnt/stoneshare, there are no errors either:

[root@stone-development-arch StoneOS.RaidProcess]# systemctl status /mnt/stoneshare/
● mnt-stoneshare.mount - StoneOS Storage Mount
   Loaded: loaded (/etc/systemd/system/mnt-stoneshare.mount; enabled)
   Active: inactive (dead) since Sat 2014-11-22 20:28:12 EET; 4min 11s ago
    Where: /mnt/stoneshare
     What: /dev/disk/by-uuid/62721034-29ee-4894-a19e-905bcbb20c7c
  Process: 855 ExecMount=/bin/mount -n /dev/disk/by-uuid/62721034-29ee-4894-a19e-905bcbb20c7c /mnt/stoneshare -t auto (code=exited, status=0/SUCCESS)

My installer also enables (systemctl enable /mnt/stoneshare) after the attempt to start the unit. If I reboot the system, the device gets mounted properly. If I am to unmount (by stopping the unit) and attempt to remount (by starting the unit) I get the same errors.

I assume that the problem relies in the configuration of my Unit, yet, being a systemd newbie I cannot seem to find the solution.

I have read through the issue here, but doesn't seem to be the case.
Also, I walked through this bug on RedHats' but the UUID's and everything else is correct, plus, the mounting happens if it's performed on boot. Have went through other posts also, to no avail.

What is causing the mount to be immediately unmounted if performed manually?

1

Oh my, what a fail, I had leftovers from previous tests in /etc/systemd/user that conflicted.

Apparently, when running systemd units from logged in users context, it will favor /etc/systemd/user directory - that's why it failed on manual mounts, but worked on boot.

Removing the unit from user namespace, fixed the issue for manual mounts too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.