syntax error in nsswitch config near [ syntax error ]

Bug #488696 reported by karaluh
172
This bug affects 32 people
Affects Status Importance Assigned to Milestone
autofs (Ubuntu)
Fix Released
Undecided
Dimitri John Ledkov
Declined for Lucid by Dimitri John Ledkov
Quantal
Fix Released
Undecided
Dimitri John Ledkov
autofs5 (Debian)
Fix Released
Unknown
autofs5 (Ubuntu)
Invalid
High
Unassigned
Declined for Lucid by Dimitri John Ledkov
Precise
Fix Released
High
Unassigned
base-files (Ubuntu)
Invalid
High
Unassigned
Declined for Lucid by Dimitri John Ledkov
Precise
Invalid
High
Unassigned
Quantal
Invalid
High
Unassigned

Bug Description

[IMPACT]

By default installed autofs, fails to parse the default/unmodified nsswitch.conf and hence does not fall back to files stanza. The parser fails if it doesn't find automount stanza in the nsswitch.conf, and by default there isn't one on Debian/Ubuntu systems. The fix is to change the flex parser to accept nsswitch.conf without an automount stanza as a valid configuration file (empty from the autofs point of view) which then makes is gracefully fallback to the files stanza as expected.

[TESTCASE]

 * Install autofs package
 * Notice "syntax erro in nsswitch config new near [ syntax error ]" in syslog
 * Update package
 * Notice that autofs starts, and mounts (if any) configured in /etc/auto.master are mounted.
 * There is no syntax error from autofs in the syslog

[Regression Potential]

 * If system administrator configured automoun in the nsswitch.conf, that behaviour is preserved and still supported.
 * Previously expected default fallback behaviour did not work, i.e. mounts defined in auto.master with no changes to nsswitch.conf, but now do.

[Other Info]

 * A similar patch has been applied in Debian

Revision history for this message
karaluh (karaluh) wrote :
Revision history for this message
karaluh (karaluh) wrote :
Revision history for this message
karaluh (karaluh) wrote :
Revision history for this message
karaluh (karaluh) wrote :
Revision history for this message
Robert Sander (gurubert) wrote :

It looks like /etc/nsswitch.conf misses a line for automount and autofs5 does not fall back to using files:

http://<email address hidden>/msg06181.html

Adding a line

automount: nis files

solves the issue for me on current Ubuntu lucid (autofs 5.0.4-3.1ubuntu4).

Changed in autofs5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Radu Cotescu (radu) wrote :

After adding the line specified by Robert Sander, autofs still fails to mount mapped NFS exports:

Apr 20 13:08:40 data automount[15735]: attempting to mount entry /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: >> mount.nfs: an incorrect mount option was specified
Apr 20 13:08:40 data automount[15735]: mount(nfs): nfs: mount failure geordi:/tmp/mnt/disc0_3 on /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: failed to mount /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: attempting to mount entry /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: failed to mount /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: attempting to mount entry /home/radu/storage/geordi
Apr 20 13:08:40 data automount[15735]: failed to mount /home/radu/storage/geordi

Revision history for this message
Radu Cotescu (radu) wrote :

The behaviour of mount.nfs here is somewhat similar to the one mentioned in bug https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/537746.

Radu Cotescu (radu)
Changed in autofs5 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Ryan Daly (daly-ctcnet) wrote :

Even after adding the line to /etc/nsswitch.conf, you still need to ensure that /etc/auto.master has...

+auto.master

...before it will look to NIS. Is this intended behavior? Seems to be redundant if /etc/nsswitch.conf is already specifying that it needs to look to NIS for the auto.master map.

Revision history for this message
Jojo (kuzniarpawel) wrote :

After adding following line:

automount: nis files

I receive :
automount[2274]: lookup_init:136: lookup(yp): map auto.master: Local domain name not set

reloading autofs doesnt help

Revision history for this message
Whit Blauvelt (whit-launchpad) wrote :

Why is that a year after the fix was released (adding the nnswitch.conf line works for me on Ubuntu Server 10.10), there is no updated package with the fix for Ubuntu 10.10? 11.04 does not appear to need the fix, despite that line being added. But 11.04 does. Shouldn't it have been pushed out?

Changed in autofs5 (Debian):
status: Unknown → New
Revision history for this message
Marcin Dylewski (marcin-dylewski-m) wrote :

This bug is still present in 12.04. Is that a regression?

Revision history for this message
Mike Szmansky (mszmansky) wrote :

Why is this bug not being addressed? This is a very high priority.

Revision history for this message
electronico (me-electronico) wrote :

Running 11.10 (X64) , there were no troubles with autofs5.
After a 12.04 upgrade, it doesn't run anymore.
Please fix this ! as previously told : This is a very high priority.

