# Samba mount at boot fails

## felixg

I'm trying to mount a samba share at boot using /etc/fstab file. But during boot I get "SMB connection failed" message. Also afterwards "mount -a" correctly mounts the share! How can I check what's wrong? One idea I've is that samba loads after the mount attempt at boot. I tried to make samba load first, but don't know how  :Sad: 

----------

## HogRider

Two questions & one request:

Questions:

First, why are you attempting to automount a smb share on boot? (rather than logon, etc)

Second, big picture, what are you trying to accomplish?  (There might be a better way)

Request:

If you're set on automounting a smb share at boot, please post you /etc/fstab to assist with troubleshooting.

Thanks,

Mike

----------

## Arzie

I have the same problem. A couple of Windows-shares in my /etc/fstab, at boot I get the 'SMB connection failed' message, but afterwards (/etc/init.d/netmount restart) it works without a hitch.

btw: I configured mine to be run after samba (edit /etc/init.d/netmount and put samba in the myneed="net samba" line).

[edit]And suddenly it works! I recompiled my kernel and it depends on samba now, but I don't know if that's really necessary.[/edit]

----------

## helmers

I've got a somewhat related question, I'd like to get my samba shares mounte/unmounted automagically. I've never done something like this before, could someone give me some instructions?   :Wink: 

----------

## helmers

Just to bump it; I've searched far and wide for some info on this, and it looks like a bug to me. I can get it going by running "/etc/init.d/netmount restart" as well, but that can't be the way it is supposed to work.

Also, regular users can't add, delete or move files on the volumes. Here's a line from the /etc/fstab: 

```
//idun/grafikk          /mnt/grafikk    smbfs           users,umask=000,suid,rw,password=       0 0
```

 Note that it is a passwordless Windows server.

What do I need to get it to dynamically mount/umount samba shares depending on if they are available or not? Automount?

----------

## ARC2300

Mine is working just fine.   :Confused: 

This is my /etc/fstab:

```

# /etc/fstab: static file system information.

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.10 2002/11/18 19:39:22 azarah Exp $

#

# noatime turns of atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail and tail freely.

# <fs>             <mountpoint>    <type>     <opts>            <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/hda1      /boot      ext3      noauto,noatime   1 1

/dev/hda3      /      reiserfs   noatime,notail,nodirtime 0 0

/dev/hda2      none      swap      sw      0 0

/dev/cdroms/cdrom0   /mnt/cdrom   iso9660      noauto,ro,users,uid=1000,10   0 0

proc         /proc      proc      defaults   0 0

//Apollo/MP3      /mnt/MP3s   smbfs       username=xxxxxx,password=xxxxxx,uid=xxxx

//Apollo/Users      /mnt/net   smbfs      username=xxxxxx,password=xxxxxx,uid=xxxx

//Apollo/ApacheDocs   /mnt/HTTP   smbfs      username=xxxxxx,password=xxxxxx,uid=xxxx

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink). Adding the following

# line to /etc/fstab should take care of this:

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will use almost no

#  memory if not populated with files)

tmpfs         /dev/shm   tmpfs      defaults   0 0
```

I used to have the problem to where I just couldn't mount at all.  Funny thing was, though, to fix mine, I changed the server from RH to Gentoo (I finally got the 72 hours to do it).

Hope that kinda helps having something to compare your fstab against.

----------

## Shrekkie

Hey this works great for shares via samba, thus using smbfs. Thnx a lot

But for a mapped network drive on a Win 2003 File Server I guess i need another devicetype.

Anyone ?

----------

## taskara

I have a problem whereby I have three smb shares set to auto mount under fstab when I boot up.

the first two work fine (they are public shares)

the last one fails (it is my personal share)

however if I login and run 

```
mount /mnt/samba/server/chris
```

 it works!

so I don't know why it's not working on boot

here is my fstab, does anyone have any ideas? what am I doing wrong?  :Confused: 

```

//server/public         /mnt/samba/server/public        smbfs   defaults,uid=1000,user=chris,password=****  0 0

//server/transfer       /mnt/samba/server/transfer      smbfs   defaults,uid=1000,user=chris,password=****  0 0

//server/chris          /mnt/samba/server/chris         smbfs   defaults,uid=1000,user=chris,password=****  0 0

```

----------

## Shrekkie

you kinda mount it different with or without fstab :

try manually this :

```

#mount.smbfs //server/chris  /mnt/samba/server/chris  -o defaults,uid=1000,user=chris,password=****   

```

If this doesn't work you will know the line in your fstab is not good.

Also you could try to leave out the username and pass in your fstab on that particular line cause it does work when simply mounted. Check if it really is a share and not another filesystem

I had some problems too in the beginning, but if you play around you will find it.

----------

## taskara

hmm.. because if I run

```
mount /mnt/samba/server/chris
```

as root from the command line it works just fine - and that's pulled from the fstab - so I know the line in fstab works.. it just doesnt' work on boot - but the other two do!

so I don't know why..  :Confused: 

----------

