Fix for Debian Wheezy not mounting CIFS/SMB shares at boot time

Debian (Wheezy/7.5.0 in this case) uses numerous confsuing initscripts to mount network filesystems at boot time ;-)

Basically /etc/rcS.d/ calls /etc/network/if-up.d/mountnfs, which is responsible to mount the network filesystems who are listed in /etc/fstab, such as CIFS/NFS etc. Don’t get irritated by the name, looking at the header of the file reveals: “Also mounts SMB filesystems now, so the name of this script is getting increasingly inaccurate.” Heh.

The Problem:

CIFS shares in /etc/fstab are not mounted at boot time but running mount -a after the system has booted just mounts them fine.

After seeing some unsatisfactory workarounds on the internet, like adding a @reboot cronjob wich runs mount -a or by putting it in /etc/rc.local, I decided to check the scripts. Welp, does not even try to mount the network filesystems. Something is broken in there.


Add the following to /etc/default/rcS:


It finally works. *sigh*



  • Avi

    Well, i tried the above describe solution but now for some reason my PI will not reboot at all…
    it gets halted after:

    [ok] configuring network interfaces…done.
    and then nothing…any idea? is there a way i can recover from this?


    Admin Edit: Solved, see next comment.

  • Markus Lindberg

    Thanks for the thorough explanation. This is a much better solution than calling “mount -a” from some shady boot script.
    CIFS and SMB are quite broken packages on Debian systems. Well pre Jessie at least.

  • Nicholas Cliver

    I tried many other search results trying to get a Raspberry Pi2 to connect to a Lacie network drive on boot so I could run an unattended Plex Server. This got me the closest but ASYNCMOUNTNFS=yes in /etc/default/rcS is what ended up getting it all to mount properly on boot for me.

    /etc/fstab entry that I ended up with:
    //SomeIPAddress/Family /media/Plex cifs credentials=/home/pi/.smbcredentials 0 0

    With :

    In the .smbcredentials file chmod to 0600 for security purposes.

  • Von Rugen

    I had a similar problem getting network shares to mount from fstab using cifs. I tried the ASYNCMOUNTNFS solution, and it didn’t work. In researching the network timing, I discovered that the default NOOBS configuration had my ethernet connection set to manual. Changing the network setting to dhcp fixed the problem. Instantly, the fstab auto-mount started on the next reboot, no ASYNCMOUNTFS, _netdev, or scripting mounts required.
    In /etc/network/interfaces

    I changed
    iface eth0 inet manual
    auto eth0
    iface eth0 inet dhcp

    I referenced this page:

  • 2ells

    Thanks Von Rugen, I have Raspian installed and your fix worked for me as well (tried all the other solutions in vain)

    • M1ZERY

      Von Rugen, 2ells I can confirm this suggested fix works for me as well! I am running the latest Raspbian Jessie image (Debian Linux 8.0), mounted a CIFS network share via Webmin and after I restarted my Pi2, the share would not mount at boot. Sure enough, I checked and saw my eth0 was set to manual. I followed the suggested steps above, rebooted, and my share FINALLY mounted at boot.

      Thank you so much for the solution!

  • Geoff Palmer

    This didn’t work for me using Ubuntu 16.04. I have three remote drives, but only one or two of them — seemingly at random — would mount at boot, requiring me to manually do a sudo mount -a

    What does seem to work, however, is adding the following to /etc/fsab:


    So, for example, I get
    // /media/shared cifs comment=systemd.automount,credentials=…

    What this means is that the share gets mounted as soon as something tries to access it, but not before. (It should also mean you boot faster too!)

Leave a Reply

Your email address will not be published. Required fields are marked *