Samba: mount error(12): Cannot allocate memory

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

Samba: mount error(12): Cannot allocate memory

Post by ^rooker »

[PROBLEM]
I've mounted several computers running Windows 7 on a Linux server. After the windows client has an uptime of a few days, the mount dies and I get a mix of the following error messages (dmesg output):
CIFS VFS: Send error in SessSetup = -12
CIFS VFS: Unexpected lookup error -12
CIFS VFS: Unexpected lookup error -112
CIFS VFS: No response for cmd 50 mid 2317
And this error message when trying to remount the share:
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
On the windows clients, I got the following errormessage in the Eventlogs (System):
Source: srv
Event ID: 2017
Level: Error
The server was unable to allocate from the system nonpaged pool because the server reached the configured limit for nonpaged pool allocations.
...until I reboot the windows client.

[SOLUTION]
I'm not the only one suffering from that problem (some with samba, some with XP): It seems to be caused by Vista/Windows7 using SMB2 protocol by default - and disabling it, seems to be a workaround for the time being. Add the following registry key:

Code: Select all

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
"SMB2"=dword:00000000
This disables SMB2 which causes a fallback to SMB1.

***rant***
I'm sick and tired of working with non-professional operating systems like e.g. windows.
Their own knowledge base says:
This problem occurs because the Server service in Windows Vista is intentionally limited. [...]
"intentinally limited" ! - Why? WHYYYY?? (of course, we know why: Follow the money...)

...rounding it up with a juicy statement:
Most SMB requests are processed immediately. However, long-term SMB requests may cause a problem.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

Problem persists with Ubuntu 12.04 (precise pangolin)

Post by ^rooker »

The above "solution" with disabling SMB2 works for Debian Squeeze clients, but not for Ubuntu 12.04 (precise pangolin) clients.

dmesg returns a handful of these CIFS error messages:
[13758.587597] CIFS VFS: Unexpected lookup error -12
[13758.598645] CIFS VFS: Unexpected lookup error -12
[13758.600971] CIFS VFS: Unexpected lookup error -12
[13758.624719] CIFS VFS: Unexpected lookup error -12
[13758.637365] CIFS VFS: Unexpected lookup error -12
And then the same memory error as mentioned above:
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
It seems that it could be related to access rights:
A thread on ubuntuforums.org about this error had a link to another thread called 'mount windows share: "Cannot allocate memory"', which suggested to check that the access rights of both: the share and security for the folder are identical.

I've tried that and remounted the share (did not yet reboot the client): Same error message - already after transferring one large file (several GiB).

I'll try another approach, found in an article called "Fix for mount error(12): Cannot allocate memory" (based on a blog entry "Windows 7 Nonpaged Pool Srv Error 2017" by Alan LaMielle):
  • In HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management, set the LargeSystemCache key to 1 (hex).
  • In HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters, set the Size key to 3 (hex).
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

Re: Samba: mount error(12): Cannot allocate memory

Post by ^rooker »

Having this error again (still Ubuntu 12.04.2). Hmpf.

I found another article (German), titled "Windows 7 als Quasi-Fileserver".
The reasons for the error, and related keys mentioned in there look promising:
  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache
    Set the value to "1".
  • HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size
    Set the value from "1" (default) to "3".
Exactly the same tips for resolving this so called "Event ID 2017 error", are also listed on a Windows7 network tuning page, and explains the values a bit:
  • LargeSystemCache = 1:
    A value of zero above establishes a cache of ~8 MB, a value of 1 allows the cache to expand to physical memory minus 4 MB, if needed.
  • Size = 3:
    Size=1 minimizes used memory
    Size=2 balance used memory
    Size=3 optimal setting for file sharing and network applications

Links:
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply