linux 核心啟動錯誤和selinux參數 Kernel panic -not syncing:Attempted to kill init

來源:互聯網
上載者:User

標籤:

今天在裝某個軟體的時候,修改了selinux參數。修改selinux 的某個參數值為Disable。導致 linux系統不能啟動。出現如下錯誤 Kernel panic -not syncing:Attempted to kill init!

 

後經過向群友請教和自己操作和互連網搜尋,終於找到瞭解決辦法。

在linux啟動介面出現時,按f2進入如下介面:

 

 

 

按e進入如下介面

 移動到第2個選項,再按e進入編輯

 

在後面輸入 selinux=0

按斷行符號。

返回到原來介面,

再按b,就可以啟動了。

 

 

以下為轉載自:

http://tech.srcsky.com/os/linux/349502.html

SELINUX從理解到動手配置。

SELinux 可以為你的系統提供較棒的安全防護。 使用者能被分配預先定義好的角色,以便他們不能存取檔案或者訪問他們不擁有的程式。

Selinux的啟用與關閉

編輯/etc/selinux/conf檔案

SELINUX=enforcing(強制:違反了策略,你就無法繼續操作下去)

Permissive(有效,但不強制:違反了策略的話它讓你繼續操作,但是把你的違反的內容記錄下來)

Disabled(禁用)

禁用的另一種方式:在啟動的時候,也可以通過傳遞參數selinux給核心來控制它

編輯/etc/grup.conf

title Red Hat Enterprise Linux Server (2.6.18-8.el5)

root (hd0,0)

kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet selinux=0

initrd /initrd-2.6.18-8.el5.img

SELINUXTYPE=targeted

此參數可選項:targeted和strice。分別是targeted只控制關鍵網路服務,strice控制所有的服務

查詢selinux的狀態

[[email protected]linuxas ~]# /usr/sbin/getenforce

Enforcing

[[email protected] ~]# sestatus -bv

SELinux status: enabled

SELinuxfs mount: /selinux

Current mode: enforcing

Mode from config file: enforcing

Policy version: 21

Policy from config file: targeted

查看selinux載入的核心模組

[[email protected] selinux]# semodule -l

amavis 1.1.0

ccs 1.0.0

clamav 1.1.0

dcc 1.1.0

evolution 1.1.0

iscsid 1.0.0

mozilla 1.1.0

mplayer 1.1.0

nagios 1.1.0

oddjob 1.0.1

pcscd 1.0.0

pyzor 1.1.0

razor 1.1.0

ricci 1.0.0

smartmon 1.1.0

查看selinux錯誤記錄檔

[[email protected] selinux]# sealert -a /var/log/audit/audit.log

SElinux的圖形化管理工具

[[email protected] selinux]# system-config-selinux

Selinux的基本操作

查看檔案:ls –Z(--context)

[[email protected] ~]# ls -Z

drwx------ root root root:object_r:user_home_t Desktop

-rw------- root root system_u:object_r:user_home_t anaconda-ks.cfg

-rw-r--r-- root root root:object_r:user_home_t install.log

-rw-r--r-- root root root:object_r:user_home_t install.log.syslog

[[email protected] ~]# ls --context

drwx------ root root root:object_r:user_home_t Desktop

-rw------- root root system_u:object_r:user_home_t anaconda-ks.cfg

-rw-r--r-- root root root:object_r:user_home_t install.log

-rw-r--r-- root root root:object_r:user_home_t install.log.syslog

查看檔案系統的擴充屬性:getfattr

[[email protected] ~]# getfattr -m. -d /etc/passwd

getfattr: Removing leading '/' from absolute path names

# file: etc/passwd

security.selinux="system_u:object_r:etc_t:s0\000"

查看的檔案的 security.selinux 屬性中儲存了此檔案的安全上下文, 所以上面例子中的上下文就是 system_ubject_r:etc_t 。

所有運行了SE Linux的ext2/3檔案系統上都有 security.selinux 這個屬性。

變更檔的擴充屬性標籤:chcon (不能在 /proc 檔案系統上使用,就是說 /proc 檔案系統不支援這種標記的改變。)

[[email protected] test]# ls --context aa.txt

-rw-r--r-- root root root:object_r:user_home_t aa.txt

[[email protected] test]# chcon -t etc_t aa.txt

[[email protected] test]# ls --context aa.txt

-rw-r--r-- root root root:object_r:etc_t aa.txt

恢複原來的檔案標籤: restorecon

[[email protected] test]# restorecon aa.txt

[[email protected] test]# ls -Z aa.txt

-rw-r--r-- root root user_u:object_r:user_home_t aa.txt

顯示目前使用者的Selinux context

[[email protected] ~]# id -Z

root:system_r:unconfined_t:SystemLow-SystemHigh

runcon 使用特定的context來執行指令

[[email protected] ~]# runcon -t user_home_t cat /etc/passwd

root:system_r:user_home_t:SystemLow-SystemHigh is not a valid context

查看某種服務是否受到SELinux的保護

[[email protected] ~]# getsebool -a (RHEL4:inactive受保護,active不受保護;RHEL5:off受保護,on不受保護)

linux 核心啟動錯誤和selinux參數 Kernel panic -not syncing:Attempted to kill init

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.