LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-15-2005, 03:51 AM   #1
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
nfs: fstab will not mount at boot


Hello,
I have a small network of two linux computers.
I can ping and ssh: It works very well.
I have nfs running, and I would like to mount the other computer's filesystem.
I have this line in /etc/fstab :

p4.home.net:/ /mnt/nfs-p4 nfs rw,hard,intr,rsize=8192,wsize=8192 0 0

Which I hoped would mount the p4.home.net root partition at boot, but it does not.

If I type mount p4.home.net:/ as root, the remote filesystem is mounted correctly.

Why doesn't this happen automatically?
 
Old 05-15-2005, 08:49 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Before mounting manually.. what do your logs tell you after bootup? Always check your logs, they usually will tell you everything you need to know.
 
Old 05-15-2005, 09:49 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Original Poster
Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks for your reply.

I did check the logs, and have now rechecked them: No obvious complaints visible in either /var/log/messages or from dmesg, except for "xinetd[2158]: warning: can't get client address: Transport endpoint is not connected". Is this relevant? If you like, I'll post the files, but they are quite l-o-n-g!

Looking at both the above, it seems to me that it is mounting my local partitions before it is finding my network card, loading the module for it, and starting up the network. Maybe whatever it is that runs through fstab and mounts things doesn't mount the network drive as the network isn't up by then? But nothing is complaining, and when I mount the networked drive manually, it just mounts as it should.

It is the MDK9.1 2.4 kernel machine that is badly behaved, the MDK10.1 2.6 kernel machine behaves as expected and mounts the other computer's drives at boot time. I don't suppose it should be a problem to have both PCs being both nfs servers and clients?

Any other ideas?
 
Old 05-15-2005, 10:25 AM   #4
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
Quote:
Looking at both the above, it seems to me that it is mounting my local partitions before it is finding my network card, loading the module for it, and starting up the network. Maybe whatever it is that runs through fstab and mounts things doesn't mount the network drive as the network isn't up by then?
I think you have found the problem: You can't mount NFS filesystems before the hardware is initialized. On my SUSE system, this is solved by a runlevel script that runs after network initialization. I can post script if you don't find something similar on your system.
 
Old 05-15-2005, 10:41 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Original Poster
Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks abisko00,

I thought that maybe I had done something wrong. I'll just put the mount commands at the end of rc.local and that should sort it out.
 
Old 06-13-2005, 08:10 AM   #6
swan2925
Member
 
Registered: Apr 2005
Posts: 37

Rep: Reputation: 15
Quote:
Originally posted by abisko00
I think you have found the problem: You can't mount NFS filesystems before the hardware is initialized. On my SUSE system, this is solved by a runlevel script that runs after network initialization. I can post script if you don't find something similar on your system.
I am now getting exactly the same problem as tredegar, I am using a Red Hat 9 system.

I can mount the nfs filesystem with mount -t nfs.... command, but not in fstab.
I believe the hardware isn't initialized when the system trying to mount the nfs filesystem.

Would you mind shairing your runlevel script to us?
(I don't want to mount the nfs filesystem with rc.local...)

Thanks!!
 
Old 06-13-2005, 11:03 AM   #7
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
SUSE may have a different structure than RH9, so you probably need to adjust the script:
Code:
#! /bin/bash
# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Florian La Roche, 1996
#      Werner Fink <werner@suse.de>, 1996
#      Burchard Steinbild, 1996
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/nfs
#
### BEGIN INIT INFO
# Provides:       nfs
# Required-Start: $network $portmap
# Required-Stop:
# X-UnitedLinux-Should-Start:
# X-UnitedLinux-Should-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    Imports remote Network File Systems (NFS)
### END INIT INFO

. /etc/rc.status

nfs=no
while read  where what type options rest  ; do
    case "$where" in
	\#*|"") ;;
	*) if test "$type" = "nfs" ; then
		nfs=yes
		break
	   fi ;;
    esac
done < /etc/fstab

