LoginSignup
56
65

More than 5 years have passed since last update.

SELinuxの設定変更をし再起動した場合にカーネルパニックになる、という事象の原因・よくある設定ミスについて。

Last updated at Posted at 2014-10-14

概要

「SELinuxの無効化を設定して、再起動したらカーネルパニックが起きた」という事例を見かけた。
「SELinux カーネルパニック」などとググると「SELinuxを編集したらgrub.confも編集する必要がある」という記事が多数現れるが、おそらく問題の原因を見誤っている。
(私も昔やらかした)ありがちなミスとリカバリ方法を記述する。

SELinuxの無効化でのありがちなミス

SELinux無効化の恒久設定では以下のファイルを設定するが、以下のファイルにはパラメータが2つあるので注意が必要。SELINUX(7行目)前後に空行がなくコメントアウトが多いので見落としやすい。

・SELINUX(7行目)
・SELINUXTYPE(11行目)

/etc/selinux/config

[root@ldap01 ~]# less -N /etc/selinux/config

      1
      2 # This file controls the state of SELinux on the system.
      3 # SELINUX= can take one of these three values:
      4 #     enforcing - SELinux security policy is enforced.
      5 #     permissive - SELinux prints warnings instead of enforcing.
      6 #     disabled - No SELinux policy is loaded.
      7 SELINUX=enforcing
      8 # SELINUXTYPE= can take one of these two values:
      9 #     targeted - Targeted processes are protected,
     10 #     mls - Multi Level Security protection.
     11 SELINUXTYPE=targeted
     12
     13

SELINUX(7行目)をdisabledにするつもりが、SELINUXTYPE(11行目)をdisabledにしてしまい、rebootをかけると


Kernel panic - not syncing: Attempted to kill init!

などとカーネルパニックを引き起こす。

復旧方法

一応、記載。(「SELINUX カーネルパニック」でググると画像つきのblog記事が多数出てきます)

  1. デフォルトOS起動のカウントダウン画面で何かキーを押下
  2. GRUBメニューで起動OSを上下で選び、「e」キーを押下
  3. 「kernel」行を上下で選び、「e」キーを押下
  4. 末尾に「 enforcing=0」を追加(enforgincの前に空白を1つ入れる、イコールの入力は「^」キーを押せば入る)
  5. エンターキーで「kernel」を選んだ画面に戻る
  6. 「b」キーを押下し、OSを起動する。
  7. 起動後、/etc/selinux/configを確認・修正
56
65
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
56
65