LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-09-2009, 11:17 AM   #1
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Rep: Reputation: 16
cifs not mounting on boot


Hi,

I have a CentOS 5.3 server. I cannot get my cifs share to mount on boot. After the machine is up I can issue a mount /mnt/sql just fine. I tried putting that in rc.local and it still didnt work.

some details:
Code:
//10.0.0.7/share     /mnt/sql                cifs    username=mail,password=xxxxxxxx   0 0
Code:
[root@massmail ~]# chkconfig --list netfs
netfs           0:off   1:off   2:on    3:on    4:on    5:on    6:off
Code:
[root@massmail ~]# service netfs status
Configured CIFS mountpoints: 
/mnt/sql
[root@massmail ~]#
Code:
[root@massmail ~]# ls /mnt/sql
[root@massmail ~]#
Code:
[root@massmail ~]# mount /mnt/sql
[root@massmail ~]# ls /mnt/sql   
news.txt  promos.txt   updates.txt  promos.txt   f.txt
connections.txt   iaap_surveys.txt  op.txt    surveys.txt
only error I can find is:
Code:
[root@massmail ~]# dmesg |grep CIFS
CIFS: Unknown mount option _netdev
 CIFS VFS: Error connecting to IPv4 socket. Aborting operation
 CIFS VFS: cifs_mount failed w/return code = -113
CIFS: Unknown mount option _netdev
 CIFS VFS: Error connecting to IPv4 socket. Aborting operation
 CIFS VFS: cifs_mount failed w/return code = -113
What is the deal? why wont it mount on boot? What does this error mean? My guess is maybe samba is trying to start before the network is up. How can i change the order?

Thanks,
Mitchell
 
Old 06-09-2009, 01:11 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mitchell2345 View Post
My guess is maybe samba is trying to start before the network is up. How can i change the order?
Your guess is correct:
Code:
[user@machine:~]:./errcvt 113
Error 113 is No route to host
The first thing you want to do is to add the "noauto" option to the line in "/etc/fstab". That will prevent the boot time errors from occurring.

The easy way to get it to mount at boot is to add "mount /mnt/sql" to "/etc/rc.local".

The harder way to get it to mount at boot is to write your own custom init script that runs after networking. The proper way to write an init script varies from distro to distro. You can usually find enough examples in your "/etc/init.d" directory to figure out how to write your own.
 
Old 06-09-2009, 01:25 PM   #3
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
forgot to add this to the org. post.

i have tried the rc.local.

Code:
[rsmtech@massmail ~]$ cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
mount /mnt/sql
I added the noauto to the fstab and still no joy.

More suggestions?

Thanks,
Mitchell
 
Old 06-09-2009, 02:14 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mitchell2345 View Post
More suggestions?
Add some debugging to your mount command.
Code:
mount /mnt/sql > /var/log/mntsql.log
You may need to specify the full path to mount (e.g. /bin/mount) because init does not usually have PATH set.
 
Old 06-09-2009, 02:22 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Firstly, don't have the password in /etc/fstab. Use cred= option instead and have it point to a credentials file that only the user can read. Anyone can read /etc/fstab, so the password isn't secret. What version of mount.cifs do you have? I use the _netdev option in /etc/fstab without getting an error.

I'm also not sure if a windows share would be the best for a database server to run on if that is what this share is for, rather than a share of where sql queries are stored. NFS would probably work better.
 
Old 06-09-2009, 07:29 PM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by jschiwal View Post
I use the _netdev option in /etc/fstab without getting an error.
That option is news to me. If it works, it is better than my suggestions.
 
Old 06-10-2009, 08:44 AM   #7
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by David1357 View Post
That option is news to me. If it works, it is better than my suggestions.
when i put that in it ignores it. in the logs it says it doesnt know what it is.

Mitchell
 
Old 06-10-2009, 09:35 AM   #8
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mitchell2345 View Post
when i put that in it ignores it. in the logs it says it doesn't know what it is.
What happened when you added debugging to your "mount" command in "rc.local"? Did you add the full path to "mount"?
 
