Automatically mount some network devices

Hi,

today I'm trying to automatically mount some network devices. But it doesn't work.

Code:
/etc/fstab:

//fausten@kali-files/transfer /usr/home/michael/mount/transfer smbfs rw,-N,-I=192.168.23.225 0 0

Code:
/root/.nsmbrc

[KALI-FILES:FAUSTEN]
password=mypassword
addr=192.168.23.225

Typing mount -a works on the command line, but when I reboot my machine the following error appears:

Code:
mount_smbfs can't set locale

mount_smbfs: smb_lib_init: can't initialise locale

I fixed this by adding following line to /root/.profile:

Code:
export LC_ALL="C"

Now after reboot I get this:

Code:
Mounting late file systems: smb_co_lock: recursive lock for object 1

mount_smbfs: unable to open cennection: syserror = Network is unreachable

Can anyone help?

Regards,

zwei
 
I think the problem is that your system is trying to mount the filesystem together with the other local filesystems, and therefore before the system is started services and, hence, the networking.
I guess the solution is to put your filesystem mounting in a rc script.
 
Hi,

I don't think so at all. Who is responsible for mounting network devices if not the /etc/fstab.
Anyway I tried your suggestion, but it still doesn't work. Error is the same.

Regards,

zwei
 
It must be as fluca said. The error "Network is unreachable" is a bit of a giveaway. Enabling RC debugging might help you troubleshoot. Add to /etc/rc.conf:

Code:
rc_debug=YES

However, have you considered using amd(8) instead of fstab?
 
You can also use the noauto options in /etc/fstab for the smbfs line and then use a simple rc script to mount it after all system is up or go further with automount.
Take a look at the [thread=23105]Excellent Aragon's job around auto mounting[/thread]
 
geodni said:
Take a look at the [thread=23105]Excellent Aragon's job around auto mounting[/thread]
Appreciate the plug, but I don't see the relevance? My work is oriented at hot plugged devices...
 
I'm not sure I can offer much assistance here, but I can say that the smbfs entries in my /etc/fstab do mount properly, without any intervention, once the network is up. Here's one of the shares:

Code:
//adamk@thorn/workarea	/home/adamk/workarea	smbfs rw 0 0

My system does not try to mount /home/adamk/workarea until after networking is available.

EDIT: You haven't changed the netfs_types or extra_netfs_types settings in /etc/defaults/rc.conf or /etc/rc.conf, have you?
 
If it works after startup but not from startup, then maybe the network isn't up yet. We haven't yet seen how the network is configured in /etc/rc.conf. Changing DHCP to SYNCDHCP might be enough.
 
Would it be plausible to create an RC script for this, that requires networking before trying to run the script. I believe that part of the Handbook describes how to do this.
 
Yes, but the rc.d "networking" script can complete before the interface is up and actually connected. SYNCDHCP and the new netwait script are ways to deal with that.
 
Hi guys,

first: thanks a lot for your great and numerous feedback.

@aragon:

I set in /etc/rc.conf

Code:
rc_debug=YES

But that doesn't helped me troubleshooting.

No, i didn't try using amd(8), but i will try this later.

@geodni:

Yes, I tried the noauto option in /etc/fstab but when I do this, mount -a is not working anymore.

@adamk:

I tried, I think for like the 10th time, what you said in #7. Anyway, he can't then find the adress, so I added the -I option in /etc/fstab again, now mount -a works again and while booting the machine he asks for the password. Configured like this I always need to type the password. Good step in the right direction. If i also add the -N option, that he doesn't ask for the password, the error from the beginning appears again :(

No, I havn't set netfs_types or extra_netfs_types in /etc/rc.conf or elsewhere.

@wblock:

my /etc/rc.conf

Code:
hostname="natalie.freeBSD"
ifconfig_re0="DHCP"
keymap="german.iso"
sshd_enable="YES"
mountd_enable="YES"
hald_enable="YES"
dbus_enable="YES"
postgresql_enable="YES"
cupsd_enable="YES"
devfs_system_ruleset="system"
startx_enable="YES"
rc_debug="YES"

You mean this

Code:
ifconfig_re0="DHCP"

to

Code:
ifconfig_re0="SYNCDHCP"

? If yes, doesn't make any difference.

Regards,

zwei
 
Actually, that looks like the correct way to say "-I 192.168.23.225" in an /etc/fstab options entry:
% man mount | less -p'Options that take a value'
 
Hi,

I know, long time ago I was last looking in this thread. But it was just so frustrating for me :D Anyway, because of a new year resolution today i tried again to fix the problem. And fortunately I fixed it. I'm not quiet sure if this is a neat solution, but it works for me:

~/mount.sh

Code:
mount_smbfs -N -I 192.168.23.225 -E utf-8:cp1252 //fausten@[B]KALI-FILES[/B]/transfer /usr/home/michael/mount/transfer

~/.nsmbrc

Code:
[KALI-FILES:FAUSTEN]
password=******
addr=192.168.23.225

I replaced the IP: 192.168.23.225 with "KALI-FILES" and now it works.

Now, if I need the shares, I'm able to mount them by executing the ~/mount.sh as root. This is approximately the solution, I had in mind.

Best regards and thanks for your time.

zwei
 
Back
Top