我有一台没有连接外部显示器的Ubuntu 14.04服务器。我使用NoMachine远程控制这台机器。当我这样做时,Unity/Gnome界面无法检测到任何连接的显示器,所以我只能在使用NoMachine连接时使用800x600的分辨率。如果我插入一个显示器,我可以将分辨率设置为远程计算机上NoMachine窗口的大小。
有没有办法在Ubuntu上创建一个"虚拟"显示器设备,以便我可以在Unity/Gnome中设置桌面分辨率?
我有一台没有连接外部显示器的Ubuntu 14.04服务器。我使用NoMachine远程控制这台机器。当我这样做时,Unity/Gnome界面无法检测到任何连接的显示器,所以我只能在使用NoMachine连接时使用800x600的分辨率。如果我插入一个显示器,我可以将分辨率设置为远程计算机上NoMachine窗口的大小。
有没有办法在Ubuntu上创建一个"虚拟"显示器设备,以便我可以在Unity/Gnome中设置桌面分辨率?
sudo apt-get install xserver-xorg-video-dummy
/usr/share/X11/xorg.conf.d/xorg.conf
(或可能是/etc/X11/xorg.conf
)文件中(如果不存在,则创建一个):Section "Device"
Identifier "Configured Video Device"
Driver "dummy"
# Default is 4MiB, this sets it to 16MiB
VideoRam 16384
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x800"
EndSubSection
EndSection
sudo service lightdm restart
sudo su
sudo /etc/NX/nxserver --restart
exit
- Alexander Taylorsudo apt-cache search video-dummy
命令。 - cctan/usr/share/X11/xorg.conf.d/xorg.conf
并使用此内容,或者从http://xpra.org/xorg.conf获取内容后,我的Ubuntu无法启动(在登录屏幕之前卡在Ubuntu标志屏幕上)。可能是什么问题? - David Portabella--fb widthxheight
Reconfigures the screen to the specified size. All configured
monitors must fit within this size. When this option is not
provided, xrandr computes the smallest screen size that will
hold the set of configured outputs; this option provides a
way to override that behaviour.
xrandr --fb 1280x1024
xrandr --fb 1280x1024 -display :0
- TerranceNo protocol specified Can't open display :0
。我没有使用Wayland,但是当然我是通过SSH连接的。有解决办法吗? - Mark-X
或-Y
进行连接,并且已经启用了X11Forwarding
选项。我猜显示器是:0
,因为它是唯一返回No protocol specified
的,:1
只返回Can't open display
。无论如何,我正在使用gdm3
在X11
模式下(没有Wayland
)。 - Mark1
、分辨率为1024x76
的虚拟显示上启动lightdm。export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
sleep 1
#exec gnome-session & use gnome-session instead of lightdm
exec lightdm-session &
这是一个硬件解决方案/变通方法,对于某些图形硬件/驱动程序可能有效。如果您需要频繁插拔物理显示器,这个方法可能更好,因为您不必像使用虚拟/vesa/fb驱动程序(静态配置)那样重新启动X服务器。
要么购买一个虚拟VGA(或DVI模拟)插头,或者有些人称之为虚拟转接头。
要么自己制作,使用大约75欧姆(标准值)的3个电阻连接到VGA输出端口:1→6, 2→7, 3→8。
+/- 10欧姆的电阻也可能没有问题。有些显卡只需要一个电阻就能正常工作(比如我的英特尔显卡,2→7或3→8,会被识别为一台显示器)。顺便说一下,这是VGA显示器中实现的标准阻抗。
参考资料:如何为您的显卡创建虚拟插头。
对于那些对显示器及其分辨率检测感兴趣的用户,我建议阅读有关VESA DDC和EDID的相关内容。所有详细信息在这里:在没有连接显示器时添加虚拟显示
提示:对我来说,在编辑/etc/X11/xorg.conf而不是/usr/share/X11/xorg.conf.d/xorg.conf文件中起作用。
然后我编写了一个shell脚本(别忘了设置为可执行),并将其放在启动应用程序中。Create a 20-intel.conf file:
sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf
Add the following configuration information into the file:
Section "Device" Identifier "intelgpu0" Driver "intel" Option "VirtualHeads" "2" EndSection
This tells the Intel GPU to create 2 virtual displays. You can change the number of VirtualHeads to your needs.
#! /bin/bash
/usr/bin/xrandr -d :0 --output VIRTUAL1 --primary --auto
/usr/bin/xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900$
/usr/bin/xrandr --addmode VIRTUAL1 "1600x900_60.00"
/usr/bin/xrandr
cvt
命令生成一个xrandr行。例如,cvt 1920 1080
给我返回了Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
。同时要注意末尾的美元符号$。 - Ramon Poca# I think I may have spoken too soon. I was able to create a "virtual" display by adding a new mode to one of the disconnected displays listed in xrandr using
xrandr --addmode VIRTUAL1 1024x768
# I then simply enabled the display like you would normally:
xrandr --output VIRTUAL1 --mode 1024x768 --left-of HDMI3
# Furthermore, combined with x11vnc -clip, I am able to use this to convert my android tablet to a second monitor. The perfomrance is pretty crappy at the moment, unfortunately, but that's whole other area to be explored.
https://bbs.archlinux.org/viewtopic.php?pid=1410831#p1410831
sudo apt-get install xserver-xorg-video-vesa
Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 42.0 - 52.0
VertRefresh 55.0 - 65.0
Modeline "1024x768" 60.80 1024 1056 1128 1272 768 768 770 796
Modeline "800x600" 38.21 800 832 976 1008 600 612 618 631
Modeline "640x480" 24.11 640 672 760 792 480 490 495 50
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubsection
EndSection
sudo apt-get install xserver-xorg-video-dummy
/usr/share/X11/xorg.conf.d/xorg.conf