Revision history for this message
Alex Smith (alexsmith) wrote :

"automount[2274]: lookup_init:136: lookup(yp): map auto.master: Local domain name not set"

type sudo hostname <computername> to fix.
found answer here http://askubuntu.com/questions/40977/setting-up-nfs-client-shows-local-domain-name-not-set-error

this just happened to me, scary thing was it was after a power failure (i might have installed some updates, not sure?) and left the computer broken.

serious issue.
Ubuntu 10.10 with .38 kernel and most updates applied.

Revision history for this message
Maarten Jacobs (maarten256) wrote :

Hmm. I ran into more issues with autofs. Not sure when they actually started, I only noticed them today. After some poking around I figured out that:

1. The "map auto.master: Local domain name not set" error occurs when I include "+auto.master" in /etc/auto.master. I also found out that this entry in /etc/auto.master is not required (at least on my installation).
2. For some bizarre reason, the way I had my autofs map files set up didn't work anymore without specifically adding ".local" to the server identification. For instance I'd set up:

/home/user/Pictures server:/home/user/Pictures

I had to change this to:

/home/user/Pictures server.local:/home/user/Pictures

This (so far) appears to have solved my issues with automount.

At the same time I also changed /etc/nsswitch.conf:

From:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

To:

hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4

But I'm not sure that had any impact.

Revision history for this message
Maarten Jacobs (maarten256) wrote :

Note to previous - had to install "dnsmasq" package and run the dnsmasq deamon to fix the problem with the resolution of hostnames on the local network. After that I removed the ".local" extension from the server name and things are still working for me.

Revision history for this message
TJ (tj) wrote :

The addition to /etc/nsswitch.conf needs to be done either:

a) in the nsswitch.conf file shipped by the base-files package, or
b) as part of the postinst/postrm scripts of autofs5

This issue also causes failure for users of autosshfs (not packaged for Ubuntu as yet).

Changed in autofs5 (Ubuntu):
status: Fix Released → Confirmed
importance: Undecided → High
Changed in base-files (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Changed in autofs5 (Ubuntu Precise):
importance: Undecided → High
status: New → Confirmed
Changed in base-files (Ubuntu Precise):
status: New → Confirmed
importance: Undecided → High
no longer affects: autofs (Ubuntu Precise)
no longer affects: autofs5 (Ubuntu Quantal)
Changed in autofs5 (Ubuntu Precise):
assignee: nobody → Dmitrijs Ledkovs (dmitrij.ledkov)
Changed in autofs (Ubuntu Quantal):
assignee: nobody → Dmitrijs Ledkovs (dmitrij.ledkov)
Changed in autofs5 (Ubuntu Precise):
assignee: Dmitrijs Ledkovs (dmitrij.ledkov) → nobody
Revision history for this message
Steve Langasek (vorlon) wrote :

This information does not belong in /etc/nsswitch.conf. nsswitch.conf is a configuration file for libc, for selecting between NSS modules; autofs should not be relying on being able to stick its own configuration settings in this file. And base-files should not be adding such non-standard config settings. Marking as invalid for base-files.

A proper autofs fix is to move this configuration information out of /etc/nsswitch.conf entirely, so that its parser stops tripping over perfectly valid libc configurations.

Changed in base-files (Ubuntu Precise):
status: Confirmed → Invalid
Changed in base-files (Ubuntu Quantal):
status: Confirmed → Invalid
Revision history for this message
Robie Basak (racb) wrote :
Changed in autofs5 (Ubuntu):
status: Confirmed → Triaged
Changed in autofs5 (Ubuntu Precise):
status: Confirmed → Triaged
Changed in autofs (Ubuntu Quantal):
status: New → Triaged
Revision history for this message
Paul Smith (psmith-gnu) wrote :

Steve's comment #18 is not correct. Automount was first created in the late 1980's, and when Sun released the first version of name service switch in the early 1990's, it was already being used to manage automount maps. Automount maps have been considered a standard, basic name service ever since, on every version of UNIX that has ever implemented nsswitch.conf.

I think that it's a great idea that autofs be enhanced so that if there's no entry in nsswitch.conf, autofs will not fail but will instead assume "files". However, the bug against base-files is NOT invalid. Automount entries DO belong in nsswitch.conf and the standard value is "automount: files nis" and this should be preserved in Ubuntu.

I agree that _ideally_ someone would modify libc to support "/etc/nsswitch.d" and individual packages (like autofs) could add their own files there containing name service switch configuration. However, until that day comes please add back the automount entry to nsswitch.conf in base-files. The fact that it's not there is a legitimate bug.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@Robie Basak (racb) #19
That patch has been in the autofs[5] package for a while now. Yet the bug is still there.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Currently autofs falls back to reading it's own configuration files, if the parser did not find automount stanza.
The problem is that the current autofs' parser fails on the default nsswitch.conf
See: lib/nss_parse.y

Options are:
1) change default nsswitch.conf (not gonna happen see comment #18, see comment #20 for history which, well, mattered in the past)
2) remove autofs nsswitch.conf parser (not ideal, breaks compatibility with other distros & history see comment #20)
3) fix autofs nsswitch.conf parser
4) make autofs use something that knows how to parse nsswitch.conf properly

