Software & AppsOperating SystemLinux

How To Fix CIFS Mount Not Mounting at Boot in Ubuntu’s fstab

Ubuntu 18

In this article, we will delve into a common issue faced by Ubuntu users: the CIFS mount not mounting at boot in Ubuntu’s fstab. We will walk you through the steps to fix this issue and ensure that your CIFS share is mounted automatically at boot time.

Quick Answer

To fix the issue of CIFS mount not mounting at boot in Ubuntu’s fstab, you can modify the fstab entry by adding the _netdev option. This tells the system to wait until the network is up before trying to mount the share. If this does not resolve the issue, you can try using the x-systemd.automount option or enabling the "Wait for network at boot" option in the raspi-config menu (for Raspbian users). Another solution is to modify the /etc/rc.local file to include a delay before calling mount -a.

Understanding the Problem

The CIFS (Common Internet File System) protocol is a standard for sharing files across network nodes, providing a mechanism for clear, stable, and secure data transfer. However, sometimes, you may encounter an issue where the CIFS mount does not automatically mount at boot in Ubuntu’s fstab.

This issue often arises due to the network interface not being up and running when the system tries to mount the CIFS shares. The system, therefore, fails to find the network location, resulting in the mount not occurring.

Solution: Modifying the fstab Entry

The solution to this problem lies in modifying the fstab entry. Here’s a typical fstab entry for a CIFS share:

//192.168.0.26/mythtv/media /media/mybooklive cifs username=user,password=pass,umask=002,uid=136,gid=144,iocharset=utf8 0 0

In this entry, the first field //192.168.0.26/mythtv/media is the network location of the CIFS share. The second field /media/mybooklive is the local mount point. The third field contains several options separated by commas:

  • username=user,password=pass: These are the credentials for accessing the CIFS share.
  • umask=002: This sets the permission for the mounted filesystem.
  • uid=136,gid=144: These set the user ID and group ID for the mounted filesystem.
  • iocharset=utf8: This sets the character set that the filesystem should use.

To fix the issue, we need to add the _netdev option to this list. This option tells the system to wait until the network is up before trying to mount the share.

//192.168.0.26/mythtv/media /media/mybooklive cifs username=user,password=pass,_netdev,umask=002,uid=136,gid=144,iocharset=utf8 0 0

Additional Solutions

If adding the _netdev option does not resolve the issue, you can try the following solutions:

Solution 1: Use the x-systemd.automount Option

Replace the _netdev option with x-systemd.automount. This option mounts the drive when it is first accessed, rather than at boot time.

//192.168.0.26/mythtv/media /media/mybooklive cifs username=user,password=pass,x-systemd.automount,umask=002,uid=136,gid=144,iocharset=utf8 0 0

Solution 2: Enable “Wait for Network at Boot” Option

If you are using Raspbian, you can enable the “Wait for network at boot” option in the raspi-config menu. This ensures that the network is available before the system tries to mount the shares.

Solution 3: Modify the /etc/rc.local File

Another solution is to modify the /etc/rc.local file to include a delay before calling mount -a. This allows the network to connect before mounting the shares.

sleep 20
mount -a

Conclusion

By following these steps, you should be able to fix the issue of CIFS mount not mounting at boot in Ubuntu’s fstab. Remember to save your changes and reboot your system for the modifications to take effect. If you encounter any issues, do not hesitate to seek help from the Ubuntu community or refer to the Ubuntu documentation.

Why is my CIFS mount not automatically mounting at boot in Ubuntu’s fstab?

The issue is often caused by the network interface not being up and running when the system tries to mount the CIFS shares. This results in the mount not occurring.

How can I fix the CIFS mount not mounting at boot issue?

To fix the issue, you can modify the fstab entry by adding the _netdev option. This option tells the system to wait until the network is up before trying to mount the share. You can also try using the x-systemd.automount option or enabling the "Wait for network at boot" option in the raspi-config menu if you are using Raspbian. Another solution is to modify the /etc/rc.local file to include a delay before calling mount -a.

What is the purpose of the `_netdev` option in the fstab entry?

The _netdev option tells the system to wait until the network is up before trying to mount the CIFS share. It ensures that the share is mounted only when the network is available, preventing the mount from failing.

Can I use the `x-systemd.automount` option instead of the `_netdev` option?

Yes, you can use the x-systemd.automount option instead of the _netdev option. This option mounts the CIFS share when it is first accessed, rather than at boot time. It can be an alternative solution if the _netdev option does not resolve the issue.

How do I enable the “Wait for network at boot” option in Raspbian?

To enable the "Wait for network at boot" option in Raspbian, you can go to the raspi-config menu. Run sudo raspi-config in the terminal, navigate to Boot Options, and select Wait for network at boot. This ensures that the network is available before the system tries to mount the CIFS shares.

What should I do if I encounter any issues while fixing the CIFS mount not mounting at boot?

If you encounter any issues while fixing the CIFS mount not mounting at boot, you can seek help from the Ubuntu community or refer to the Ubuntu documentation for further assistance. They can provide guidance and solutions to any specific problems you may encounter.

Leave a Comment

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