Old 06-10-2009, 11:30 AM   #9
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by David1357 View Post
What happened when you added debugging to your "mount" command in "rc.local"? Did you add the full path to "mount"?
[rsmtech@massmail ~]$ cat mount.log
mount error 113 = No route to host
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

how do i find what version of mount.cifs I have?
 
Old 06-10-2009, 01:40 PM   #10
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mitchell2345 View Post
[rsmtech@massmail ~]$ cat mount.log
mount error 113 = No route to host
You are still trying to mount the share before the network connection is completely functional.

Is your network connection through a wireless interface? If so, you have to wait for the authentication to complete. Frequently with wireless connections, the computer can fully believe the "network" is up and running before the "connection" is completely up and running.

You might want to put something like this before the mount command:
Code:
while ! ping -c 1 10.0.0.7 ;
do
    sleep 1 ;
done
/bin/mount /mnt/sql
You might have to tweak the "ping" parameters to get the command right. I am writing this without testing it.

Quote:
Originally Posted by mitchell2345 View Post
How do i find what version of mount.cifs I have?
Good question. My "mount.cifs" command prints this as part of the usage:
Code:
To display the version number of the mount helper:
        mount.cifs -V
However, running "mount.cifs -V" only causes the usage to be printed again.
 
Old 06-10-2009, 02:47 PM   #11
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
ill try adding the if statement. no its not on a wireless connection.
 
Old 06-10-2009, 03:24 PM   #12
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
AFAIK, the _netdev fstab option entry allows the bootup scripts to use -o no_netdev to mount non-network filesystems before the network is ready, or the -o _netdev option in a mount command to mount entries with the _netdev option.

Check the manpage for the mount command and see if the _netdev option exists. It has been around for quit a while. I don't understand why you wouldn't have it.

A boot up script should be able to use the _netdev or no_netdev options to mount. This would enable you to mount network filesystems without needing to explicitly list them in the script. e.g. mount -a -o _netdev
 
Old 06-11-2009, 04:56 PM   #13
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
Thumbs up

Quote:
Originally Posted by David1357 View Post
You might want to put something like this before the mount command:
Code:
while ! ping -c 1 10.0.0.7 ;
do
    sleep 1 ;
done
/bin/mount /mnt/sql
You might have to tweak the "ping" parameters to get the command right.
YAY adding that if statement worked like a charm.

Thanks!
Mitchell
 
Old 06-12-2009, 09:51 AM   #14
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mitchell2345 View Post
YAY adding that if statement worked like a charm.
I am glad it worked. You may want to put a counter in there to make sure that the while loop does not run forever (e.g. you are booting your machine while not connected to the network). Here is some sample script code:
Code:
#!/bin/bash
COUNTER=0
while true ;
do
    echo "COUNTER = ${COUNTER}"
    ((COUNTER++))
    if (( COUNTER >= 10 )) ; then
        echo "Counter limit reached.  Exiting..."
        exit 1 ;
    fi
done
 
Old 06-12-2009, 02:45 PM   #15
pepsimachine15
Member
 
Registered: Jun 2008
Posts: 122

Rep: Reputation: 16
if you want this to work from your fstab, try changing the 0 0 at the end to 0 1, like such:

Code:
//10.0.0.7/share     /mnt/sql                cifs    username=mail,password=xxxxxxxx   0 1
sometimes this will help, i believe the 1 at the end will tell fstab to retry the mount again later at the end of boot, possibly after your net starts.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting CIFS with write permissions alkos333 Slackware 5 03-02-2012 12:16 PM
Mounting cifs qns khaos83 Suse/Novell 2 06-08-2008 09:47 PM
Problem with mounting CIFS from /etc/fstab Rostfrei Linux - Networking 6 06-03-2008 02:47 PM
Mounting CIFS file systems at boot with Slackware 12.0 allend Slackware 6 10-09-2007 03:32 PM
CIFS Mounting Problem victorhe Linux - Networking 0 03-29-2004 12:49 PM


All times are GMT -5. The time now is 06:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration