0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WSL2のOracleLinux8.6でsystemctlを使う

Posted at

概要

WSL2のOracleLinux8.6環境で

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

が発生した場合の対応方法です。

OSインストール時点の動作確認

WSL2にてOracleLinux8.6をインストールして起動した時点で稼働中のサービスを確認→ステータスを表示してみる

稼働中のサービス表示

$ systemctl list-unit-files -t service | grep enabled
autovt@.service                        enabled
getty@.service                         enabled
import-state.service                   enabled
loadmodules.service                    enabled
rsyslog.service                        enabled
selinux-autorelabel-mark.service       enabled
sshd.service                           enabled
syslog.service                         enabled
systemd-pstore.service                 enabled

sshdのステータス確認→表示に失敗する

$ sudo systemctl status sshd
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

PID1を確認

$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 09:19 ?        00:00:00 /init <- systemdではない
root        34     1  0 09:19 ?        00:00:00 /init

※systemdがPID 1でbootされていないから使えないらしい

genieのインストール

現時点で最新は2.5.1ですがいろいろ問題がおきるので今回は1.4.4

パッケージダウンロード

$ wget https://github.com/arkane-systems/genie/releases/download/v1.44/genie-1.44-1.fc34.x86_64.rpm

必要となるdaemonizeをダウンロード(1.7.8-6が最新のようですがいろいろ問題おきるので1.7.8-1)

$ wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/d/daemonize-1.7.8-1.el8.x86_64.rpm

インストール

$ sudo dnf install daemonize-1.7.8-1.el8.x86_64.rpm
$ sudo dnf install genie-1.44-1.fc34.x86_64.rpm

genieの初期化と反映 (-iは結構時間かかります)

$ genie -i
$ genie -s

動作確認

$ ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 09:52 ?        00:00:00 systemd  ←systemdになった
root          28       1  0 09:52 ?        00:00:00 /usr/lib/systemd/systemd-journald
root          43       1  0 09:52 ?        00:00:00 /usr/sbin/rsyslogd -n

$ sudo systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2023-10-21 09:52:37 JST; 9min ago
     Docs: man:sshd(8)
           man:sshd_config(5)

参考記事

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?