Sunday, November 13, 2011

Ubuntu 11 samba mounting problems during booting

After upgrading to Ubuntu 11 I started to receive errors during booting mentioning CIFS-VFS. A quick search on the internet did not reveal a simple solution. Now I had a more thorough look. The CIFS-VFS error apparently has something to do with the automatic mounting of a samba share on a server in my network. I now know why the error pops up twice. From posts on the web I found that the most likely reason that I get this error is because the network is not up before the mounting is tried. Which makes sense when you get the error

mount error(101): Network is unreachable

(look in /var/log/boot.log)


Ubuntu runs the boot scripts in /etc/init. Here I found mountall.conf and mountall-net.conf. Here I found that the order of the scripts is determined by a line in the scripts in the form

start on runlevel [2345] stop on runlevel [!2345]

When I looked in /etc/init/mountall-net I found the line:

start on net-device-up

which suggests that the script waits for the network to be up before the script is run. The other script mountall.conf has the line "start on startup" in it which I think means that this script is called more or less at the beginning when the network indeed may not yet be up. When the network is up (or supposed to be up) mountall-net is called. This explains why I get the mount error twice during booting. While searching the web for "start on net-device-up" I somewhere found the variant


start on (net-device-up IFACE=eth0):

And this appears to make the problem go away (so now I only have one mnt error left during booting (from mountall.conf) but my samba share does get mounted automatically during booting).