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 3 years have passed since last update.

WSL2でサービスを起動するとUnable to register authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failedになる

Posted at

環境

WSL2 Ubuntu20.04

問題のエラー

・最初に叩いたコマンドはこちら。
```
$ service apache2 restart

** (process:32041): WARNING **: 09:54:47.037: Unable to register authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject
Error registering authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject (polkit-error-quark, 0)
Failed to restart apache2.service: Interactive authentication required.
See system logs and 'systemctl status apache2.service' for details.
```

・よくわからなかったので、sudo で実行したら以下のようになりました。

$ sudo service apache2 start
Failed to retrieve unit state: Connection reset by peer
Warning! D-Bus connection terminated.
Failed to restart apache2.service: Connection reset by peer
See system logs and 'systemctl status apache2.service' for details.

以下、仮説です。(間違っているかもしれません)

<意訳>
unit(apache2のサーバーのこと)の状態取得に失敗しました。peer=同じもの をリセットしてください。
危険!:D-BUS(1台のコンピュータ上で動作する複数のプログラムの間で情報を交換するシステム。WSLのことかな?)の接続が終了しました!
apache2サービスの再起動に失敗しました。peer=同じもの をリセットしてください。
system logsを確認したり、ステータスを確認してください。

<想定>
peerとあるため、接続情報の何かがダブっているということではないか。
ちなみにコマンド 'systemctl status apache2.service'は同じエラーが出力されました。
ということで、再起動してみました。

$ sudo reboot
$ sudo service apache2 restart
Failed to connect to bus: Connection refused
Failed to connect to bus: Connection refused

エラー文が短くなって、嬉しいような悲しいような…。

解決方法

意外とあっけなく解決しました。

C:\Users\ryo>wsl --shutdown

すなわち、コマンドプロンプト上でWSLをシャットダウンするだけです。実際に再度Ubuntuを起動したら、普通にコマンド通りました。
このコマンドは『魔法の呪文』のようなもので、とりあえず詰まったら実行してみるとよいみたいです。
WSL2、奥が深い!(?)

お世話になったサイト:WSL2で困ったときに使う魔法の呪文

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?