xrandr,Can't open display
时间: 2024-04-29 14:21:41 浏览: 36
这个错误通常出现在你尝试在没有 X 窗口系统的环境下运行 xrandr 命令时。xrandr 命令需要一个 X11 服务器来运行,因为它需要访问显示器和图形处理单元。
如果你在远程连接到服务器上运行 xrandr,确保你已经启用了 X11 转发功能,并使用 -Y 参数连接到服务器,例如:
```
ssh -Y user@server
```
如果你正在本地运行 xrandr,但仍然出现此错误,请确保你已经启动了 X11 服务器,并且已经设置 DISPLAY 变量,例如:
```
export DISPLAY=:0
```
如果以上方法仍然无法解决问题,请检查你的图形驱动程序是否正确安装,并且你的硬件是否支持 X11。
相关问题
xrandr,Can't open display
The error message "Can't open display" usually means that the X11 server is not running or is not accessible. X11 is the graphical environment used by most Linux systems.
To resolve the issue, you may need to start the X11 server or set the DISPLAY environment variable correctly. Here are a few things you can try:
1. Check if the X11 server is running by running the "ps aux | grep Xorg" command. If it's not running, start it with the "startx" command.
2. Make sure you have permission to access the X11 server. You can try running "xhost +" to allow all users to connect to the X11 server.
3. Set the DISPLAY environment variable to the correct value. For example, if you're trying to run xrandr on a remote server, you'll need to set DISPLAY to the IP address of the machine you're connecting from, followed by ":0". Like this: export DISPLAY=192.168.1.100:0
Hopefully one of these solutions will help you fix the "Can't open display" error.
xrandr报错,Can't open display
xrandr 是一个命令行工具,用于配置 X Window System 中的显示设置。当出现 "Can't open display" 错误时,通常是因为 xrandr 无法连接到 X 服务器。
这个错误通常是因为没有正确设置 DISPLAY 环境变量,或者当前用户没有权限连接到 X 服务器。您可以尝试以下解决方法:
1. 确保 DISPLAY 环境变量被正确设置。DISPLAY 环境变量指定了 X 服务器的地址和端口号,例如 ":0"。您可以使用以下命令来设置 DISPLAY 环境变量:
```
export DISPLAY=:0
```
2. 如果您是通过 SSH 连接到远程主机并运行 xrandr,可以尝试使用以下命令启用 X11 转发:
```
ssh -X user@hostname
```
这将允许您在远程主机上运行应用程序并将其显示在本地 X 服务器上。
3. 如果您没有足够的权限连接到 X 服务器,可以尝试使用 sudo 或 su 命令以 root 用户身份运行 xrandr。
希望这些解决方法能够帮助您解决 xrandr 报错的问题。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)