Bug 1177823 - systemd status mnt-foo.mount claims to be active but nothing is mounted
Summary: systemd status mnt-foo.mount claims to be active but nothing is mounted
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-30 17:00 UTC by Jonas Jonsson
Modified: 2015-01-21 23:02 UTC (History)
11 users (show)

Fixed In Version: systemd-216-16.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-21 23:02:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jonas Jonsson 2014-12-30 17:00:17 UTC
Description of problem:
I'm trying to mount a fuse filesystem, it fails but systemd claim that the unit to be active.

$ cat /etc/fstab
...
/mnt/foo /mnt/foo.clean fuse.rofs-filtered defaults,allow_other,ro,nofail 0 0
...

$ systemctl start mnt-foo.clean.mount
$ systemctl status mnt-foo.clean.mount
● mnt-foo.clean.mount - /mnt/foo.clean
   Loaded: loaded (/etc/fstab)
   Active: active (mounted) since tis 2014-12-30 17:54:45 CET; 1s ago
    Where: /mnt/foo.clean
     What: /mnt/foo
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 21906 ExecMount=/bin/mount -n /mnt/foo /mnt/foo.clean -t fuse.rofs-filtered -o defaults,allow_other,ro,nofail (code=exited, status=0/SUCCESS)

dec 30 17:54:45 bender rofs-filtered[21907]: rofs-filtered 1.3: Starting up...
dec 30 17:54:45 bender rofs-filtered[21907]: Using config file: /usr/local/etc/rofs-filtered.rc
dec 30 17:54:45 bender mount[21906]: fuse: unknown option `nofail'
dec 30 17:54:45 bender systemd[1]: Mounted /mnt/foo.clean.

$ findmnt /mnt/foo
$

Version-Release number of selected component (if applicable):
systemd-216-12.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Add line to fstab with fuse filesystem and nofail option
2. systemctl daemon-reload
3. systemctl start mnt-foo.mount

Actual results:
Systemd claims mnt-foo.mount to be active (mounted) but it's not mounted.

Expected results:
Systemd to actually claim the unit failed since it didn't mount properly.

Additional info:

Comment 1 Zbigniew Jędrzejewski-Szmek 2014-12-31 02:15:41 UTC
There are apparently two problems here:
1. nofail option is rejected. It is a standard option described in mount(8) and is supported by /bin/mount itself and the standard helpers like mount.nfs. mount.fuse and its helpers must support it too.

2. as can be seen from the status output, mount exited with status 0, signifying success. This mostly likely happened because mount.fuse helper exited with status 0, and /bin/mount only repeats what it was told.

systemd simply accepts what it is told by /bin/mount and since it /bin/mount exited with status 0 systemd assumes that everything went fine. I don't know if those two issues outline above are caused by mount.fuse or by its rofs-filtered helper. Tentatively reassigning to fuse, since rofs-filtered is not packaged for Fedora.

Comment 2 Jonas Jonsson 2014-12-31 11:20:49 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> There are apparently two problems here:
> 1. nofail option is rejected. It is a standard option described in mount(8)
> and is supported by /bin/mount itself and the standard helpers like
> mount.nfs. mount.fuse and its helpers must support it too.
Tested the same thing with bindfs, and it still complains about the nofail option.

$ cat /etc/fstab
...
/mnt/foo /mnt/foo.clean fuse.bindfs allow_other,ro,nofail 0 0
...

$ systemctl start mnt-foo.clean.mount
Job for mnt-foo.clean.mount failed. See "systemctl status mnt-foo.clean.mount" and "journalctl -xe" for details.

$ systemctl status mnt-foo.clean.mount
● mnt-foo.clean.mount - /mnt/foo.clean
   Loaded: loaded (/etc/fstab)
   Active: failed (Result: exit-code) since ons 2014-12-31 12:01:48 CET; 9s ago
    Where: /mnt/foo.clean
     What: /mnt/foo
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 18806 ExecMount=/bin/mount -n /mnt/foo /mnt/foo.clean -t fuse.bindfs -o allow_other,ro,nofail (code=exited, status=1/FAILURE)

dec 31 12:01:48 bender mount[18806]: fuse: unknown option `nofail'
dec 31 12:01:48 bender systemd[1]: mnt-foo.clean.mount mount process exited, code=exited status=1
dec 31 12:01:48 bender systemd[1]: Failed to mount /mnt/foo.clean.
dec 31 12:01:48 bender systemd[1]: Unit mnt-foo.clean.mount entered failed state.