I personally would prefer solution #3 and send the patch to debian & upstream. Unfortunately I do not know Yacc to even understand what ./lib/nss_parse.y is doing.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Correction: "Currently autofs falls back to files stanza, if the parser did not find automount stanza."

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

for #3 there are two options:
* fix the lex/yacc parser
* copy&paste + adjust the pure C parser from libc.

no longer affects: autofs5 (Ubuntu R-series)
Changed in autofs5 (Ubuntu):
status: Triaged → Invalid
no longer affects: autofs (Ubuntu R-series)
no longer affects: base-files (Ubuntu R-series)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autofs - 5.0.6-2ubuntu2

---------------
autofs (5.0.6-2ubuntu2) quantal; urgency=low

  * Add patch to fix nsswitch parser to accept nsswitch.conf without an
    automout stanza as valid file. (Closes: #602090) (LP: #488696)
 -- Dmitrijs Ledkovs <email address hidden> Wed, 12 Sep 2012 17:18:24 +0100

Changed in autofs (Ubuntu Quantal):
status: Triaged → Fix Released
Revision history for this message
Whit Blauvelt (whit-launchpad) wrote :

Why isn't this fixed for Precise? Ubuntu is often a server OS. Autofs is best practice for mounts by a server. Precise is LTS, so this belongs on it.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

The fix has been uploaded into precise-proposed at about the same time as the fix for quantal.
Please note the package name in precise is autofs5 and not autofs.
The fix is currently in the precise-proposed unapproved queue [1], pending Stable Release Updates Team to review the upload and commit it to precise-proposed to start the Stable Release Update validation process.

[1] https://launchpad.net/ubuntu/precise/+queue?queue_state=1&queue_text=

Changed in autofs5 (Debian):
status: New → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi Dimitrijs, can you add a Test case and Regression potential section to the bug description per https://wiki.ubuntu.com/StableReleaseUpdates ? Leaving the upload in the queue for now. Thanks!

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Doh... done =)

description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello karaluh, or anyone else affected,

Accepted autofs5 into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/autofs5/5.0.6-0ubuntu5.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in autofs5 (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

I installed autofs5 from precise-proposed and confirm that there is no longer a syntax error.

Setting up autofs5 (5.0.6-0ubuntu5.1) ...
invoke-rc.d: policy-rc.d denied execution of start.
(precise-amd64)root@impulse:/home/bdmurray# cat /var/log/syslog
Jan 22 15:19:39 impulse rsyslogd: rsyslogd's userid changed to 101
Jan 22 15:19:39 impulse rsyslogd-2039: Could not open output pipe '/dev/xconsole' [try http://www.rsyslog.com/e/2039 ]
Jan 22 15:22:37 impulse sudo: pam_ecryptfs: pam_sm_authenticate: /home/bdmurray is already mounted
Jan 22 15:22:46 impulse automount[30849]: syntax error in nsswitch config near [ syntax error ]
Jan 22 15:22:46 impulse automount[30849]: do_mount_autofs_indirect: failed to create autofs directory /misc
Jan 22 15:22:46 impulse automount[30849]: handle_mounts: mount of /misc failed!
Jan 22 15:22:46 impulse automount[30849]: master_do_mount: failed to startup mount
Jan 22 15:24:55 impulse automount[31408]: do_mount_autofs_indirect: failed to create autofs directory /misc
Jan 22 15:24:55 impulse automount[31408]: handle_mounts: mount of /misc failed!
Jan 22 15:24:55 impulse automount[31408]: master_do_mount: failed to startup mount

tags: added: verification-done
removed: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autofs5 - 5.0.6-0ubuntu5.1

---------------
autofs5 (5.0.6-0ubuntu5.1) precise-proposed; urgency=low

  * Add patch to fix nsswitch parser to accept nsswitch.conf without an
    automout stanza as valid file. (Closes: #602090) (LP: #488696)
 -- Dmitrijs Ledkovs <email address hidden> Wed, 12 Sep 2012 20:28:06 +0100

Changed in autofs5 (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.