LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-16-2013, 01:28 AM   #1
chantk
LQ Newbie
 
Registered: Sep 2008
Distribution: Slackware, FreeBSD
Posts: 11

Rep: Reputation: 0
autofs started too early in rc.M?


I took the auto.smb from CentOS 6.2 and modified it slightly to cater for my Win 7 env at work. Same script, works on CentOS by visiting /smb/<host>/<share>. On Slackware 14, it doesn't work UNTIL autofs is restarted manually after bootup. And from then on, it just works like a charm.

I think the issue lies in autofs being started too early in rc.M? Has anyone seen this problem before?

Another thing is, the script can't handle default shares well, e.g. C$. Anyone's got a solution on this?


Code:
#!/bin/bash

# This file must be executable to work! chmod 755!

key="$1"
credfile="${HOME}/.auto.smb.$USER"

[ "x$GROUP" == "x" ] || grpopt=",gid=$GROUP"
opts="-fstype=cifs,nosuid,file_mode=0664,dir_mode=0775,uid=$USER,sec=ntlm"$grpopt

for P in /bin /sbin /usr/bin /usr/sbin
do
        if [ -x $P/smbclient ]
        then
                SMBCLIENT=$P/smbclient
                break
        fi
done

[ -x $SMBCLIENT ] || exit 1

if [ -e "$credfile" ]; then
        opts=$opts",credentials=$credfile"
        smbclientopts="-d 2 -A "$credfile
else
        smbclientopts="-N"
fi

$SMBCLIENT $smbclientopts -gL $key 2>/dev/null \
        | awk -v key="$key" -v opts="$opts" -F'|' -- '
        BEGIN   { ORS=""; first=1 }
        /Disk/  {
                  if (first)
                        print opts; first=0
                  dir = $2
                  loc = $2
                  # Enclose mount dir and location in quotes
                  # Double quote "$" in location as it is special
                  gsub(/\$$/, "\\$", loc);
                  gsub(/\&/,"\\\\&",loc)
                  print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
                }
        END     { if (!first) print "\n"; else exit 1 }
        '
 
Old 04-16-2013, 06:57 AM   #2
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 14.1 64 Multi-Lib
Posts: 435

Rep: Reputation: 138Reputation: 138
It starts before wicd or networkmanager. But even so, I thought it only mounted drives or points when needed. So, until you have someone or something actively trying to access a file on an autofs moount, it really should make no difference. Having said that though, it will be trivial to cut+paste the code and move it lower down and see how it goes. That's the great thing about Slackware - you can fiddle. Please report back on your findings. If you're right, I guess it will be moved down "officially".
 
Old 04-19-2013, 05:59 AM   #3
chantk
LQ Newbie
 
Registered: Sep 2008
Distribution: Slackware, FreeBSD
Posts: 11

Original Poster
Rep: Reputation: 0
I've moved the autofs section all the way down to right before rc.local. Still no avail. I'll keep poking around and report my progress.
 
Old 04-19-2013, 01:03 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,519

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
What is in your /etc/auto.master file?
 
Old 04-19-2013, 03:10 PM   #5
chantk
LQ Newbie
 
Registered: Sep 2008
Distribution: Slackware, FreeBSD
Posts: 11

Original Poster
Rep: Reputation: 0
A /smb line like /misc.

Code:
/misc   /etc/auto.misc
/smb    /etc/auto.smb
/net    -hosts
+auto.master
/etc/auto.smb is executable.

I also did the following. (forgot where I read it). I can confirm it's necessary. In case you want to replicate it.
Code:
chmod 4755 /sbin/mount.cifs
cp /usr/doc/samba-3.6.8/examples/scripts/mount/mount.smbfs /bin
chmod +x /bin/mount.smbfs
 
Old 04-19-2013, 10:10 PM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,519

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hmm. I kinda wonder if it's really necessary to make /sbin/mount.cifs suid, but that has no bearing that I can tell about your reported problem.

How about editing /etc/default/autofs and changing the LOGGING value to "verbose" or "debug" to see what's going on?
 
Old 04-24-2013, 11:04 AM   #7
chantk
LQ Newbie
 
Registered: Sep 2008
Distribution: Slackware, FreeBSD
Posts: 11

Original Poster
Rep: Reputation: 0
Richard, you're right. I removed the suid bit on /sbin/mount.cifs and it still works. So suid is totally unnecessary.

Here's the syslog with LOGGING="-v -d" in /etc/default/autofs immediately after bootup.

