初期化システム
- Linux システムの起動とプロセス管理を担う
初期化システムとその違い
項目 | SysVinit | Upstart | systemd |
---|---|---|---|
起動方式 | - 直列起動 | - イベント駆動型 - 並列起動 |
- 並列起動 |
設定ファイル | - /etc/inittab - /etc/rc.d/
|
- /etc/event.d/ - /etc/init/
|
- /etc/systemd/system/ - /usr/lib/systemd/system/
|
起動速度 | - 低速 | - 中速 | - 高速 |
採用ディストリビューション | - 旧型(RHEL 6以前) | - Ubuntu 9.10〜14.10 | - 新型(RHEL 7以降、Ubuntu 15.04以降) |
コマンド | service |
initctl |
systemctl |
管理単位 | スクリプト | job | unit |
cgroups対応 | ❌ 非対応 | ⚠️ 限定的に対応 | ✅ 完全対応(リソース制御、階層管理など) |
SysVinit
-
init
の起動-
init
はカーネルによって/sbin/init
が呼び出されて開始される
-
-
init
の実行-
/etc/inittab
で、デフォルトのランレベルを確認する
-
- ランレベルに応じたサービスの起動
-
/etc/rc[0-6].d
または/etc/init.d/
ディレクトリ以下の起動スクリプトで、システムのサービスを開始、停止、再起動する
-
- プロセスのリリース管理
- サービスやプロセスの管理は
PID
(プロセスID)を使用する
- サービスやプロセスの管理は
- ログイン画面の表示
- サービスがすべて起動した後、
init
はログインプロンプトを表示する
- サービスがすべて起動した後、
systemd
-
systemd
の起動-
systemd
はカーネルによって/sbin/init
が呼び出されて開始される
-
-
systemd
の実行-
/etc/systemd/system/default.target
で、デフォルトのターゲットを確認する
-
- ターゲットに応じたUnitの読み込み・サービスの起動
-
/etc/systemd/system
ディレクトリ以下のターゲットに応じたUnitの読み込み・サービスを起動する - (
systemd
は、依存関係を考慮して並列でサービスを起動する)
-
- プロセスのリリース管理
- サービスやプロセスの管理に
cgroup
(コントロールグループ)を使用する
- サービスやプロセスの管理に
- ログイン画面の表示
- サービスがすべて起動した後、
systemd
はログインプロンプトを表示します
- サービスがすべて起動した後、
ランレベルとターゲット
ランレベル | ターゲット | |
---|---|---|
対象初期化システム | init(SysVinit) | systemd |
停止 | 0 | poweroff.target |
シングルユーザーモード | 1/s/S | rescue.target |
マルチユーザーモード (テキストログイン) |
2, 3, 4 | multiuser.target |
マルチユーザーモード (グラフィカルログイン) |
5 | grafical.target |
再起動 | 6 | reboot.target |
参考リンク
- Prepare for LPIC-1 exam 1 - topic 101.2: Boot the system
- Chapter 33. Boot Process, Init, and Shutdown
Ping-t
SysVinit
Upstart
systemd