# Samba media files stuttering over network [Solved]

## gr0x0rd

Today I used the Gentoo Samba guide (http://www.gentoo.org/doc/en/quick-samba-howto.xml) to set up some shares in order to view the media files I have on my server now running Gentoo  :Very Happy:  Since I've just migrated from windows, the three drives are all NTFS and mounted using fuse/ntfs-3g. I was also able to mount the local drive on my laptop and read/write to it without problems using the strategy in the samba guide. Here is a glance at my fstab...

```

/dev/sda1               /boot           ext2            noauto,noatime  1 2

/dev/sda3               /               ext3            noatime         0 1

/dev/sda2               none            swap            sw              0 0

/dev/cdrom              /mnt/cdrom      audo            noauto,ro       0 0

/dev/sdb1               /home/gr0x0rd/files/gr0x-Y      ntfs-3g noatime        $

/dev/sdc1               /home/gr0x0rd/files/gr0x-0      ntfs-3g noatime        $

/dev/hdb1               /home/gr0x0rd/files/gr0x-Z      ntfs-3g noatime        $

//moonbase1/c$          /home/gr0x0rd/moonbase1         cifs    username=gr0x0r$
```

From my laptop running XP I was now able to view the share and see all my files. Hooray! But, when I try to open or view a file... nothing happens. Here's the applicable part of my smb.conf, basically a copy-and-paste job from the guide.

```

[global]

# Replace MYWORKGROUPNAME with your workgroup/domain

workgroup = CYBERTRON

netbios name = TELETRAN3

server string = Samba Server %v

# We are going to use cups, so we are going to put it in here ;-)

printcap name = cups

printing = cups

load printers = yes

# We want a log file and we do not want it to get bigger than 50kb.

log file = /var/log/samba/log.%m

max log size = 50

# We are going to set some options for our interfaces...

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

# This is a good idea, what we are doing is binding the

# samba server to our local network.

# For example, if eth0 is our local network device

interfaces = lo eth0

bind interfaces only = yes

# Now we are going to specify who we allow, we are afterall

# very security conscience, since this configuration does

# not use passwords!

hosts allow = 127.0.0.1 192.168.0.101

hosts deny = 0.0.0.0/0

# Other options for this are USER, DOMAIN, ADS, and SERVER

# The default is user

security = share

# For Samba 3.x. This enables ClamAV on access scanning.

vfs object = vscan-clamav

vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

[public]

comment = Cybertron Repository

browseable = yes

public = yes

create mode = 0766

guest ok = yes

path = /home/gr0x0rd/files/
```

I'm new to linux but this looked like a permissions issue- so I chmod 777'd an avi file and tried to play it... nothing. I've tried adding 

```
force user = nobody

        force group = nobody

        create mask = 0777

        directory mask = 0777
```

as was suggested in another thread, but what had no effect when stopping and starting samba. I have even tried stopping clamd to see if it would make a difference... nothing.

I have the feeling I am missing something very simple here. Can anyone help a n00b out?

Cheers,

----------

## shinjukumaster

I'm something of a noob too. But before I'd try and play files I'd try to copy over a basic text file first. When you say nothing happens what do you mean exactly? Can you open a text file via any other PC, e.g. a linux PC? Are the shares on the PC current/refreshed? Can you see them on the Linux box using smbclient -L (I think) Just a few ideas, I guess an expert will tell you what is wrong soon!

----------

## gr0x0rd

Sorry for not being more clear... here's some more info on the diagnosis so we can come up with a treatment...

From the windows client

-I can see the share and all the files it contains.

-When I open on a file on the share, the program associated with it opens but recieves no data (text files appear empty, avi files open vlc but no file information is recieved).

adding 

writeable = yes

to the [public] block in my smb.conf changed things slightly on the windows client; I'm now able to create a file and write to it, however once the file is saved and closed, behaviour reverts to that which is described above.

I tried creating a new share that is exclusively on the ext2 portion of the filesystem and the behaviour is the same.

If I do a smbclient -L localhost I can see the server info from the Linux box (server). Pretty sure that's working because I can see it from windows too  :Smile:  Changing my smb.conf and stopping/starting the server also affects the connection differently.

I have Gentoo running in a vmware console on the same machine. When I try

```
mount -t cifs //teletran3/public / /home/gr0x0rd/teletran3
```

I get the following error message:

```
mount: wrong fs type, bad option, bad superblock on //teletran3/public

            missing codepage or other error

            In some cases useful info is found in syslog - try

            dmesg | tail or so
```

Checking the log yielded this error:

```
CIFS VFS: cifs mount failed w/return code = -22
```

Using smbfs instead of cifs throws this to the logfile:

```
smb_fill_super: missing data argument
```

So I'm unable to connect to the share at all from the linux vwmare machine.

Hmmm.....

----------

## shinjukumaster

This is not helpful but I've had problems with CIFS mounts.

It has some dependencies (I'm hesitant to give any advice but you might want to lookup, rather than run, 'depmod')

silly question: have you installed smbfs?

do you have 'security = share' in smb.conf?

make sure your share name is valid (no spaces, invalid chars, etc.)

Its all a guess!

----------

## gr0x0rd

Thanks for the effort man... I have both cifs and smbfs built into the kernel on the server, and as modules on the linux client. I know they are working on both; I had to recompile the modules into my kernel on the client, and they both agree with modprobe <fstype>. 

And to answer your questions, yes I have installed smbfs (above), I have tried security = share (is my current setting) and security = user / map to guest = Bad User (prompts me for my username/sambapwd, then connects) and my share name is valid- it's the one used in the Gentoo guide!   :Very Happy: 

I am concerned that I get the same behavior on a newly created share on an ex2 filesystem (following the guide exactly). This tells me the problem is independant of the fuse/ntfs-3g system used to mount and access the other drives. Even after copying a file there and chmod 777'ing it as root and verifying the permissions are -rwxrwxrwx, I get the same behaviour from the windows client. Likewise for chmod 700, which should remove the read permissions from the share, has no effect. Obviously samba's settings override the local settings.

Looks like I might be unmerging samba and trying again from scratch.

----------

## gr0x0rd

I just tried a number of different user accounts and passwords on both the windows client and linux server with various levels of security. The behaviour is the same regardless of what I do. Bizarre.

Going to check my kernel settings, unmerge everything samba and start again.

----------

## gr0x0rd

My samba server is now working. Here are the steps I took:

emerge --unmerge samba

emerge --unmerge cups

removed all but "readline python" for samba-specific USE flags in make.conf

recompiled and booted into kernel with smb network filesystem support built-in

emerged samba

emerged cups

specified port settings in cupsd.conf (problem identified from logs, not included in gentoo guide)

removed clamav info from smb.conf

smb.conf is as follows:

```
[global]

workgroup = CYBERTRON

netbios name = TELETRAN3

server string = Samba Server %v

printcap name = cups

printing = cups

load printers = no

log file = /var/log/samba/log.%m

max log size = 50

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

interfaces = lo eth0

bind interfaces only = yes

hosts allow = 127.0.0.1 192.168.0.101

hosts deny = 0.0.0.0/0

security = share

guest ok = yes

#vfs object = vscan-clamav

#vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

[gr0x0rd]

comment = Cybertron Repository

browseable = yes

public = yes

create mode = 0766

guest ok = yes

path = /home/gr0x0rd/files
```

I can only assume the problems were caused by something in cups or clamav since things seemed to work okay after a few tweaks upon re-emerging without most of the USE flags recommended in the guide. 

WOHOO!!! My share is finally working!!!

----------

## gr0x0rd

***********************

After getting my shares working, I was very disheartened to find the streaming capabilities were awful- I couldnt even play an mp3 file over a wired network without skippage. The straw that broke the camel's back with my Microsoft adventures was the fact that in Vista the tcp/ip stack was rewritten for multimedia applications; with a Vista server and an XP client, a streaming video would skip and stutter even over a wired connection. Even with registry tweaks etc. it was simply unacceptable. So I was very discouraged to find Gentoo/samba couldnt provide a simple media streaming solution out-of-the-box with a Gentoo server and windows client.

I tested the filesystem being harnessed by samba, different applications on the client, and always used a bandwidth monitor to see network speed. The behaviour was always the same despite the environmental changes I made. The odd thing was, whenever I put a load on the connection (such as copying over a big file in the background while streaming a video file) the performance of the streamed video increased dramatically. This got me scratching my head.

I found a samba tuning guide at o'reilly's website which was a great resource. Here's the link:

http://www.oreilly.com/catalog/samba/chapter/book/appb_02.html

Adding the following to my smb.conf

socket options = TCP_NODELAY SO_RCVBUF=16384 SO_SNDBUF=16384 IPTOS_LOWDELAY

increased the performance slightly, but media files are still basically unwatchable from the windows client unless there is a load on the network, and even with a load still skip and stutter somewhat.

I am going to get a GentooVM going on the same machine and see if the problem also occurs when going linux-linux. If anyone has any input in the meantime I'd certainly appreciate it. Cheers,

----------

## gr0x0rd

YESSSS!!!!! Upgrading to the 2.6.23r3 kernel fixed the problem- my files now play over the network without issue. Looks like Christmas came early this year, thanks to the devs!!

----------

## Pearlseattle

This is funny - I have exactly the same problem now, after setting up SMB/CIFS. If I try to play with mplayer a video from a SMB/CIFS-mounted filesystem the video is extremely slow, but if I transfer at the same time a file, the video is perfectly smooth.

I'm using xen-sources 2.6.21 (the latest version), so until 2.6.23 is released I will use NFS to watch videos.

----------