Code:
Apr 24 23:54:02 darkstar automount[2060]: lookup_nss_read_master: reading master files auto.master
Apr 24 23:54:02 darkstar automount[2060]: parse_init: parse(sun): init gathered global options: (null)
Apr 24 23:54:02 darkstar automount[2060]: lookup_read_master: lookup(file): read entry /misc
Apr 24 23:54:02 darkstar automount[2060]: lookup_read_master: lookup(file): read entry /smb
Apr 24 23:54:02 darkstar automount[2060]: lookup_read_master: lookup(file): read entry /net
Apr 24 23:54:02 darkstar automount[2060]: lookup_read_master: lookup(file): read entry +auto.master
Apr 24 23:54:02 darkstar automount[2060]: lookup_nss_read_master: reading master files auto.master
Apr 24 23:54:02 darkstar automount[2060]: parse_init: parse(sun): init gathered global options: (null)
Apr 24 23:54:02 darkstar automount[2060]: lookup(file): failed to read included master map auto.master
Apr 24 23:54:02 darkstar automount[2060]: master_do_mount: mounting /misc
Apr 24 23:54:02 darkstar automount[2060]: automount_path_to_fifo: fifo name /var/run/autofs.fifo-misc
Apr 24 23:54:02 darkstar automount[2060]: lookup_nss_read_map: reading map file /etc/auto.misc
Apr 24 23:54:02 darkstar automount[2060]: parse_init: parse(sun): init gathered global options: (null)
Apr 24 23:54:02 darkstar automount[2060]: st_ready: st_ready(): state = 0 path /misc
Apr 24 23:54:02 darkstar automount[2060]: master_do_mount: mounting /smb
Apr 24 23:54:02 darkstar automount[2060]: automount_path_to_fifo: fifo name /var/run/autofs.fifo-smb
Apr 24 23:54:02 darkstar automount[2060]: lookup_nss_read_map: reading map file /etc/auto.smb
Apr 24 23:54:02 darkstar automount[2060]: parse_init: parse(sun): init gathered global options: (null)
Apr 24 23:54:02 darkstar automount[2060]: st_ready: st_ready(): state = 0 path /smb
Apr 24 23:54:02 darkstar automount[2060]: master_do_mount: mounting /net
Apr 24 23:54:02 darkstar automount[2060]: automount_path_to_fifo: fifo name /var/run/autofs.fifo-net
Apr 24 23:54:02 darkstar automount[2060]: lookup_nss_read_map: reading map hosts (null)
Apr 24 23:54:02 darkstar automount[2060]: parse_init: parse(sun): init gathered global options: (null)
Apr 24 23:54:02 darkstar automount[2060]: st_ready: st_ready(): state = 0 path /net
Apr 24 23:55:47 darkstar automount[2060]: handle_packet: type = 3
Apr 24 23:55:47 darkstar automount[2060]: handle_packet_missing_indirect: token 1, name nma-bk01, request pid 2184
Apr 24 23:55:47 darkstar automount[2060]: lookup_mount: lookup(program): looking up nma-bk01
Apr 24 23:55:48 darkstar automount[2060]: dev_ioctl_send_fail: token = 1
Apr 24 23:56:01 darkstar automount[2060]: st_expire: state 1 path /misc
Apr 24 23:56:01 darkstar automount[2060]: expire_proc: exp_proc = 3045063488 path /misc
Apr 24 23:56:01 darkstar automount[2060]: expire_cleanup: got thid 3045063488 path /misc stat 0
Apr 24 23:56:01 darkstar automount[2060]: expire_cleanup: sigchld: exp 3045063488 finished, switching from 2 to 1
Apr 24 23:56:01 darkstar automount[2060]: st_ready: st_ready(): state = 2 path /misc

And it spit out these when I do "ls -l /smb/nma-bk01" the first time.

Code:
Apr 25 00:00:02 darkstar automount[2060]: st_expire: state 1 path /smb
Apr 25 00:00:02 darkstar automount[2060]: expire_proc: exp_proc = 3045063488 path /smb
Apr 25 00:00:02 darkstar automount[2060]: expire_cleanup: got thid 3045063488 path /smb stat 0
Apr 25 00:00:02 darkstar automount[2060]: expire_cleanup: sigchld: exp 3045063488 finished, switching from 2 to 1
Apr 25 00:00:02 darkstar automount[2060]: st_ready: st_ready(): state = 2 path /smb
Apr 25 00:00:49 darkstar automount[2060]: handle_packet: type = 3
Apr 25 00:00:49 darkstar automount[2060]: handle_packet_missing_indirect: token 6, name nma-bk01, request pid 2234
Apr 25 00:00:49 darkstar automount[2060]: lookup_mount: lookup(program): looking up nma-bk01
Apr 25 00:00:49 darkstar automount[2060]: dev_ioctl_send_fail: token = 6
Apr 25 00:01:01 darkstar automount[2060]: st_expire: state 1 path /misc
Apr 25 00:01:01 darkstar automount[2060]: expire_proc: exp_proc = 3045063488 path /misc
Apr 25 00:01:01 darkstar automount[2060]: expire_cleanup: got thid 3045063488 path /misc stat 0
Apr 25 00:01:01 darkstar automount[2060]: expire_cleanup: sigchld: exp 3045063488 finished, switching from 2 to 1
Apr 25 00:01:01 darkstar automount[2060]: st_ready: st_ready(): state = 2 path /misc
 
Old 04-24-2013, 10:22 PM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,519

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
You might have to look in /var/log/debug too, although the stuff you posted certainly seems verbose enough.

What is the output of...
Code:
ls -lart /var/run
...?
 
Old 04-26-2013, 09:45 AM   #9
chantk
LQ Newbie
 
Registered: Sep 2008
Distribution: Slackware, FreeBSD
Posts: 11

Original Poster
Rep: Reputation: 0
Nothing special about /var/run

Code:
chantk@darkstar:~> ls -la /var/run
---------- 1 root root    5 Apr 24 23:54 /var/run/autofs-running
prw------- 1 root root    0 Apr 24 23:54 /var/run/autofs.fifo-misc
prw------- 1 root root    0 Apr 24 23:54 /var/run/autofs.fifo-net
prw------- 1 root root    0 Apr 24 23:54 /var/run/autofs.fifo-smb

/var/run/autofs:
total 0
chantk@darkstar:~>
 
  


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
[SOLVED] No sound in KDE when started by startx while working fine when started by kdm/gdm arj1singh Ubuntu 2 12-14-2010 11:55 AM
Firefox 3.5: An Early Look DragonSlayer48DX Linux - News 0 05-27-2009 04:02 PM
Started nautilus as root....problems started Chaosbringer Suse/Novell 0 11-05-2008 03:00 AM
early 90's spam acid_kewpie General 1 01-20-2008 04:35 PM
Setup freezes very early on Wik Mandriva 0 07-08-2004 01:07 PM


All times are GMT -5. The time now is 07:13 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