> 
> 2. as can be seen from the status output, mount exited with status 0,
> signifying success. This mostly likely happened because mount.fuse helper
> exited with status 0, and /bin/mount only repeats what it was told.
> 
> systemd simply accepts what it is told by /bin/mount and since it /bin/mount
> exited with status 0 systemd assumes that everything went fine. I don't know
> if those two issues outline above are caused by mount.fuse or by its
> rofs-filtered helper. Tentatively reassigning to fuse, since rofs-filtered
> is not packaged for Fedora.
This was actually a bug in rofs-filtered, it returned 0 regardless of the result from fuse_main().

I would have thought that systemd actually checked that a filesystem was mounted, but I guess I was wrong.

Comment 3 Zbigniew Jędrzejewski-Szmek 2015-01-01 14:04:33 UTC
(In reply to Jonas Jonsson from comment #2)
> (In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> > There are apparently two problems here:
> > 1. nofail option is rejected. It is a standard option described in mount(8)
> > and is supported by /bin/mount itself and the standard helpers like
> > mount.nfs. mount.fuse and its helpers must support it too.
> Tested the same thing with bindfs, and it still complains about the nofail
> option.
It is possible that they are both wrong. A clarification from util-linux
maintainers would be helpful.

Karel: what's the story with 'nofail' passed as an option to mount helpers?
Should they ignore it silently or are they allowed to complain? And related
question: should it affect their behaviour on failure in any way?

> This was actually a bug in rofs-filtered, it returned 0 regardless of the
> result from fuse_main().
> 
> I would have thought that systemd actually checked that a filesystem was
> mounted, but I guess I was wrong.
It's better for everybody to fix the bug where it is, instead of working around
in all other tools.

Comment 4 Karel Zak 2015-01-05 12:39:25 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #3)
> Karel: what's the story with 'nofail' passed as an option to mount helpers?

I have doubts that any mount helper supports 'nofail' now. 

The option has been originally mount(8) specific, since libmount we use the option for mount helpers too, but it seems it's still unsupported by the helpers.

The mount.nfs at least parses the option, but it's unused by code I guess.

Note that the [u]mount(8) man page, section EXTERNAL HELPERS describes the interface between mount and mount.<type>.

> Should they ignore it silently or are they allowed to complain?

The ideal solution is to follow the 'nofail' purpose (if possible) or at least silently ignore the option. IMHO report the option as unknown is mistake. The same problem we have (sometimes) with -sfnv options on helpers command line.

The really ideal solution would be use use libmount in helpers, but this is huge task (in my TODO for years:-). The library already provides simple API to parse command line options and -o options for helpers, we already use it in mount.nfs (from nfs-utils)).

> > I would have thought that systemd actually checked that a filesystem was
> > mounted, but I guess I was wrong.
> It's better for everybody to fix the bug where it is, instead of working
> around
> in all other tools.

Sure, don't hide bugs.

Comment 5 Zbigniew Jędrzejewski-Szmek 2015-01-05 14:26:34 UTC
(In reply to Karel Zak from comment #4)
> I have doubts that any mount helper supports 'nofail' now.

> The ideal solution is to follow the 'nofail' purpose (if possible)

So neither current situation nor the "ideal" future status do what
we want. (We don't want mount to silently fail, since we want to handle
the failure ourselves in systemd.) We'll have to filter out 'nofail'
from the options given to /bin/mount.

Comment 6 Zbigniew Jędrzejewski-Szmek 2015-01-12 04:58:17 UTC
Upstream commit http://cgit.freedesktop.org/systemd/systemd/commit/?id=17a1c597c5 changes systemd to filter out auto, noauto, fail, and nofail from the options line which is passed to mount. That would fix the problem here. I'll mark this as POST, but it might take a while for the commit to reach F21.

Comment 7 Fedora Update System 2015-01-19 19:23:33 UTC
systemd-216-16.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/systemd-216-16.fc21

Comment 8 Fedora Update System 2015-01-20 21:02:37 UTC
Package systemd-216-16.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-216-16.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0916/systemd-216-16.fc21
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2015-01-21 23:02:56 UTC
systemd-216-16.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.