LoginSignup
5
2

More than 1 year has passed since last update.

wslgでGUIを出そうとしたときに"Error: Can't open display: :0"と言われたときの対処法

Last updated at Posted at 2021-06-17

備忘録的な

問題

Error: Can't open display: :0

ってエラーが出た。

直し方

sudo rm -r /tmp/.X11-unix
ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

これ実行する。

ただ、再起動するとリセットされる。

もっといい方法があった。
下のやつを/etc/tmpfiles.d/wslg.confに追加すればいい。
そうすれば再起動しても問題ない。
https://github.com/microsoft/wslg/issues/43#issuecomment-826039096

#  This file is part of the debianisation of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

# See tmpfiles.d(5) for details

# Type Path           Mode UID  GID  Age Argument
L+     /tmp/.X11-unix -    -    -    -   /mnt/wslg/.X11-unix

5
2
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
5
2