不久前我在升级内核时遇到了这个问题,但直到现在才升级。
在我的系统上,我可以很高兴地使用运行内核 3.7.10 的 CIFS 挂载网络共享,但是当我尝试使用较新的内核时(当前尝试使用 3.13.1,但自 3.12.6 以来一直在尝试)当我遇到以下错误时尝试安装它们/etc/init.d/netmount start
(我正在运行 Gentoo):
# /etc/init.d/netmount restart
* Unmounting network filesystems ... [ ok ]
* Mounting network filesystems ...
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Run Code Online (Sandbox Code Playgroud)
尝试手动安装会导致相同的错误...
# mount -t cifs //Server/to_mount1 /mnt/network1 -o credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Run Code Online (Sandbox Code Playgroud)
当我尝试挂载三个网络共享时,该错误发生了 3 次,以下是我的/etc/fstab
条目(在内核版本之间完全没有变化):
# Network drives
//Server/to_mount1/mnt/network1 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0
//Server/to_mount2/another/dir /mnt/network2 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0
//Server/to_mount3 /mnt/network3 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0
Run Code Online (Sandbox Code Playgroud)
搜索周围,我发现一个很旧的解决了这个问题,需要访问Windows服务器进行一些修改,这是详细的在这里。
不幸的是,这是在工作,我不仅无法访问 Windows 服务器来测试这些更改是否会产生任何影响,而且它只发生在较新的 3.12.6 内核中,我可以重新启动到 3.7.10 内核并网络共享安装没有任何问题。
这让我认为较新的内核存在问题,因此我查看了 3.7.10 内核配置下的 CIFS 选项:
# grep -i cifs /usr/src/linux-3.7.10-gentoo-r1/.config
CONFIG_CIFS=y
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_WEAK_PW_HASH=y
# CONFIG_CIFS_UPCALL is not set
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_ACL=y
# CONFIG_CIFS_DEBUG2 is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_SMB2=y
# CONFIG_CIFS_FSCACHE is not set
Run Code Online (Sandbox Code Playgroud)
...在 3.12.6 配置下:
# grep -i cifs /usr/src/linux-3.13.1-gentoo/.config
CONFIG_CIFS=y
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_WEAK_PW_HASH=y
# CONFIG_CIFS_UPCALL is not set
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_ACL=y
CONFIG_CIFS_DEBUG=y
# CONFIG_CIFS_DEBUG2 is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_SMB2=y
# CONFIG_CIFS_FSCACHE is not set
Run Code Online (Sandbox Code Playgroud)
...而且它们是相同的(这并不奇怪,因为我没有改变任何东西!)。
我重新出现net-fs/cifs-utils
,以防万一那里出了什么问题,但这没什么区别。
有没有办法解决这个问题,而无需访问 Windows 共享来测试建议的解决方案(如果这确实是根本原因),或者是否还有其他原因导致了问题?
我终于解决了这个问题,解决方案是为 mount.cifs 添加 ''sec=ntlm'' 选项,因为默认行为发生了变化。从
man mount.cifs
...
The default in mainline kernel versions prior to v3.8 was sec=ntlm. In v3.8, the default was changed to sec=ntlmssp.
...
Run Code Online (Sandbox Code Playgroud)
所以我的 /etc/fstab 条目现在看起来像......
# Network drives
//Server/to_mount1/mnt/network1 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline, sec=ntlm 0 0
//Server/to_mount2/another/dir /mnt/network2 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline,sec=ntlm 0 0
//Server/to_mount3 /mnt/network3 cifs credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline,sec=ntlm 0 0
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
36425 次 |
最近记录: |