Showing posts with label mount. Show all posts
Showing posts with label mount. Show all posts

Tuesday, October 25, 2011

Fixing Samba failing to find canonical path for autofs mounted share locations

Following on from my previous post I was chatting with a friend and they pointed out that I could also make use of preexec to get my desired behaviour.

So I removed the entries for wide links and unix extensions from my smb.conf, allowing them to go back to being the default. I then changed my mythtv share to contain:

[mythtv]
        comment = Myth TV Recordings
        path = /auto/mythtv
        guest ok = Yes
        preexec = ls /auto/mythtv

This then solves the issue of Samba not allowing the share to be opened due to the "canonicalize_connect_path failed for service " error.

Tuesday, September 27, 2011

Sharing an autofs mount point over Samba

Since upgrading to Samba 2:3.5.11~dfsg-1 (or possibly slightly earlier) on my Debian based home server I found that some of the shares were no longer working. I could see them when browsing the network device, it just wouldn't let me access them.

This seemed to only be happening to my Samba shares which were pointing directly at the root of an autofs mount point, which in my case was a mythtvfs mount at /auto/mythtv.

What made this more puzzling was that if I ssh'ed into the machine then I could happily do

ls /auto/mythtv
and see all my files. The final piece of the puzzle fitted into place when I realised that the Samba share would work if the mount was already mounted.

A look at the samba logs indicated the following:
smbd/service.c:988(make_connection_snum)
  canonicalize_connect_path failed for service mythtv, path /auto/mythtv

On a hunch I tried the wide links option (which requires disabling unix extensions) by adding the following to the global section of my /etc/samba/smb.conf:
[global]

# Need to disable unix extensions and allow wide links to allow /auto to be mounted
unix extensions = no
wide links = yes
And then restarted samba with "/etc/init.d/samba restart". This then fixed the issue, allowing my autofs mount points to be mounted correctly. The big downside of this is that unix extensions which allow symlinks and hard links over samba are then disabled. If I get the time I might look into seeing if I can patch canonicalize_connect_path to work correctly with autofs mount points without exposing any security flaws.

Possibly the most irritating thing about this issue was that searching for the terms "Samba" and "autofs" gives lots of hits for the other side of the situation; using autofs to mount Samba shares automatically.

Monday, January 31, 2011

MythTV and network mounts

After setting up a MythTv 0.24 frontend to use a samba share for files from the backend I discovered that I could no longer watch live TV on it. If I tried to watch live TV there would just be a pause and then a "Error opening jump program file buffer" error message. Looking in the output on stdout wasn't much more helpful, with "Error: Took more than 10 seconds to be allowed to read, aborting" being about the only meaningful message.

It took me ages to track down that the problem is with cached IO on the network share. If the CIFS file system is caching the inode information (which includes the size attributes), then the MythTv frontend thinks that no live TV is being streamed and gives up after a while.

The solution to this is to add the 'directio' option when mounting the network partition (e.g. '-o directio' on the command line). If it's an NFS share then an alternative is to use 'forcedirectio' in the /etc/exports on the server (which is useful if you don't want to change all your MythTv frontends).

Creative Commons License
The words and photos on this webpage which are created by Toby Gray are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 England & Wales License.