From owner-freebsd-questions@FreeBSD.ORG Thu Sep 2 13:29:08 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D3FA10656EA for ; Thu, 2 Sep 2010 13:29:08 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 2EBB98FC1A for ; Thu, 2 Sep 2010 13:29:08 +0000 (UTC) Received: from r55.edvax.de (port-92-195-157-147.dynamic.qsc.de [92.195.157.147]) by mx01.qsc.de (Postfix) with ESMTP id 3E8F43CC36; Thu, 2 Sep 2010 15:29:05 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id o82DT5wd001538; Thu, 2 Sep 2010 15:29:05 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 2 Sep 2010 15:29:05 +0200 From: Polytropon To: Bernard Scharp Message-Id: <20100902152905.905caea1.freebsd@edvax.de> In-Reply-To: <4C7F925B.9010807@itsacon.net> References: <4C7F5F25.2010604@itsacon.net> <20100902075053.4bdb443b@scorpio> <4C7F925B.9010807@itsacon.net> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Multiple mount_smbfs commands fail in bash script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 13:29:08 -0000 On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp wrote: > > > > > Could you post the script? Anything else would be pure guess work. You > > Well, I can recreate it with something as simple as: > > #!/usr/local/bin/bash > mount_smbfs //user@remotehost/share1/ /tmp/mnt/ > mount_smbfs //user@remotehost/share2/ /tmp/mnt2/ Excuse me, it may just be a stupid question... but... why do you use bash for this purpose? Do you require any special bash feature that cannot be done using the standard shell, sh? I often see the urge to use bash for scripting as a typical "Linuxism", which is usually non-portable (if that was your goal). FreeBSD's standard scripting shell is sh, so why not use it until you reach the ends of its functionality? Just a guess, regarding your initial question, as I don't have experience with "Windows" related things: Did you have the chance to monitor correct operations of your script in the past? Did the mound and umount (!) calls work properly? Have you checked your commands running them in the standard dialog shell (csh)? I assume you're running them as root (or at least with sufficient permissions), so I don't think the problem is there, as the error message mount_smbfs: can't get handle to requester (no /dev/nsmb* device) doesn't look like refering to that problem. The error message originates from /usr/src/contrib/smbfs/lib/smb/ctx.c; having a look around, and remembering that you said > [...] there are (by last count) 1170 /dev/nsmb* devices > in /dev/ (is that normal?) I found smb_ctx_gethandle() near line 600 (version 7 OS here): /* * well, no clone capabilities available - we have to scan * all devices in order to get free one */ for (i = 0; i < 1024; i++) { snprintf(buf, sizeof(buf), "/dev/%s%d", NSMB_NAME, i); fd = open(buf, O_RDWR); if (fd >= 0) { ctx->ct_fd = fd; return 0; } } The limit seems to be 1024, if I read that correctly - allthough I'm considered a "C hacker", I'm no "OS-level C hacker". :-) Afterwards, smb_ctx_lookup() fails and gives the error message mentioned earlier. Remove the /dev/nsmb* devices and try again. Make sure no other SMB stuff is currently mounted, just to be sure, as I don't have any idea what could fail. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...