Fixing Samba

I’m not sure how long this has been necessary, but Windows 7 appears to have broken Samba. Maybe Vista did it before; maybe it’s been this way for a long time. Sharing a Windows share to a Centos machine is not something I’ve done a lot of lately, so I can’t say for sure. But this evening, I wanted to install 10gR2 on my new Centos 5.3 x64 machine -when you buy a new PC, your original PC becomes The Other Half’s PC, and TOH’s PC becomes a new Centos server. And then the music stops! The 10g installation software is now sitting on my Windows 7 file system, shared with one of those Microsoft wizard-y things. Over on the Centos box, I typed the straightforward command mount -t cifs -o username=dizwell //10.42.43.2/software /mnt. Pretty ancient stuff, and it’s always worked before. But not tonight. Tonight I was told:

mount error 12 = Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Well, if I’d taken the advice offered by that error message, I might have been there a long time! Because it turns out it’s not a cifs (the ‘proper’ name we give smbfs these days!) issue at all, but a Windows one. Specifically, it turns out that if you look at your Windows event log (easier said than done in Windows 7!! It’s buried away in Control Panel -> System and Security -> Administrative Tools -> Event Viewer), in the Windows Log -> System branch, you’ll see the red exclamation-marked Error with a source of “srv”. Drill into that, and you’ll see the message:

The server was unable to allocate from the system nonpaged pool because the server reached the configured limit for nonpaged pool allocations.

The fix for that is to fire up the Registry Editor (click the Start Orb, type in regedit in the search programs and files window and press Enter) and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters. Once there, I had to create a new DWORD (32-bit) Value, called IRPStackSize, setting its value to Decimal 15. Reboot the Windows machine at that point, and when it comes back up, exactly the same mount command as issued previously on the Linux machine will now work just fine.

Update: Google reports this same issue going back to at least 2006, so it’s definitely not new. I also found there reports that suggested it was the reboot of the Windows box after the registry change that was the key to the “fix”, rather than the registry change itself. And I also found this site suggesting a completely different registry fix for the same problem. The fact that two different registry entries appears to ‘fix’ the problem does suggest to my mind that it’s the reboot that’s the key, not the registry alteration, but that’s up in the air I guess. For the record, my LanmanServer\Parameters\Size key was set to 1 and remained so despite my change to the IRPStackSize value, and yet my mount command worked just fine second time around. Go figure!

Comments are closed.