Ubuntu – Mount network share automatically on startup

fstabmountnetworkingsamba

I'm trying to have two network shares automatically mount upon rebooting my machine but I'm having no luck. I've read through several similar AskUbuntu questions but I can't seem to get it to mount the shares on rebooting. This is my current configuration:

/etc/fstab:

//192.168.1.18/FileDepot    /mnt/FileDepot  cifs    credentials=/home/user1/.credentials,uid=1000,gid=1000,user,sec=ntlm    0   0
//192.168.1.18/Incoming     /mnt/Incoming   cifs    credentials=/home/user1/.credentials,uid=1000,gid=1000,user,sec=ntlm    0   0

In my home folder, I have the .credentials file:

username=user1
password=mypass

As I mentioned, this will not autmatically mount the shares on a reboot, but if I manually run:

sudo mount -a

it works.

I'm running Xubuntu 15.10 x64. Any idea what I'm doing wrong or missing?

ifconfig output:

enp0s25   Link encap:Ethernet  HWaddr 54:ee:75:4d:ec:01  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:f1200000-f1220000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:443 errors:0 dropped:0 overruns:0 frame:0
          TX packets:443 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:40169 (40.1 KB)  TX bytes:40169 (40.1 KB)

wlp4s0    Link encap:Ethernet  HWaddr 34:02:86:42:e4:06  
          inet addr:192.168.1.78  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3602:86ff:fe42:e406/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2128 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1960 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1324170 (1.3 MB)  TX bytes:723204 (723.2 KB)`

cat /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

Here is some output from dmesg:

[    5.077816] CIFS VFS: Error connecting to socket. Aborting operation.
[    5.077818] CIFS VFS: Error connecting to socket. Aborting operation.
[    5.078083] CIFS VFS: cifs_mount failed w/return code = -101
[    5.078666] CIFS VFS: Error connecting to socket. Aborting operation.
[    5.078836] CIFS VFS: cifs_mount failed w/return code = -101
[    5.080887] CIFS VFS: Error connecting to socket. Aborting operation.
[    5.081008] CIFS VFS: cifs_mount failed w/return code = -101

I've tried using ethernet and no wifi, but that didn't help. I'm not sure where to go with this now.

Best Answer

I've been able to solve the problem on my system by adding x-systemd.automount, to the list of options in my fstab entry. I was seeing the same problem with Raspbian Jessie (from Wheezy) which led me to a forum post.

Related Question