Bug 874862 - systemd-fstab-generator[255]: Failed to create unit file: File exists
Summary: systemd-fstab-generator[255]: Failed to create unit file: File exists
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 19
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: 2012-11-08 23:23 UTC by Michal Jaegermann
Modified: 2015-02-17 14:33 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-17 14:33:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
strace results for systemd-fstab-generator (24.86 KB, text/plain)
2012-11-09 22:47 UTC, Michal Jaegermann
no flags Details

Description Michal Jaegermann 2012-11-08 23:23:17 UTC
Description of problem:

Systemd started obstinated attempts to run systemd-fstab-generator. After running a while I counted 204 error messages like this:

systemd-fstab-generator[255]: Failed to create unit file: File exists

The first one showed up with "[   11.510364]".  The last one recorded prior to stopping count was at "[ 3376.010751]".


Version-Release number of selected component (if applicable):
systemd-195-2.fc18.x86_64

How reproducible:
I do not really know.  There is always some "...teen" messages of that sort, which is disconcerting enough, but this time systemd overdid itself.  So far I did not see such persistency here.

Additional info:
No idea if this is possibly related but at that time yum was running a massive update transaction with over a thousand packages in it.

Comment 1 Michal Schmidt 2012-11-09 11:16:28 UTC
Generators are run on every systemd reload. Packages that ship systemd unit files are expected to invoke 'systemctl daemon-reload' in their rpm scriptlets. Having systemd reload many times during a yum transaction with a thousand of packages is not surprising.

The problem is that the generator encounters an error. Unfortunately the error message is not specific as to which unit was the one with the problem.
I have improved the error messages in:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=40b8acd039cf1ea00167017e63d9c0a773002f0e

There may be two reasons for the "File exists" error. Either we fail to clean up the generated unit directory before running the generators, or the generator's input data causes it to produce a single unit name more than once.

Do you get a similar error message if do this?:
P=/tmp/gentest
mkdir $P
/lib/systemd/system-generators/systemd-fstab-generator $P $P $P

