# AutoFS; do I _need_ NIS?

## Reformist

Quick question - I'm trying to have certain directories automounted upon access, like my samba share directories, and possibly cdrom etc. Automnt looks like the best way to do this. The daemon autofs will not start without ypbind running, which wants to connect to an NIS server. I have a network, but do not need / want an NIS server on another machine (or this one) and didn't even know I needed a client. The question is, to enable this feature only (automounting directories) must I install, and run, an NIS server, client, and then automnt? Does anyone know what kind of overhead these three have?

I know they both offer many more features than I'm using, but I do not want them at the moment; I just want to automount shares. Would supermount be a better alternative?

----------

## rtn

Let me start by saying that I don't use automounter, so I don't really

have have a ton of experience with it.   However, I'm pretty certain 

that you shouldn't need to run NIS for automount - they are two totally

separate services that don't really overlap at all.

--rtn

----------

## Reformist

Makes sense, but when starting autofs, I get this error message, which has to do with ypbind (an NIS application), and the autofs service fails to start:

$/etc/init.d/autofs start

No NIS server and no -broadcast option specified.

Add a NIS server to the /etc/yp.conf configuration file,

or start ypbind with the -broadcast option.

I looked at /etc/yp.conf, and there is an NIS server line there commented out. I can uncomment it, but I do not know what to put in there, as I do not have an NIS server running on my network and therefore cannot provide a valid address for ypbind to connect to (or whatever happens, not very familiar with ypbind).

Also, I tried adding autofs to default using rc-config, and it fails upon boot with the same error message.

----------

## pjp

Does the AutoFS website have anything to say?  Perhaps there's a configuration that can be turned off.

----------

## rtn

Well, I think both products were originally Sun-isms (maybe not this auto

mounter, but you know what I mean...)  According to the documentation

on their web site, the automounter can read sun-style maps via NIS or NIS+.

You don't have those configured do you?

--rtn

----------

## hoochiepapa

the autofs script checks for /usr/bin/ypcat ( part of NIS)

If found it  runs it.

Did you emerge any of the yp packages? such as yp-tools?

----------

## Reformist

I have yptools emerged; I've never worked with ypbind or anything, so I'm not sure how I have this stuff is on my system.

Anywho, when starting autofs, It starts ypbind, which gives the following output:

No NIS server and no -broadcast option specified.

Add a NIS server to the /etc/yp.conf configuration file,

or start ypbind with the -broadcast option.

* No NIS server found.

* ERROR:  Problem starting needed services.

"autofs" was not started.

I would easily fix the problem by adding a server to yp.conf, but I am not running one, nor do I want to... I thought having automount work would be as easy as merging the packaging and editing it's config files =)

----------

## hoochiepapa

I think it's ypcat trying to start ypbind

unmerge yp-tools, see if that fixes your problem.

----------

## Reformist

Unmerged yp-tools, still no go. ypbind is still being called =(

blasted automount! Is supermount equivalent in functionality?

----------

## hoochiepapa

Do you have /usr/bin/ypcat ?

if so remove it and try again.

Never tried supermount. 

Isn't that a kernel patch?

----------

## Reformist

ypcat went with the yp-tools package, so I don't have that program. Supermount is a kernal module, and you can just list it in fstab, which would be nicer than setting up other files, such as the ones that automount requires.

----------

## hoochiepapa

I just emerged autofs, works like a champ.

I have no yp(anything) installed; ypbind, ypserve, yp-tools.

maybe verify you have none of those,  re- emerge autofs.

----------

## CheshireCat

I was actually looking for something else, but I noticed the mention of supermount.  Supermount is quite effective for my CD-ROM drive - any access to /mnt/cdrom spins up the drive and attempts to mount a disc, and you can remove the disc immediately after closing any files (there doesn't seem to be any kind of timeout for unmount).  It also does all of this without any special userspace tool - just mount as supermount and use the appropriate parameters to pass the device.  The only minor annoyance is that there is no indicator of whether a disc is mounted or not - the filesystem is always mounted.

----------

## Reformist

Well, that's an annoyance I can definately deal with. I said screw AutoFS after all of the trouble/errors, upgraded my kernel and have supermount enabled (no patching required). Looks good; does supermount work with samba? dev=smbfs says "bad fs type".

----------

## CheshireCat

Haven't tried this myself, I only have one computer here and not much use for samba.  Correct me if I'm wrong, but doesn't mounting SMB shares require a special smbmount tool?  If so, it's likely that supermount can't handle it.  If it can, I would also suspect that the fs must be specified for shares, since there's not actually a physical device, and automatic fs detection won't work.

----------

## Reformist

You can have sambfs built into the kernel, and list it as a fs in fstab. Here is a line from my fstab, non-supermount enabled:

//kagero/desktop /mnt/shares/kagero/desktop smbfs guest,user,exec,rw,uid=501,noauto 0 0

But, supermount wants also a dev="something", and samba shares have no device. Also, supermount complained about the filesystem, so I'm not sure if it recognizes it... would be nice to go to a network share's folder and have it automatically mounted, eh?

----------

## CheshireCat

As far as mount is concerned, the UNC path to the share is the "device".  The problem here seems to be that you need more than the mount system call to mount a SMB share.  Supermount passes the mount options you give it to the mount system call directly, but from what strace says mount.smbfs does, it looks like the SMB share needs some setup before the mount() call is made.  Most likely, supermount as it currently works can not handle the SMB mount  :Sad:   What would be nice would be a "userspace" or similar option to supermount, to make it call a userspace tool to mount the sub-filesystem it manages.  Something like this is probably the only way that supermount could work for an SMB share.  If anyone else has some correction or additions to any of this, I'd like to know.  I don't use samba at all, but this has gotten interesting  :Wink: 

----------

## mvc

My question is simple: 

Why does the autofs rc-script has a line saying:

     need ypbind

?

thanks

Marco

----------

## kybber

Mine doesn't (autofs 3.1.7-r5):

```
depend() {

        need localmount

        use ypbind nfs

}

```

----------

## sinate

Newbie question here, but where do you get the gentoo autofs script from? The sample that comes with the autofs source does not seem to be compatable with the gentoo way of doing the runlevels.

Background: I am replacing a SuSe system on a network running a NIS server and autofs4.

Cheers

----------

