Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: smbmount - cannot create regular file

  1. #1
    Join Date
    Jan 2006
    Location
    Waterloo, ON, Canada
    Beans
    214
    Distro
    Ubuntu 12.04 Precise Pangolin

    Red face smbmount - cannot create regular file

    Hi there!

    Hoping to find someone with a similar problem, or experience with mounting a samba share to the local file system using smbmount.

    Scenario - 2 Desktops, 1 Server
    * myserver, ubuntu 8.04 server, running samba server
    * winxp, windows xp
    * ubuntu, ubuntu 8.10

    OK. I'll simplify my situation so it makes sense. "myserver" has two samba shares, "Downloads" and "Stuff". Both have sub directories "/foo/bar".

    The "bat" folder contains many empty files, we'll call them: A, B, C, and D.

    :myserver
    --stuff
    ----foo
    ------bar
    --downloads
    ----foo
    ------bar
    --------bat
    ----------A
    ----------B
    ----------C
    ----------D
    Task:
    * Copy the directory bat (and all it's contents) from smb://myserver/Downloads/foo/bar
    * Paste the directory bat (and all it's contents) to smb://myserver/Stuff/foo/bar

    What Works:
    From both winxp and ubuntu, if we browse using the "Network", this works without a hitch. In winxp, we can browse to \\myserver and perform the task. In ubuntu, we can browse to smb://myserver and perform the task.

    The Setup and Config
    However, as we all know, browsing through the "network browser" in Linux doesn't achieve maximum performance. So, the solution for most, mount the server shares to the local file system. There are two directories with the mounted samba shares:
    * /mnt/myserver/downloads
    * /mnt/myserver/stuff

    Here's the fstab entry for such a thing:
    Code:
    //myserver/Downloads /mnt/myserver/downloads cifs auto,credentials=/home/fermulator/.smbcredentials,workgroup=WORKGRUOP,gid=fermulator,uid=fermulator,rw,errors=continue       0       6
    //myserver/Stuff /mnt/myserver/stuff cifs auto,credentials=/home/fermulator/.smbcredentials,workgroup=WORKGRUOP,gid=fermulator,uid=fermulator,rw,errors=continue       0       6
    To be brief on the fstab entry, we need gid and uid entries because we're not on a domain, and the numerical values of uid and gid might not match between server and client, the rest is self explanatory and status quo mostly.

    So, finally, on to the problem:

    What Doesn't Work:

    Using the GUI
    On the ubuntu machine, if we browse using Nautilus to /mnt/myserver, and try to copy and paste, we receive the following error:
    Error while copying "A".
    There was an error copying the file into /mnt/myserver/stuff/foo/bar/bat.
    Show more details (expanded)
    Error opening file '/mnt/myserver/stuff/foo/bar/bat/A': Permission denied.
    * If I choose Cancel, the operation is canceled, but the 'bat' directory exists.
    * If I choose Skip (or Skip All), the file A is skipped, but then B, C, D are successfully copied! (weird!)

    Using the Command Line:
    Code:
    cd /mnt/myserver/downloads/foo/bar
    cp -Rv bat /mnt/myserver/stuff/foo/bar
    cp: cannot create regular file '/mnt/myserver/stuff/foo/bar/bat/A': Permission denied.
    Again, same as with Nautilus, the directory bat was created, but this time no files were copied.
    Try the command:
    Code:
    cp -Rv bat /mnt/myserver/stuff/foo/bar
    again? ... no problem, the files are copied.

    What gives? It's like when a samba share is mounted, it takes a second for the ACLs from the server to propagate or something? ... anytime we try to copy/paste again, the operation is successful so long as the parent directory was not JUST NOW created, but created "a few seconds ago".

    Just for those non-believers, the permissions on the client side are correct!
    drwxrwx--- 2 fermulator fermulator 0 2009-04-16 21:41 1969 - 20 20 bat
    Even on the server side, if I do a getfacl on the bat directory, or it's parent bar, in either source or destination, the correct ACLs (generated from the default ACLs) have been applied.

    We KNOW that the permissions are correct anyways since if we retry the task, THEN it works ... this seems to be something with 'timing'?...

    Any light would be wonderful!
    Last edited by fermulator; April 17th, 2009 at 03:08 AM. Reason: Fixed some minor aesthetics and typos.
    ~Fermmy

  2. #2
    Join Date
    Jun 2007
    Beans
    20

    Re: smbmount - cannot create regular file

    Hi fermulator,
    Thanks a lot for this detailed description. I am facing the exact same problem with a Ubuntu 9.04 client trying to copy folders to a Debian Samba 3.2.5.

    So, the problem is not just copying from share to share. When I try to copy a local folder to the Samba share nautilus says "Error while copying ..." and "Error opening file '/home/tux/mnt/sambashare/sample.jpg': Permission denied" in the details.

    I thought that someone must have had reported this already, but I could not find any bug reports. What's worse I have no idea why it doesn't work

  3. #3
    Join Date
    Jan 2006
    Location
    Waterloo, ON, Canada
    Beans
    214
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: smbmount - cannot create regular file

    Quote Originally Posted by xrat View Post
    Hi fermulator,
    Thanks a lot for this detailed description. I am facing the exact same problem with a Ubuntu 9.04 client trying to copy folders to a Debian Samba 3.2.5.

    So, the problem is not just copying from share to share. When I try to copy a local folder to the Samba share nautilus says "Error while copying ..." and "Error opening file '/home/tux/mnt/sambashare/sample.jpg': Permission denied" in the details.

    I thought that someone must have had reported this already, but I could not find any bug reports. What's worse I have no idea why it doesn't work
    Interesting, I just upgraded to Jaunty 9.04 as the ubuntu client, and I SEEM to be able to copy/cut and paste without problems now. It is a fresh install, so perhaps there was a conflict somewhere?

    The server installation has not been updated at all.
    ~Fermmy

  4. #4
    Join Date
    Jun 2007
    Beans
    20

    Re: smbmount - cannot create regular file

    That's strange. Anyway, something's broken. And there are plenty of reports of problems with Nautilus, Samba & Co. Just this particular issue I can't find anywhere else.
    But I am tired of looking any further. I'll use the .gvfs path for now.

  5. #5
    Join Date
    Mar 2009
    Beans
    2

    Re: smbmount - cannot create regular file

    I have the exact same problem however my server is OpenSuSE 10.3 and the client is Ubuntu Intrepid. This is the most frustrating issue I have had the misfortune to encounter in a very long time... I am still with out a fix so Please any one... post with a fix...

  6. #6
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,362
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: smbmount - cannot create regular file

    Have a look through some of the troubleshooting remarks at the bottom of my CIFS howto (2nd link in my sig).

    If you're mounting via fstab (in Ubuntu) it's critical to make sure that you have the smbfs metapackage installed:
    Code:
    sudo aptitude install smbfs
    While Ubuntu does allow for some samba functionality out of the box, it's not really a complete set of packages, and really only caters to the needs of very simple peer to peer file sharing over GVFS (places > connect to server).

  7. #7
    Join Date
    Jun 2007
    Beans
    20

    Re: smbmount - cannot create regular file

    Hi dmizer,
    Thanks a lot for having a look at this thread. I am afraid, though, that your troubleshooting chapter does not apply here. As far as I can tell the problem occurs and always occurred even with a proper setup. I still think that a bug is involved (just did not find the time yet to reproduce on a clean installation and properly report it).

    May I suggest the following example to reproduce (and hopefully clarify):

    What I am going to use
    Code:
    tux@client:~$ grep "/home/tux/mnt/myshare" /etc/fstab
    //smbserver/myshare  /home/tux/mnt/myshare  cifs  credentials=/root/.smbcred,uid=1000  0  0
    tux@client:~$ grep "/home/tux/mnt/myshare" /proc/mounts
    //smbserver/myshare /home/tux/mnt/myshare cifs rw,mand,unc=\\smbserver\myshare,username=andreas,uid=1000,posixpaths,acl,rsize=16384,wsize=57344 0 0
    tux@client:~$ mkdir testdir
    tux@client:~$ touch testdir/somefile
    First encounter of the problem:

    Code:
    tux@client:~$ cp -r testdir /home/tux/mnt/myshare
    cp: cannot create regular file `/home/tux/mnt/myshare/testdir/somefile': Permission denied
    The same command works when issued again (because the first try actually did create the directory, only the file could not be copied):

    Code:
    tux@client:~$ cp -r testdir /home/tux/mnt/myshare
    Let's try again after creating the directory ourselves:

    Code:
    tux@client:~$ rm -r /home/tux/mnt/myshare/testdir # just to clean up
    tux@client:~$ mkdir /home/tux/mnt/myshare/testdir && cp -r testdir /home/tux/mnt/myshare
    cp: cannot create regular file `/home/tux/mnt/myshare/testdir/somefile': Permission denied
    tux@client:~$ cp -r testdir /home/tux/mnt/myshare
    Let's try again and let's see if it is a timing issue (which it is i.a.)

    Code:
    tux@client:~$ rm -r /home/tux/mnt/myshare/testdir # clean up again
    tux@client:~$ mkdir /home/tux/mnt/myshare/testdir && sleep 1 && cp -r testdir /home/tux/mnt/myshare
    tux@client:~$ ls -o /home/tux/mnt/myshare/testdir
    total 0
    -rw------- 1 tux 0 2009-06-27 19:35 somefile

    Indeed, it apparently is not just a timing issue since I've just found out that copying folders does work without problems as root. As you see I am using "uid=1000" (and always did). Adding "file_mode=0777,..." did not help. Interestingly, "nounix" does not work for me. With "nounix" the mount point is empty.
    Last edited by xrat; June 28th, 2009 at 08:35 PM. Reason: Clarified the "grep" command, it was ambiguous

  8. #8
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,362
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: smbmount - cannot create regular file

    I discuss this exact problem under the "Files owned by root" section. You'll need to add the gid (in addition to the uid). Also add the nounix option.

    Also, you have some strange options that apply to ext3 rather than CIFS. Having them in your CIFS mount command doesn't hurt anything (because they are simply ignored) but they're not doing anything either.

    Try something like this instead.
    Code:
    //smbserver/myshare /home/tux/mnt/myshare cifs rw,username=andreas,uid=1000,gid=1000,nounix,rsize=16384,wsize=57344 0 0
    See man mount and man mount.cifs for more information.

    The problem is that you need to disable unix style permissions handling over CIFS because CIFS can't pass them correctly (remember, this is Windows file sharing, not Linux).

    Edit:
    It has also been suggested to try the "noperm" option as well.
    Last edited by dmizer; June 28th, 2009 at 12:57 PM.

  9. #9
    Join Date
    Jun 2007
    Beans
    20

    Re: smbmount - cannot create regular file

    Hi dmizer,
    Thanks again for your efforts.

    First of all, adding "noperm" works around the timing issues when copying folders. With "noperm" it works as the user, too. Thanks for the hint. Nevertheless, IMHO, this just underlines the fact that the actual error is to be found somewhere else.

    To clarify and comment your remark: I am not using any ext3 options. Maybe the grep command was confusing. I tried to clear it up by breaking it up into two separate commands. I am using practically what you recommend in your "Files owned by root" section, which, however, from my point of view does not discuss timing problems where writing files works whereas copying folders does not. But never mind.

  10. #10
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,362
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: smbmount - cannot create regular file

    Quote Originally Posted by xrat View Post
    Hi dmizer,
    Thanks again for your efforts.

    First of all, adding "noperm" works around the timing issues when copying folders. With "noperm" it works as the user, too. Thanks for the hint. Nevertheless, IMHO, this just underlines the fact that the actual error is to be found somewhere else.

    To clarify and comment your remark: I am not using any ext3 options. Maybe the grep command was confusing. I tried to clear it up by breaking it up into two separate commands. I am using practically what you recommend in your "Files owned by root" section, which, however, from my point of view does not discuss timing problems where writing files works whereas copying folders does not. But never mind.
    Yes, that did clear things up. Sorry for the confusion.

    This may be how unix permissions are set up locally on the server side of things. A "ls -la" on the shared directory may shed light on what may have been causing this problem. It normally shouldn't matter, but since both server and cient are Unix, it adds a level of complexity for permissions.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •