我尝试将 Rails 应用程序部署到 中/home/app/myapp
,但是当应用程序尝试连接到 Mysql 时,出现以下错误:
** [out :: 192.168.110.50] /home/app/myapp/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/mysql2.so: failed to map segment from shared object: Operation not permitted - /home/app/myapp/shared/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
“app”用户具有 root 权限,因此没有意义。
谷歌搜索后,我发现noexec
在主文件夹中可以阻止系统调用。这是我的 fstab 文件:
$cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Oct 17 16:48:10 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VG00-LVbarra / ext4 defaults 1 1
UUID=3d5ccda7-932f-4b48-a010-9ddcb99873c0 /boot ext4 defaults 1 2
/dev/mapper/VG00-LVhome /home ext4 defaults,noexec,nosuid 1 2
/dev/mapper/VG00-LVtmp /tmp ext4 defaults,noexec,nosuid 1 2
/dev/mapper/VG00-LVusr /usr ext4 defaults 1 2
/dev/mapper/VG00-LVvar /var ext4 defaults,noexec,nosuid 1 2
如何从主文件夹中删除 noexec 标志?谢谢你!
答案1
看起来 mprotect 失败了,但无论如何,要删除 noexec 标志,请更改
/dev/mapper/VG00-LVhome /home ext4 defaults,noexec,nosuid
到
/dev/mapper/VG00-LVhome /home ext4 defaults,nosuid
并重新挂载/homemount -o remount /home