# [SOLVED]Trouble automounting SMB-Share

## Clad in Sky

Hello,

I want to automatically mount a samba share at startup, but it does not work.

It does work fine, however, using "mount -a" or "mount /mount/point".

My fstab looks as follows, and probably there's something wrong in the options, but I can't find it after repeated alterations and reboots... still the share will not be mounted, but mounting it manually (as root - user mounts seem not to work due to some security issue and setuid) works.

```

//192.168.178.1/fritz.nas   /media/fritznas cifs vers=1.0,auto,_netdev,uid=1000,gid=1000,credentials=/home/user/.smbcredentials  0 0

```

Any help would be appreciated.

Solution: net.enp6s0 wasn't added to default runlevel but started as a dependency of probably ntpd - this prevented net from coming up earlier than netmount.

----------

## Hu

What message(s) does your init system print when it tries to mount the share?  Is there anything relevant in dmesg?

----------

## Clad in Sky

```
NET: Registered protocol family 10

[   11.165676] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready

[   11.165717] Segment Routing with IPv6

[   11.177362] Key type cifs.spnego registered

[   11.177365] Key type cifs.idmap registered

[   11.179417] CIFS VFS: Error connecting to socket. Aborting operation.

[   11.179419] CIFS VFS: cifs_mount failed w/return code = -101

[   11.215455] 8021q: adding VLAN 0 to HW filter on device bond0

[   11.215468] IPv6: ADDRCONF(NETDEV_UP): bond0: link is not ready

[   11.567311] resource sanity check: requesting [mem 0x000c0000-0x000fffff], which spans more than PCI Bus 0000:00 [mem 0x000c0000-0x000dffff window]

[   11.567406] caller _nv001094rm+0xe3/0x1d0 [nvidia] mapping multiple BARs

[   14.138551] igb 0000:06:00.0 enp6s0: igb: enp6s0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX

[   14.138807] IPv6: ADDRCONF(NETDEV_CHANGE): enp6s0: link becomes ready

```

Seems like it's trying to mount before the network is ready... I thought this was what _netdev option was for.

[Moderator edit: added [code] tags to preserve output layout. -Hu]

----------

## toralf

 *Clad in Sky wrote:*   

> Seems like it's trying to mount before the network is ready... I thought this was what _netdev option was for.

 Maybe IPv4 is up and that's what CIFS is looking for?

----------

## Clad in Sky

Yeah, maybe. Any way around that? Could I make a script that mounts the share at the end of the boot process, even after my desktop comes up?

----------

## nick_gentoo

The mounting of the network shares is controlled by the netmount service, so make sure that it is started in the "default" runlevel with

```
rc-update show
```

The _netmount option in fstab is what is indicating that this is a network share and any mount should be attempted only after the network is up. From what I see, you have to define by yourself what it means that the network is up in /etc/conf.d/netmount, depending on how you configure networking in your case.

----------

## Clad in Sky

Netmount is in the default runlevel, so that should be OK.

I changed /etc/conf.d/netmount to be:

```

#

# If you are using a dynamic network management tool like

# NetworkManager, dhcpcd in standalone mode, wicd, badvpn-ncd, etc, to

# manage the network interfaces with the routes to your netmounts, you

# should list that tool.

#

#rc_need="NetworkManager"

rc_need="dhcpcd"

#rc_need="wicd"

#

```

Alas, to no avail. Is there a way to move netmount to a later place in the startup process? I found some info but that seemed to be for CentOS only.

----------

## nick_gentoo

I think the value for rc_need should be the name of the service that starts the network. The more common names would be net.eth0 or net.lan0 or maybe net.enp6s0 in your case.

Could you list the full output of rc-update show? Do you have dhcpcd in the default runlevel?

----------

## Clad in Sky

 *nick_gentoo wrote:*   

> I think the value for rc_need should be the name of the service that starts the network. The more common names would be net.eth0 or net.lan0 or maybe net.enp6s0 in your case.
> 
> Could you list the full output of rc-update show? Do you have dhcpcd in the default runlevel?

 

I don't, for some reason:

```

               binfmt | boot                                   

             bootmisc | boot                                   

              cgroups |                                 sysinit

           consolekit |      default                           

               cronie |      default                           

                cupsd |      default                           

                 dbus |      default                           

                devfs |                                 sysinit

                dmesg |                                 sysinit

                 fsck | boot                                   

             hostname | boot                                   

              hwclock | boot                                   

              keymaps | boot                                   

            killprocs |                        shutdown        

    kmod-static-nodes |                                 sysinit

                local |      default nonetwork                 

           localmount | boot                                   

             loopback | boot                                   

              modules | boot                                   

             mount-ro |                        shutdown        

                 mtab | boot                                   

             netmount |      default                           

                 ntpd |      default                           

               procfs | boot                                   

                 root | boot                                   

         save-keymaps | boot                                   

    save-termencoding | boot                                   

            savecache |                        shutdown        

                 swap | boot                                   

               sysctl | boot                                   

                sysfs |                                 sysinit

             sysklogd |      default                           

         termencoding | boot                                   

                 udev |      default                    sysinit

         udev-trigger |                                 sysinit

              urandom | boot                                   

                  xdm |      default   
```

But in /conf.d/net I have: 

```

config_enp6s0="dhcpcd"
```

So I guess that works, too.

I'll try with rc_need = net.enp6s0.

Thanks all for the input so far.

----------

## nick_gentoo

It looks like the networking is not explicitly started, but is maybe turned on by another service that depends on it (could be ntpd in this case).

Do you have a file named /etc/init.d/net.enp6s0?

Did you setup the network according to the Gentoo handbook?

----------

## Clad in Sky

 *nick_gentoo wrote:*   

> It looks like the networking is not explicitly started, but is maybe turned on by another service that depends on it (could be ntpd in this case).
> 
> Do you have a file named /etc/init.d/net.enp6s0?
> 
> Did you setup the network according to the Gentoo handbook?

 

I do have that file.

I hadn't added net.enp6s0 to the default runlevel for whatever reason (usually I adhere quite a lot to the handbook). I did now and it works.

Many thanks!   :Very Happy:   :Very Happy: 

Solved now.

----------

