SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I added 2 lines to my fstab file on my laptop, these are the same that I use on my desktop.
They work perfectly on the desktop, but on the laptop they don't.
I believe fstab runs before the wireless is up and running.
I've looked, and can not find an answer to this.
Is there a way to have a delayed automatic mount?
If you post your fstab others may be able to help.
I looked at the link you provided, and added mount -a (don't know how else to do it) to rc.local
didn't work. I think rc.local is run before the wireless is up.
Quote:
Originally Posted by ysg
You need to add '_netdev' to your cifs options. This will tell your system to not try to mount this until your network is working.
I am not expert in Slack but what about services needed for mounting NFS? Like portmap?
Is this nfs v4 or nfs v3
The OP is using CIFS not NFS however the Slackware boot scripts treat all network file systems the same.
in rc.S
Code:
/sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts
in rc.M (right after rc.inet2 executes but before wicd/networkmanager/bluetouth)
Code:
mount -a -v 2> /dev/null | grep -v "already mounted"
If it's not working if you do this in rc.local then it's likely that the network is coming up in the background and is not blocking the scripts while it comes up.
I looked at the link you provided, and added mount -a (don't know how else to do it) to rc.local
didn't work. I think rc.local is run before the wireless is up.
After login and wireless is up I can run "mount -a" as su and it does work.
A few more thoughts ...
At a minimum in rc.local you should wait before running the mount command (sleep 120; mount ... ). This is crude but if you figure out how long it takes for the wireless to connect then you could wait say 150% of that time then mount each network drive. Make it a long time (5 minutes) to test the concept first.
Better would be to test that the network connection (ping,dig,etc) or any other needed services are operational. Write a simple script to do this in rc.local or run the script from rc.local. After the test is successful then mount the drives individually. See the man pages for mount to learn how to translate the fstab entry to a mount command or just reference the fstab entry with the mount command. (i.e. mount /usr/share/myphotos).
Any script you write can be incorporated elsewhere in the /etc/rc.d cascade other than rc.local if it would work better.
Make sure that files in separately mounted partitions don't reference each other - circular reference. That's always fun on cross mounted servers that have been in production for a long time with lots of changes and no reboots. :-) Probably not your problem however.
The netdev cifs option sounded best. I've never used it. Perhaps it needs to be installed/configured before it will work? Comments on this ysg?
EDIT: I'm a slow typist. Some of this was already mentioned.
Last edited by TracyTiger; 05-26-2012 at 08:13 PM.
Reason: Slow Typist
/sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts
in rc.M (right after rc.inet2 executes but before wicd/networkmanager/bluetouth)
Code:
mount -a -v 2> /dev/null | grep -v "already mounted"
If it's not working if you do this in rc.local then it's likely that the network is coming up in the background and is not blocking the scripts while it comes up.
This seems to be the case.
Quote:
Originally Posted by Tracy Tiger
At a minimum in rc.local you should wait before running the mount command (sleep 120; mount ... )
This does work, however, it creates a delay in boot-up equal to the sleep time given.
Quote:
Originally Posted by Babertje
You could also do it from the desktop's autostart with a script that has a while loop until a successful ping to 192.168.83.240 then mount the volumes
I have no idea how I would go about this one, but, it does sound interesting.
Quote:
Originally Posted by Richard Cranium
You could also use autofs to mount those shares on demand.
This also sounds interesting, I'll look into it...
it creates a delay in boot-up equal to the sleep time given.
To avoid rc.local from stalling, make a script that calls your network stuff like /etc/mymounter.sh
and call this script from /etc/rc.local this
Code:
/etc/mymounter.sh &
mymounter.sh will be running in the background but your rc.local end minus any delay
Example script to be called from /etc/rc.local as above; /etc/nettester.sh &
Code:
#!/bin/bash
# nettester.sh: test runs in loop to MAX = number of TRIES
# or until network responds successfully
NETWORK=0
COUNTER=0
# wait till next loop
SECONDS=2
#stop testing after N times
TRIES=100
# your most faithfull url to hit success all the time
URL=http://www.google.com
until [ $COUNTER -eq "$TRIES" ]
do
let COUNTER=COUNTER+1
GETURL=`curl -vs -o /dev/null $URL 2>&1 |grep -c connected`
if [ $GETURL -eq 1 ]
then
NETWORK=1
if [ $NETWORK -eq 1 ]
then
COUNTER=$TRIES
else
NETWORK=0
fi
else
sleep $SECONDS
fi
done
if [ $NETWORK -eq 1 ]
then
# do your mount stuff here
else
exit 1 # -bailing, had to many tries
fi
To avoid rc.local from stalling, make a script that calls your network stuff like /etc/mymounter.sh
and call this script from /etc/rc.local this
Code:
/etc/mymounter.sh &
mymounter.sh will be running in the background but your rc.local end minus any delay
Example script to be called from /etc/rc.local as above; /etc/nettester.sh &
Code:
#!/bin/bash
# nettester.sh: test runs in loop to MAX = number of TRIES
# or until network responds successfully
NETWORK=0
COUNTER=0
# wait till next loop
SECONDS=2
#stop testing after N times
TRIES=100
# your most faithfull url to hit success all the time
URL=http://www.google.com
until [ $COUNTER -eq "$TRIES" ]
do
let COUNTER=COUNTER+1
GETURL=`curl -vs -o /dev/null $URL 2>&1 |grep -c connected`
if [ $GETURL -eq 1 ]
then
NETWORK=1
if [ $NETWORK -eq 1 ]
then
COUNTER=$TRIES
else
NETWORK=0
fi
else
sleep $SECONDS
fi
done
if [ $NETWORK -eq 1 ]
then
# do your mount stuff here
else
exit 1 # -bailing, had to many tries
fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.