標籤:selinux 引起的 instantiating disk: failed
asm 初始化建立ASM磁碟組 失敗[[email protected] ~]# oracleasm createdisk OCR /dev/sde1Writing disk header: doneInstantiating disk: failedClearing disk header: done開始以為是asm配置錯誤,於是重新初始化ASM[[email protected] ~]# /etc/init.d/oracleasm configure -iConfiguring the Oracle ASM library driver.This will configure the on-boot properties of the Oracle ASM librarydriver. The following questions will determine whether the driver isloaded on boot and what permissions it will have. The current valueswill be shown in brackets (‘[]‘). Hitting <ENTER> without typing ananswer will keep that current value. Ctrl-C will abort.Default user to own the driver interface [grid]: gridDefault group to own the driver interface [asmadmin]: asmadminStart Oracle ASM library driver on boot (y/n) [y]: yScan for Oracle ASM disks on boot (y/n) [y]: yWriting Oracle ASM library driver configuration: doneInitializing the Oracle ASMLib driver: [ OK ]Scanning the system for Oracle ASMLib disks: [ OK ][[email protected] ~]# /usr/sbin/oracleasm init但是 重新初始化後建立ASM磁碟組 依然失敗[[email protected] ~]# oracleasm createdisk OCR /dev/sde1Writing disk header: doneInstantiating disk: failedClearing disk header: done[[email protected] ~]# /usr/sbin/oracleasm createdisk OCR /dev/sde1Writing disk header: doneInstantiating disk: failedClearing disk header: done通過linux提供的 dmesg 和 strace 來定位問題[[email protected] ~]# dmesg sd 2:0:1:0: [sdb] Cache data unavailablesd 2:0:1:0: [sdb] Assuming drive cache: write throughsd 2:0:1:0: [sdb] Attached SCSI disksd 3:0:0:0: [sde] Cache data unavailablesd 3:0:0:0: [sde] Assuming drive cache: write throughsd 3:0:0:0: [sde] Attached SCSI disksd 2:0:3:0: [sdd] Cache data unavailablesd 2:0:3:0: [sdd] Assuming drive cache: write throughsd 2:0:3:0: [sdd] Attached SCSI diskEXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)dracut: Mounted root filesystem /dev/sda3dracut: Loading SELinux policytype=1404 audit(1363446394.257:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295SELinux: 2048 avtab hash slots, 250819 rules.SELinux: 2048 avtab hash slots, 250819 rules.SELinux: 9 users, 12 roles, 3762 types, 187 bools, 1 sens, 1024 catsSELinux: 81 classes, 250819 rulesSELinux: Permission audit_access in class file not defined in policy.SELinux: Permission audit_access in class dir not defined in policy.SELinux: Permission execmod in class dir not defined in policy.SELinux: Permission audit_access in class lnk_file not defined in policy.SELinux: Permission open in class lnk_file not defined in policy.SELinux: Permission execmod in class lnk_file not defined in policy.SELinux: Permission audit_access in class chr_file not defined in policy.SELinux: Permission audit_access in class blk_file not defined in policy.SELinux: Permission execmod in class blk_file not defined in policy.SELinux: Permission audit_access in class sock_file not defined in policy.SELinux: Permission execmod in class sock_file not defined in policy.SELinux: Permission audit_access in class fifo_file not defined in policy.SELinux: Permission execmod in class fifo_file not defined in policy.SELinux: Permission syslog in class capability2 not defined in policy.SELinux: the above unknown classes and permissions will be allowed[[email protected] ~]# strace -f -o asm.out /usr/sbin/oracleasm createdisk OCR /dev/sde13714 brk(0) = 0x16770003714 brk(0x1698000) = 0x16980003714 stat("/dev/sde1", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 65), ...}) = 03714 open("/dev/sde1", O_RDWR) = 43714 fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 65), ...}) = 03714 fstat(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 65), ...}) = 03714 mknod("/dev/oracleasm/disks/OCR", S_IFBLK|0600, makedev(8, 65)) = -1 EACCES (Permission denied)3714 write(2, "oracleasm-instantiate-disk: ", 28) = 283714 write(2, "Unable to create ASM disk \"OCR\":"..., 51) = 513714 close(4) 日誌中多次提到selinux 和 3714 mknod("/dev/oracleasm/disks/OCR", S_IFBLK|0600, makedev(8, 65)) = -1 EACCES (Permission denied)問題可能出在selinux或者防火牆上,查看selinux和防火牆狀態[[email protected] ~]# iptables -LChain INPUT (policy ACCEPT)target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)target prot opt source destination [[email protected] ~]# getenforce Enforcingiptables 與selinux均為開啟 ,嘗試關閉著兩個服務關閉linux 防火牆[[email protected] ~]# iptables -F[[email protected] ~]# service iptables stopiptables: Flushing firewall rules: [ OK ]iptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Unloading modules: [ OK ][[email protected] log]# chkconfig iptables off關閉selinux 服務[[email protected] ~]# setenforce 0編輯selinux設定檔修改 為SELINUX=disabled[[email protected] ~]# vim /etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted再次查看linux防火牆與selinux服務[[email protected] ~]# iptables -LChain INPUT (policy ACCEPT)target prot opt source destination Chain FORWARD (policy ACCEPT)target prot opt source destination Chain OUTPUT (policy ACCEPT)target prot opt source destination [[email protected] log]# getenforce Permissive重新建立ASM磁碟組,順利完成[[email protected] ~]# oracleasm createdisk OCR /dev/sde1Writing disk header: doneInstantiating disk: done
本文出自 “O Record” 部落格,請務必保留此出處http://evils798.blog.51cto.com/8983296/1420914