(You will surely get the error if you run the last command twice. I'm curious if you get the error on the first run too.)

Comment 2 Michal Jaegermann 2012-11-09 18:08:47 UTC
(In reply to comment #1)
> Generators are run on every systemd reload. Packages that ship systemd unit
> files are expected to invoke 'systemctl daemon-reload' in their rpm
> scriptlets. Having systemd reload many times during a yum transaction with a
> thousand of packages is not surprising.

929 of these updated packages were various components of
texlive-2012-5.20121024_r28063.fc19 update.  Not good candidates for daemon-reload. This leaves 191 of other assorted components.  I did not try to count how many times 'systemctl daemon-reload' may be called by this bunch but 204 seems to be excessive.

> The problem is that the generator encounters an error.

On every boot I see seventeen, or so, of these.  I think that I mentioned that on the first time in bug 840242 on 2012/Jul/14.  That report was talking about booting troubles and at that time it looked like these messages could be relevant.  In a retrospect this was distraction but error messages stayed - does not matter if booting is broken or not.

 
> Do you get a similar error message if do this?:
> P=/tmp/gentest
> mkdir $P
> /lib/systemd/system-generators/systemd-fstab-generator $P $P $P

Yes, I do.  The same seventeen times.  204/17 is 12 so maybe this
'systemctl daemon-reload' was called 11 times during an update transaction and once while booting?

Running the above created for me in /tmp/gentest 10 directories, 18 files and 18 symlinks and those 17 error messages.  Re-running a generator part ended up with 35 errors.

> (You will surely get the error if you run the last command twice. I'm
> curious if you get the error on the first run too.)

If the error is inconsequential then maybe systemd-fstab-generator should check for a presence of file and silently move on if already there?  If, OTOH, a fresh content is important then why not just clobber the old one and complain only if this is not possible?

Comment 3 Michal Schmidt 2012-11-09 20:33:31 UTC
(In reply to comment #2)
> On every boot I see seventeen, or so, of these.  I think that I mentioned
> that on the first time in bug 840242 on 2012/Jul/14.

Hm, I see. Is this still the current fstab?:
https://bugzilla.redhat.com/show_bug.cgi?id=840242#c8
If not, please attach the current /etc/fstab.

> > Do you get a similar error message if do this?:
> > P=/tmp/gentest
> > mkdir $P
> > /lib/systemd/system-generators/systemd-fstab-generator $P $P $P
> 
> Yes, I do.  The same seventeen times.  204/17 is 12 so maybe this
> 'systemctl daemon-reload' was called 11 times during an update transaction
> and once while booting?

Yes, this is likely.

Could you please do the experiment again, with a new subdirectory under tmp, and with the last command run under "strace -o trace.txt ..."? And then attach the trace.txt.

> If the error is inconsequential then maybe systemd-fstab-generator should
> check for a presence of file and silently move on if already there?

We still haven't identified the root cause, so I'd rather not hide the error yet.

Comment 4 Michal Jaegermann 2012-11-09 22:44:38 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > On every boot I see seventeen, or so, of these.  I think that I mentioned
> > that on the first time in bug 840242 on 2012/Jul/14.
> 
> Hm, I see. Is this still the current fstab?:
> https://bugzilla.redhat.com/show_bug.cgi?id=840242#c8

Yes, nothing changed here.  This is only a subset of filesystems on a hardware.
This is a test box with many different installations on it.

> Could you please do the experiment again, with a new subdirectory under tmp,
> and with the last command run under "strace -o trace.txt ..."? And then
> attach the trace.txt.

Oh, I see.  I have also various 'noauto' entries to prevent some demented software from sticking its nose where it definitely does not belong. 18 of those are using a nominal mount point /mnt/jnk.  That would correspond to these 17 "Failed to create unit file".  Good!  Nobody asked for that.  The only not-good is that it not failed 18 times.

Comment 5 Michal Jaegermann 2012-11-09 22:47:49 UTC
Created attachment 641871 [details]
strace results for systemd-fstab-generator

Comment 6 Michal Schmidt 2012-11-12 10:04:32 UTC
(In reply to comment #4)
> I have also various 'noauto' entries

Since they're not in the fstab that you attached, could you please paste me an example of at least two of them?

Comment 7 Michal Jaegermann 2012-11-12 19:32:54 UTC
(In reply to comment #6)

> 
> Since they're not in the fstab that you attached, could you please paste me
> an example of at least two of them?

These "noauto" entries look like that:

LABEL=/Cent		/mnt/jnk	ext3	noauto	0 0
LABEL=/Cent32		/mnt/jnk	ext3	noauto	0 0
LABEL=/FA 		/mnt/jnk     	ext3	noauto 	0 0

Actually I would rather have a more effective way to tell "keep out" to various software pieces and that includes systemd.

Comment 8 Michal Schmidt 2012-11-14 17:20:10 UTC
systemd parses fstab in order to have its internal representation in the form of mount units.

This fstab use case looks valid - it allows the user to call "mount -L <label>" with the expected result. It exposes a limitation of systemd mount units. They are uniquely named based on the mount point path. systemd's model cannot represent multiple mount units having the same mount point.

Nevertheless, it does not seem that we need to overcome this limitation. The user won't be using systemctl to mount these filesystems.

Here's what we could do:
 - Detect this situation explicitly, rather than discovering it accidentally by
   EEXIST. (Implementation hint: use a hash table; emit the unit files all at
   the end.)
 - Define how the conflict shall be resolved. Should the first line win?
   Should the last one win? Maybe the cleanest way would be to emit no unit file
   at all.
 - Instead of printing an error per conflicting line, print only one message for
   the whole conflicting group, with severity 'warning'.

Whether to add a fstab option ("x-systemd.ignore") to ignore a line entirely is orthogonal to the above.

Comment 9 Michal Schmidt 2012-11-14 17:27:59 UTC
(In reply to comment #8)
>  - Define how the conflict shall be resolved. Should the first line win?
>    Should the last one win? Maybe the cleanest way would be to emit no unit
>    file at all.

Here's an idea: The last one without 'noauto' should win. If all of them are 'noauto', emit no unit file.

Comment 10 Michal Jaegermann 2012-11-14 23:18:18 UTC
(In reply to comment #8)

>    Maybe the cleanest way would be to emit no unit file
>    at all.

That would be an expected behaviour from my POV.  OTOH  means to mark some
partitions with "do not even try to think about it" would be most welcome in some situations.

Comment 11 Fedora End Of Life 2013-04-03 17:45:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 12 Fedora End Of Life 2015-01-09 17:27:51 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2015-02-17 14:33:22 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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