rc_reset
case "$1" in
    start|reload)
	echo -n "Importing Net File System (NFS)"
	if test "$nfs" = yes ; then
	# Mount all auto NFS devices (-> nfs(5) and mount(8) )
	#  NFS-Server sometime not reachable during boot phase.
	#  It's sometime usefull to mount NFS devices in
	#  background with an ampersand (&) and a sleep time of
	#  two or more seconds, e.g:
	#  
	#   sleep 2 && mount -at nfs &
	#   sleep 2 
	#  
	#  Note: Some people importing the /usr partition.
	#        Therefore we do _NOT_ use an ampersand!
	#
	  mount -at nfs
	  rc_status
	  sleep 1
	#
    	# generate new list of available shared libraries
	#
	  ldconfig -X 2>/dev/null
	  rc_status -v
	else
	  rc_status -u
	fi
	;;
    stop)
	echo -n "Remove Net File System (NFS)"
	if test "$nfs" = "yes" ; then
	  #
	  # Unmount in background because during long timeouts
	  #
	  umount -at nfs &
	  sleep 2
	  rc_status -v
	else
	  rc_status -u
	fi
	;;
    restart|force-reload)
        ## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	$0 start
	rc_status
	;;
    status)
	echo -n "Checking for mounted nfs shares (from /etc/fstab):"
	if test "$nfs" = "yes" ; then
	  while read  where what type options rest  ; do
	    case "$where" in
	      \#*|"") ;;
	      *) case "$options" in
		   *noauto*) ;;
		   *) if test "$type" = "nfs" ; then
			grep -q "$where $what nfs" /proc/mounts || rc_failed 3
		      fi ;;
		 esac
	    esac
          done < /etc/fstab
        else
	  rc_failed 3
	fi
        rc_status -v
	;;
    try-restart|condrestart)
	$0 status
	if test $? = 0; then
	    $0 restart
	else
	    rc_reset
	fi
	rc_status
	;;
    *)
	echo "Usage: $0 {start|stop|status|reload|force-reload|restart|try-restart}"
	exit 1
esac
rc_exit
Good luck!
 
Old 02-11-2008, 09:00 PM   #8
erskie
LQ Newbie
 
Registered: Feb 2008
Distribution: Kubuntu
Posts: 6

Rep: Reputation: 0
A similar problem ...

Dear All,

Apologies if I am missing important details - I am very new at this.

I am trying to mount a windows network share on boot, with little luck. Mounting manually (with mount -t) works fine, so I added a line to fstab. Forcing a remount with mount -a also works fine (although there is an odd error "[mntent]: warning: no final newline at the end of /etc/fstab")

However, when I reboot, the network share does not mount.

I tried adding "sudo mount -a" to rc.local, but no improvement.

Oddly, I was intending to use smb4k, but although the "remount on restart" option was selected, it also failed on reboot!

I like the explanation of not being able to mount until the network has started up, but that does not explain the failure of rc.local, right?

If nothing else, could someone please advise on what logs to check for messages?

Thank you in advance for your help!


----------------------------

Oops - I see I have this in the wrong forum. My apologies - please delete.

Last edited by erskie; 02-11-2008 at 09:37 PM.
 
Old 02-12-2008, 02:37 AM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Original Poster
Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
(although there is an odd error "[mntent]: warning: no final newline at the end of /etc/fstab")
That error means exactly what it says, that fstab should end with a <Return>, but it's not fatal. Just add a blank like at the end of fstab to get rid of that error.
Quote:
I tried adding "sudo mount -a" to rc.local, but no improvement.
rc.local is run as root, so you do not need the sudo
You say you can mount your network drive with mount -t blah blah blah, so I'd suggest you just put that mount command at the end of rc.local and it'll probably work for you.
And welcome to LQ
 
Old 02-12-2008, 07:10 AM   #10
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello,

Don't add the 'mount -a' option to /etc/rc.local. Add the full 'mount' command to /etc/rc.local ... ie.. mount -t nfs /source /destination'.

Thanks,

Vimal Kumar
 
Old 02-12-2008, 05:27 PM   #11
Loosewheel
LQ Newbie
 
Registered: Jan 2006
Location: Montana
Distribution: PCLinuxOS-2007
Posts: 24

Rep: Reputation: 15
Hi everyone,

I've had the same problem with my nfs shares not mounting at boot. (Had to manually mount).
In looking at /var/log/messages I found "link beat not detected". The NIC was working though. I could browse the internet.

I disabled my MCP51 ethernet controller, (Nvidia using the forcedeth module), and fired up my ADM983 Linksys card with tulip....Rebooted, and the nfs share was sitting on the desktop.
 
Old 02-12-2008, 06:38 PM   #12
erskie
LQ Newbie
 
Registered: Feb 2008
Distribution: Kubuntu
Posts: 6

Rep: Reputation: 0
Thank you all for the quick response, and the welcome!

True to form I did find the solution, much later last night. I did not end up needing to modify rc.local, although I am sure the proposed solution above would have worked.

The (for me) ideal solution was found elsewhere in the forum. The suggestion was to use the _netdev modifier in the fstab statement. This forces the mount operation to wait until the network connection is up and running. It worked a charm.

For future noob (like me!) reference the correct use is:

//wherever/blah /somewhere/blah cifs guest,_netdev,uid=1000,iocharset=utf8,codepage=unicode,unicode 0 0

