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.

share|improve this question
    
can you give me the out put of "ifconfig" and "cat /etc/network/interfaces" – Neil Oct 24 '15 at 23:39
    
@Neil I updated the question with the information you requested. – drohm Oct 25 '15 at 0:20
    
did you rename those interfaces to wlp4s0 and enp0s25 – Neil Oct 25 '15 at 0:45
    
I didn't edit them, no. This is a clean install I did a couple days ago when 15.10 was released. – drohm Oct 25 '15 at 0:48
    
can you check if 70-persistent-net.rules file exists run "ls /etc/udev/rules.d/70-persistent-net.rules" if it exist can you post what is in the file. – Neil Oct 25 '15 at 0:56
up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks Matt. I'd give you an up-vote, but I don't have the rep yet. – drohm Dec 6 '15 at 16:45
    
Hi, could you give a more comprehensive answer? In which way and how shall you edit the file /etc/fstab? You just add a line with x-systemd.automount ? – João Pimentel Ferreira Oct 21 '17 at 20:02

This seems to apply to NFS as well as Samba. A bug has been logged for NFS shares and I'm seeing the same behaviour with either type.

share|improve this answer

Do you have an encrypted $HOME? If so, it's NOT mounted at boot time. Try placong your credentials= files on some directory that IS available at boot time.

share|improve this answer
    
I didn't explicitly ask for my home folder to be encrypted so I don't believe it is. I also tried specifying username and password in /etc/fstab to bypass having it look for the file and it still doesn't mount on reboot. – drohm Oct 25 '15 at 16:33

The system will attempt to mount everything in /etc/fstab before networking comes up. This will cause mounting of the network shares to fail. You can add _netdev to the options of your network mounts to tell the system to only try mounting them after networking is available. Like this:

//192.168.1.18/FileDepot    /mnt/FileDepot  cifs    credentials=/home/user1/.credentials,uid=1000,gid=1000,user,sec=ntlm,_netdev    0   0
//192.168.1.18/Incoming     /mnt/Incoming   cifs    credentials=/home/user1/.credentials,uid=1000,gid=1000,user,sec=ntlm,_netdev    0   0
share|improve this answer
    
I've tried that, but it still doesn't mount. – drohm Oct 25 '15 at 2:56

ah there’s your problem you need to add wlp4s0 to /etc/network/interfaces Edit /etc/network/interfaces

sudo nano /etc/network/interfaces 

add

iface lo inet loopback
auto wlp4s0

and reboot.

you need Regenerate 70-persistent-net.rules file.

run

sudo udevadm trigger 

and

sudo udevadm trigger --action=add

and then reboot.

share|improve this answer
    
Thought that was it, but it didn't work on reboot. I can still do sudo mount -a and it will mount the shares without error. I just can't get it to mount on startup. – drohm Oct 25 '15 at 0:41
    
No change after reboot. What does that command actually do? – drohm Oct 25 '15 at 1:50
    
it Regenerates 70-persistent-net.rules file that file gives your interface name for your NIC's. – Neil Oct 25 '15 at 1:56

Maybe I'm missing something but don't you just need to add the auto option to the mount options? Of I'm not mistaken the default is noauto.

share|improve this answer
    
I tried this and unfortunately it didn't work. – drohm Oct 25 '15 at 0:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.