Click to See Complete Forum and Search --> : Fix to problem mounting SMB shares in Red Hat 9


cowanrl
10-11-2003, 12:59 PM
I've been having a problem since I installed Red Hat 9 with mounting SMB shares. Randomly, when you execute smbmount or mount -t smbfs, the command would hang. To break out of it, you need to press CTRL+C. When you do, you see that the share was successfully mounted, the command just wouldn't complete.
This also created a problem when you tried to mount SMB shares from /etc/fstab. It would actually stall the boot process because the mounting process would hang.
If you tried to mount the shares at boot up from a script file, the command would hang and you would have to press CTRL+C to continue. You could not have an unattended boot up of the machine.

After poking around on Red Hat's site, I finally found a work around. The problem is described in this link:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90036

Basically the fix is to rename smbmount to smbmount.orig. Then create a script named smbmount that sets some environment variables and calls smbmount.orig.

Here's the commands the link says to execute to set this up:


mv /usr/bin/smbmount /usr/bin/smbmount.orig
cat <<EOF >/usr/bin/smbmount
#!/bin/bash
export LD_ASSUME_KERNEL=2.2.5
exec /usr/bin/smbmount.orig "$@"
EOF
chmod 755 /usr/bin/smbmount


You may need to modify this, depending on where you find smbmount. On my machine, it was in /usr/sbin/, not /usr/bin.
Another problem I had with this was the resultant script file did not have the "$@" after /usr/sbin/smbmount.orig. It only had "". I had to manually edit the file to add it.

Once I ran that code, the smbmount and mount -t smbfs commands worked every time. However, I could not mount the shares from /etc/fstab. There were no errors generated nor did the system hang, the shares just never mounted. Here's my fstab file:


LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/savefile /savefile ext3 defaults 1 2
/dev/hda3 swap swap defaults 0 0
//pe500sc/savefile /mnt/pe500sc/savefile smbfs credentials=/home/rlcowan/.secrets,uid=rlcowan 0 0
//pe500sc/family /mnt/pe500sc/family smbfs credentials=/home/rlcowan/.secrets,uid=rlcowan 0 0
//pe500sc/rlcowan /mnt/pe500sc/rlcowan smbfs credentials=/home/rlcowan/.secrets,uid=rlcowan 0 0
//pe500sc/photos /mnt/pe500sc/photos smbfs credentials=/home/rlcowan/.secrets,uid=rlcowan 0 0
//pe500sc/linux /mnt/pe500sc/linux smbfs credentials=/home/rlcowan/.secrets,uid=rlcowan 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0


Those lines should work but for some reason they won't. They are the same lines I used before I made the modification to smbmount and they would hang the machine. Now it's like the new smbmount is ignored or won't run properly. Any one have any ideas why?

Since that won't work, I put the commands to mount the shares in /etc/rc.local. These are the commands I use:


echo "Mounting SMB shares"
/usr/sbin/smbmount //pe500sc/savefile /mnt/pe500sc/savefile -o credentials=/home/rlcowan/.secrets,uid=rlcowan,gid=rlcowan
/usr/sbin/smbmount //pe500sc/family /mnt/pe500sc/family -o credentials=/home/rlcowan/.secrets,uid=rlcowan,gid=rlcowan
/usr/sbin/smbmount //pe500sc/rlcowan /mnt/pe500sc/rlcowan -o credentials=/home/rlcowan/.secrets,uid=rlcowan,gid=rlcowan
/usr/sbin/smbmount //pe500sc/photos /mnt/pe500sc/photos -o credentials=/home/rlcowan/.secrets,uid=rlcowan,gid=rlcowan
/usr/sbin/smbmount //pe500sc/linux /mnt/pe500sc/linux -o credentials=/home/rlcowan/.secrets,uid=rlcowan,gid=rlcowan
echo "Finished mounting SMB shares"


It mounts the shares just fine at boot up.

Of course depending on your need, you could put the commands to mount the shares in /etc/profile or /home/user/.bash_profile.

This is only a work around but at least the shares are mounted at boot up now.

bwkaz
12-24-2003, 10:31 AM
Originally posted by cowanrl
Another problem I had with this was the resultant script file did not have the "$@" after /usr/sbin/smbmount.orig. It only had "". I had to manually edit the file to add it. Put single quotes around the EOF in the command, and it'll pass the $@ through unchanged. The problem with the shell session you've quoted is that the shell will try to substitute for $@ while doing the cat, not while the script is running. Putting single quotes around the EOF prevents pretty much all expansion.

:)