Yes, I know the guest authentication sucks, but this is for a windows share which defaults to no authentication required, and all of this is behind a firewall so I am not too worried. As my bravery increases I may fix it later.

Thank you all again. I am VERY sure I will be back!!!!
 
Old 03-30-2008, 07:28 PM   #13
Mountain
Member
 
Registered: Nov 2007
Location: A place with no mountains
Distribution: Kubuntu, sidux, openSUSE
Posts: 214

Rep: Reputation: 41
I am having a similar problem with being able to mount nfs shares manually but not via fstab. For me, it isn't an issue related to hardware initialization. I'm not sure what the problem is, but you can see my full description here:
http://www.linuxquestions.org/questi...y-help-631772/
 
Old 08-13-2013, 08:43 AM   #14
MeeLee
Member
 
Registered: Aug 2009
Posts: 48

Rep: Reputation: 3
I've got a similar problem, but I don't think it's because of the service start up order.

I have tried delaying the mount via rc.local (well /etc/rc3.d/S99local which roues there) and still no joy.

I've ried two different ways of delaying the mount:

1) mount -t //share/ etc. in S99Local
2) at now + 3 minutes < /scrips/<scriptWithMountCommand>

Neither have worked.

BUT, when I go to login and run the mount command immediately it works.

I think it's some kind of permissions thing here.

I am mounting a share on one network that it is not a domain member of to a share is then accessible to another completely separate network (via a separate network interface). The server has joined the domain of the latter and once it's mounted the share it then maps AD users from that domain to the share.


What makes me think this is a permissions thing is that the mount partially works after a reboot.

After a reboot if you log into the local server you can see the share has been successfully assigned to the AD group that is on the domain it is a member of, but the share is empty. It's like it mounts the share, assigns it to the correct user group but then can't pull the contents of the share in.

When I try looking at the logs when a user tried to access the share after it has been partially mounted you can see that it knows to map the users to their particular part of the share as errors when trying to get at that part of the share.


I am very stuck trying to work out what it would be.


Has anyone got any experience with this type of setup? I run iptables and selinux but have tried this with both off and still the same error.
I'm mapping users via the UNIX attributes of AD. Like I say all works straight away when you are logged in as root and run the mount command.

Last edited by MeeLee; 08-13-2013 at 08:46 AM.
 
Old 08-13-2013, 09:25 AM   #15
MeeLee
Member
 
Registered: Aug 2009
Posts: 48

Rep: Reputation: 3
Quote:
Originally Posted by MeeLee View Post
I've got a similar problem, but I don't think it's because of the service start up order.

I have tried delaying the mount via rc.local (well /etc/rc3.d/S99local which roues there) and still no joy.

I've ried two different ways of delaying the mount:

1) mount -t //share/ etc. in S99Local
2) at now + 3 minutes < /scrips/<scriptWithMountCommand>

Neither have worked.

BUT, when I go to login and run the mount command immediately it works.

I think it's some kind of permissions thing here.

I am mounting a share on one network that it is not a domain member of to a share is then accessible to another completely separate network (via a separate network interface). The server has joined the domain of the latter and once it's mounted the share it then maps AD users from that domain to the share.


What makes me think this is a permissions thing is that the mount partially works after a reboot.

After a reboot if you log into the local server you can see the share has been successfully assigned to the AD group that is on the domain it is a member of, but the share is empty. It's like it mounts the share, assigns it to the correct user group but then can't pull the contents of the share in.

When I try looking at the logs when a user tried to access the share after it has been partially mounted you can see that it knows to map the users to their particular part of the share as errors when trying to get at that part of the share.


I am very stuck trying to work out what it would be.


Has anyone got any experience with this type of setup? I run iptables and selinux but have tried this with both off and still the same error.
I'm mapping users via the UNIX attributes of AD. Like I say all works straight away when you are logged in as root and run the mount command.
...So I've now just tried mounting the share without the part that does the user mapping and it's still an issue. /var/log/messages reports:

CIFS VFS cifs_mount failed w/return code = -13

...so It's nothing to do with the user mapping part. Again, If I then try the mount when logged into the local server it works fine. Does anyone know wha this means? I've had a quick search but couldn't find anything specific enough.

Thanks.
 
  


Reply



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
NFS mount in /etc/fstab ? cozye Linux - General 3 09-12-2014 03:48 PM
Why a FSTAB entry will mount using -a switch but will not mount automatically at boot mjen Linux - Newbie 3 05-19-2004 07:45 AM
nfs mount with fstab vs autofs rrich100 Linux - Networking 2 11-13-2003 10:21 PM
how do I mount with nfs in fstab? Falafel Linux - Networking 1 11-13-2003 12:56 PM
put NFS into fstab and now it won't boot Misel Slackware 2 03-17-2003 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration