Not correctly mount SMB shares ending in $
Hi
I recently upgraded to Fedora 9 and autofs-5.0.3-15.i386.
I use SMB shares ending in $ quite often and have noticed that in this release they are broken.
They are mounting in the wrong place. Contrast the 2 shares below, one the C share, the other the C$ share. The wrong slash is in the remote service name
Autofs mounted:
//xp0/C on /smb/xp0/C type cifs (rw,mand) <--- this one
workes ok
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand) <----- this one is
broken
Manually mounted and working:
//xp0/C$ on /mnt type cifs (rw,mand)
Ian Kent
maintainerQuoted 9 lines · Matthew Jurgens
Hi
I recently upgraded to Fedora 9 and autofs-5.0.3-15.i386.
I use SMB shares ending in $ quite often and have noticed that in this release they are broken.
They are mounting in the wrong place. Contrast the 2 shares below, one the C share, the other the C$ share. The wrong slash is in the remote service name
Quoted 8 lines
Autofs mounted:
//xp0/C on /smb/xp0/C type cifs (rw,mand) <--- this one
workes ok
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand) <----- this one is
brokenManually mounted and working:
//xp0/C$ on /mnt type cifs (rw,mand)
Can you post the output of the program map please. That's probably "sh /etc/auto.smb <server name>".
Ian
That's interesting. Identical output from a working and the failing host.
From a working host:
-fstype=cifs,username=USER,password=PASSWORD \
/C "://xp0/C" \
/ADMIN\$ "://xp0/ADMIN\$" \
/C\$ "://xp0/C\$"From the failing 5.0.3 host:
-fstype=cifs,username=USER,password=PASSWORD \
/C "://xp0/C" \
/ADMIN\$ "://xp0/ADMIN\$" \
/C\$ "://xp0/C\$"Quoted 8 lines · Ian Kent
Can you post the output of the program map please. That's probably "sh
/etc/auto.smb<server name>".Ian
Ian Kent
maintainerQuoted 5 lines · Matthew Jurgens
That's interesting. Identical output from a working and the failing host.
From a working host:
(quoted diff) +0
-1-fstype=cifs,username=USER,password=PASSWORD \
Review
Quoted 10 lines
(quoted diff) +0
-1/C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$" From the failing 5.0.3 host: -fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$"
That doesn't look quite right.
It might be an out of date script, how about posting the script as well.
Quoted 10 lines
Quoted 8 lines · Ian Kent
Can you post the output of the program map please. That's probably "sh
/etc/auto.smb<server name>".Ian
Ok, so I updated the script to the RPM version and added the authentication parts:
#!/bin/bash
# This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"
smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOT
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
$SMBCLIENT -A $smbauthfile -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);
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
}
END { if (!first) print "\n"; else exit 1 }
'Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \
"/C" "://xp0/C" \
"/ADMIN$" "://xp0/ADMIN\$" \
"/C$" "://xp0/C\$"vs the older output
-fstype=cifs,username=USER,password=PASSWORD \
/C "://xp0/C" \
/ADMIN\$ "://xp0/ADMIN\$" \
/C\$ "://xp0/C\$"mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)
Quoted 5 lines
That doesn't look quite right.
It might be an out of date script, how about posting the script as well
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerQuoted 2 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
Right, the reason the script changed was because of the "$" shares. I thought it was working ok but maybe a subsequent change to the daemon has broken it.
I'll try to duplicate the problem here but a debug log would also be useful. See http://people.redhat.com/jmoyer for details.
Quoted 63 lines
#!/bin/bash
# This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"
smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOTfor P in /bin /sbin
/usr/bin/usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -A $smbauthfile -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); print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } 'Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \ "/C" "://xp0/C" \ "/ADMIN$" "://xp0/ADMIN\$" \ "/C$" "://xp0/C\$"vs the older output
-fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$"mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)Quoted 5 lines
That doesn't look quite right.
It might be an out of date script, how about posting the script as well
Debug Log:
Sep 16 01:03:11 tempgw automount[17954]: st_expire: state 1 path /misc
Sep 16 01:03:11 tempgw automount[17954]: expire_proc: exp_proc = 3083123600 path /misc
Sep 16 01:03:11 tempgw automount[17954]: expire_cleanup: got thid 3083123600 path /misc stat 0
Sep 16 01:03:11 tempgw automount[17954]: expire_cleanup: sigchld: exp 3083123600 finished, switching from 2 to 1
Sep 16 01:03:11 tempgw automount[17954]: st_ready: st_ready(): state = 2 path /misc
Sep 16 01:03:12 tempgw automount[17954]: st_expire: state 1 path /misc
Sep 16 01:03:12 tempgw automount[17954]: expire_proc: exp_proc = 3083123600 path /misc
Sep 16 01:03:12 tempgw automount[17954]: expire_cleanup: got thid 3083123600 path /misc stat 0
Sep 16 01:03:12 tempgw automount[17954]: expire_cleanup: sigchld: exp 3083123600 finished, switching from 2 to 1
Sep 16 01:03:12 tempgw automount[17954]: st_ready: st_ready(): state = 2 path /misc
Sep 16 01:03:12 tempgw automount[17954]: handle_packet: type = 3
Sep 16 01:03:12 tempgw automount[17954]: handle_packet_missing_indirect: token 344, name xp0, request pid 17592
Sep 16 01:03:12 tempgw automount[17954]: attempting to mount entry /smb/xp0
Sep 16 01:03:12 tempgw automount[17954]: lookup_mount: lookup(program): looking up xp0
Sep 16 01:03:13 tempgw automount[17954]: lookup_mount: lookup(program): xp0 -> -fstype=cifs,username=USER,password=PASSWORD #011 /C "://xp0/C" #011 /ADMIN\$ "://xp0/ADMIN\$" #011 /C\$ "://xp0/C\$"
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USER,password=PASSWORD #011 /C "://xp0/C" #011 /ADMIN\$ "://xp0/ADMIN\$" #011 /C\$ "://xp0/C\$"
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/C") -> /C
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/C"") -> ://xp0/C
Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /C -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/ADMIN\$") -> /ADMIN$
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/ADMIN\$"") -> ://xp0/ADMIN\$
Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /ADMIN$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/ADMIN\$
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/C\$") -> /C$
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/C\$"") -> ://xp0/C\$
Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /C$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\$
Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/ADMIN$
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/ADMIN$
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/ADMIN$
Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/C
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/C
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/C
Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: send_ready: token = 344
Sep 16 01:03:13 tempgw automount[17954]: handle_packet: type = 5
Sep 16 01:03:13 tempgw automount[17954]: handle_packet_missing_direct: token 345, name /smb/xp0/C$, request pid 17592
Sep 16 01:03:13 tempgw automount[17954]: attempting to mount entry /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: lookup_mount: lookup(program): /smb/xp0/C$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\$
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\$
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): core of entry: options=fstype=cifs,username=USER,password=PASSWORD, loc=://xp0/C\$
Sep 16 01:03:13 tempgw automount[17954]: sun_mount: parse(sun): mounting root /smb, mountpoint /smb/xp0/C$, what //xp0/C\$, fstype cifs, options username=USER,password=PASSWORD
Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0
Sep 16 01:03:13 tempgw automount[17954]: do_mount: //xp0/C\$ /smb//smb/xp0/C$ type cifs options username=USER,password=PASSWORD using module generic
Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mkdir_path /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mount -t cifs -s -o username=USER,password=PASSWORD //xp0/C\$ /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: mount(generic): mounted //xp0/C\$ type cifs on /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: send_ready: token = 345
Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0/C$
Sep 16 01:03:13 tempgw automount[17954]: st_expire: state 1 path /misc
Sep 16 01:03:13 tempgw automount[17954]: expire_proc: exp_proc = 3082075024 path /misc
Sep 16 01:03:13 tempgw automount[17954]: expire_cleanup: got thid 3082075024 path /misc stat 0
Sep 16 01:03:13 tempgw automount[17954]: expire_cleanup: sigchld: exp 3082075024 finished, switching from 2 to 1
Sep 16 01:03:13 tempgw automount[17954]: st_ready: st_ready(): state = 2 path /miscAfter cd /smb/xp0/C$
pwd yields: /smb/xp0/C$
and mount yields: //xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)
Thanks
Quoted 6 lines · Ian Kent
Quoted 3 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
Quoted 6 lines
Right, the reason the script changed was because of the "$" shares. I thought it was working ok but maybe a subsequent change to the daemon has broken it.
I'll try to duplicate the problem here but a debug log would also be useful. See http://people.redhat.com/jmoyer for details.
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerSorry for the delay.
Quoted 105 lines · Matthew Jurgens
Debug Log:
Sep 16 01:03:11 tempgw automount[17954]: st_expire: state 1 path /misc Sep 16 01:03:11 tempgw automount[17954]: expire_proc: exp_proc = 3083123600 path /misc Sep 16 01:03:11 tempgw automount[17954]: expire_cleanup: got thid 3083123600 path /misc stat 0 Sep 16 01:03:11 tempgw automount[17954]: expire_cleanup: sigchld: exp 3083123600 finished, switching from 2 to 1 Sep 16 01:03:11 tempgw automount[17954]: st_ready: st_ready(): state = 2 path /misc Sep 16 01:03:12 tempgw automount[17954]: st_expire: state 1 path /misc Sep 16 01:03:12 tempgw automount[17954]: expire_proc: exp_proc = 3083123600 path /misc Sep 16 01:03:12 tempgw automount[17954]: expire_cleanup: got thid 3083123600 path /misc stat 0 Sep 16 01:03:12 tempgw automount[17954]: expire_cleanup: sigchld: exp 3083123600 finished, switching from 2 to 1 Sep 16 01:03:12 tempgw automount[17954]: st_ready: st_ready(): state = 2 path /misc Sep 16 01:03:12 tempgw automount[17954]: handle_packet: type = 3 Sep 16 01:03:12 tempgw automount[17954]: handle_packet_missing_indirect: token 344, name xp0, request pid 17592 Sep 16 01:03:12 tempgw automount[17954]: attempting to mount entry /smb/xp0 Sep 16 01:03:12 tempgw automount[17954]: lookup_mount: lookup(program): looking up xp0 Sep 16 01:03:13 tempgw automount[17954]: lookup_mount: lookup(program): xp0 -> -fstype=cifs,username=USER,password=PASSWORD #011 /C "://xp0/C" #011 /ADMIN\$ "://xp0/ADMIN\$" #011 /C\$ "://xp0/C\$" Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USER,password=PASSWORD #011 /C "://xp0/C" #011 /ADMIN\$ "://xp0/ADMIN\$" #011 /C\$ "://xp0/C\$" Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/C") -> /C Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/C"") -> ://xp0/C Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /C -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/ADMIN\$") -> /ADMIN$ Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/ADMIN\$"") -> ://xp0/ADMIN\$ Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /ADMIN$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/ADMIN\$ Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): dequote("/C\$") -> /C$ Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: parse_mapent: parse(sun): dequote(""://xp0/C\$"") -> ://xp0/C\$ Sep 16 01:03:13 tempgw automount[17954]: add_offset_entry: parse(sun): added multi-mount offset /C$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\$ Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/ADMIN$ Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/ADMIN$ Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/ADMIN$ Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/C Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/C Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/C Sep 16 01:03:13 tempgw automount[17954]: mount_multi_triggers: mount offset /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: calling mount -t autofs -s -o fd=18,pgrp=17954,minproto=5,maxproto=5,offset automount /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: mount_autofs_offset: mounted trigger /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: send_ready: token = 344 Sep 16 01:03:13 tempgw automount[17954]: handle_packet: type = 5 Sep 16 01:03:13 tempgw automount[17954]: handle_packet_missing_direct: token 345, name /smb/xp0/C$, request pid 17592 Sep 16 01:03:13 tempgw automount[17954]: attempting to mount entry /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: lookup_mount: lookup(program): /smb/xp0/C$ -> -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\$ Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USER,password=PASSWORD ://xp0/C\ $ Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: parse_mount: parse(sun): core of entry: options=fstype=cifs,username=USER,password=PASSWORD, loc=://xp0/C\$ Sep 16 01:03:13 tempgw automount[17954]: sun_mount: parse(sun): mounting root /smb, mountpoint /smb/xp0/C$, what //xp0/C\$, fstype cifs, options username=USER,password=PASSWORD Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0
Quoted 8 lines
Sep 16 01:03:13 tempgw automount[17954]: do_mount: //xp0/C\ $ /smb//smb/xp0/C$ type cifs options username=USER,password=PASSWORD using module generic Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mkdir_path /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mount -t cifs -s -o username=USER,password=PASSWORD //xp0/C\ $ /smb/xp0/C$
So it appears autofs is doing the right thing.
But it doesn't end up right, odd!
Quoted 4 lines
Sep 16 01:03:13 tempgw automount[17954]: mount(generic): mounted //xp0/C\$ type cifs on /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: send_ready: token = 345 Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0/C$
And again it tells us the right thing.
Quoted 31 lines
Sep 16 01:03:13 tempgw automount[17954]: st_expire: state 1 path /misc Sep 16 01:03:13 tempgw automount[17954]: expire_proc: exp_proc = 3082075024 path /misc Sep 16 01:03:13 tempgw automount[17954]: expire_cleanup: got thid 3082075024 path /misc stat 0 Sep 16 01:03:13 tempgw automount[17954]: expire_cleanup: sigchld: exp 3082075024 finished, switching from 2 to 1 Sep 16 01:03:13 tempgw automount[17954]: st_ready: st_ready(): state =2 path /misc
After cd /smb/xp0/C$
pwd yields: /smb/xp0/C$
and mount yields: //xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)Thanks
Quoted 12 lines · Ian Kent
Quoted 3 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
Right, the reason the script changed was because of the "$" shares. I thought it was working ok but maybe a subsequent change to the daemon has broken it.
I'll try to duplicate the problem here but a debug log would also be useful. See http://people.redhat.com/jmoyer for details.
Ian Kent
maintainerQuoted 2 lines · Matthew Jurgens
Debug Log:
snip ...
Quoted 9 lines
Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0 Sep 16 01:03:13 tempgw automount[17954]: do_mount: //xp0/C\ $ /smb//smb/xp0/C$ type cifs options username=USER,password=PASSWORD using module generic Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mkdir_path /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: mount_mount: mount(generic): calling mount -t cifs -s -o username=USER,password=PASSWORD //xp0/C\ $ /smb/xp0/C$
This is the mount command we actually use.
We get rid of the quotes during the parsing of the entry but still the backslash quote could be causing a problem. Do you agree or should I be looking elsewhere?
Quoted 4 lines
Sep 16 01:03:13 tempgw automount[17954]: mount(generic): mounted //xp0/C\$ type cifs on /smb/xp0/C$ Sep 16 01:03:13 tempgw automount[17954]: send_ready: token = 345 Sep 16 01:03:13 tempgw automount[17954]: mounted /smb/xp0/C$
Ian
Ian Kent
maintainerQuoted 51 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
#!/bin/bash
# This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"
smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOTfor P in /bin /sbin
/usr/bin/usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -A $smbauthfile -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); print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } 'Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \ "/C" "://xp0/C" \ "/ADMIN$" "://xp0/ADMIN\$" \ "/C$" "://xp0/C\$"
Quoted 7 lines
vs the older output
-fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$"mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)
As I said before, the mount command looks OK, but I wonder if any recent CIFS kernel changes are getting confused by the "\" in the location (aka //xp0/C\$). That would be a bit of a bummer as autofs needs it but getting rid of it before the actual mount isn't straight forward.
Ian
Quoted 52 lines · On Tue, 16 Sep 2008 12:16:42 +0800 Ian Kent <[email protected]> wrote:
Quoted 51 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
#!/bin/bash
# This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"
smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOTfor P in /bin /sbin
/usr/bin/usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -A $smbauthfile -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); print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } 'Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \ "/C" "://xp0/C" \ "/ADMIN$" "://xp0/ADMIN\$" \ "/C$" "://xp0/C\$"
Quoted 13 lines
Quoted 7 lines
vs the older output
-fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$"mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)As I said before, the mount command looks OK, but I wonder if any recent CIFS kernel changes are getting confused by the "\" in the location (aka //xp0/C\$). That would be a bit of a bummer as autofs needs it but getting rid of it before the actual mount isn't straight forward.
Yes. There are some recent changes to the mount.cifs command and CIFS VFS in kernel to try to handle delimiters a little more intelligently (they were really broken before in some cases). This mount command does not look right to me though. You have this:
"://xp0/C\$"
...and the mount helper is interpreting that last \ as a delimiter. Since you have that in quotes already, you shouldn't need to escape the trailing $. So I think this would be more likely to work:
"://xp0/C$"
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Ian Kent
maintainerQuoted 74 lines · Jeff Layton
Quoted 52 lines · On Tue, 16 Sep 2008 12:16:42 +0800 Ian Kent <[email protected]> wrote:
Quoted 51 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
#!/bin/bash
# This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"
smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOTfor P in /bin /sbin
/usr/bin/usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -A $smbauthfile -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); print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } 'Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \ "/C" "://xp0/C" \ "/ADMIN$" "://xp0/ADMIN\$" \ "/C$" "://xp0/C\$"Quoted 13 lines
Quoted 7 lines
vs the older output
-fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$"mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)As I said before, the mount command looks OK, but I wonder if any recent CIFS kernel changes are getting confused by the "\" in the location (aka //xp0/C\$). That would be a bit of a bummer as autofs needs it but getting rid of it before the actual mount isn't straight forward.
Yes. There are some recent changes to the mount.cifs command and CIFS VFS in kernel to try to handle delimiters a little more intelligently (they were really broken before in some cases). This mount command does not look right to me though. You have this:
Quoted 5 lines
"://xp0/C\$"
...and the mount helper is interpreting that last \ as a delimiter. Since you have that in quotes already, you shouldn't need to escape the trailing $. So I think this would be more likely to work:
As with all things it's not quite that simple.
The "$" needs to be doubly escaped because it's also indicates a possible macro definition in a map entry.
Quoted 4 lines
"://xp0/C$"
Cheers,
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ian Kent
maintainerQuoted 11 lines · Paul Smith
Quoted 4 lines · Matthew Jurgens
Ok, so I updated the script to the RPM version and added the authentication parts:
#!/bin/bash
I guess maybe it's my pet peeve (like people who write "loose" when they mean "lose", and vice versa), but I'd really, really love it if we could avoid using bash in shell scripts, especially where (as in this case) it's completely unnecessary.
Quoted 8 lines
Can't we write our scripts in
/bin/sh?I have some embedded systems that use autofs and I surely don't want to have to build and install bash in my nice, small, busybox-based RAMDISK just to run a few support scripts. And it would be nice if I didn't have to gin up custom patches for them either. It's very, very simple in virtually all cases to write your script in POSIX-standard sh rather than bash... it just requires a bit of diligence.
I admit I don't usually think of embedded systems.
I'll have to get onto that but I don't think version 5 is appropriate for an embedded system (maybe too big) and version 4 hasn't seen much love for a good while now.
Anyway, I expect you have more than enough trouble setting up working tool chains than to have to worry about this sort of thing, ;)
Ian