LoginSignup
1
0

More than 1 year has passed since last update.

【備忘録】Ubuntu18.04でx11vncを使う

Posted at

はじめに

UbuntuでVNCをする方法を備忘録としてまとめておきます.
今更かもしれませんが,普段使う環境と異なり戸惑ったことをまとめておきます.
(Ubuntuデフォルトの画面を使いたくてx11vncをどうしても使いたかったという記事です)

環境

・Ubuntu Desktop 18.04.6 LTS
・CPUはIntel

問題点

①UbuntuデフォルトのVNC設定がバグってる!
VNCを使わないといけない状況になり,方法をググっていると,
Ubuntuの設定→画面共有→ONで簡単にできると出てきました.
(Ubuntu Desktopだからできる設定)
しかし,その設定にはバグがあり,ONにしてもすぐOFFになってしまいます(泣)
どうしてもこれが治らなかったので,手動でVNCを設定していこうと思います.

②モニターがないとVNCできない!
物理的にHDMIなどで出力していないとx11vncが使えないみたいです...

設定方法

https://qiita.com/chyonevvi/items/3d907464d11b2f056ef6
私は,以下の記事を参考に設定させていただきました.
とてもわかりやすくまとまっているので感謝です.

基本的には,参考にさせていただいた記事で設定が完了ですが,
問題点でも述べたように,実はx11vncはモニターがないと動かないのです.
簡単に説明すると,ディスプレイに映し出されたものを,複製してクライアントにも投げている仕組みなので,
モニターとの接続を切った(HDMIなどを抜いた)瞬間にvncができなくなってしまいます.
それをソフトウェア的にダミーのモニターを作って解決する方法をご紹介します.
(ハードウェア的に解決する方法もあり,「ダミーhdmiプラグ」などとググってみてください.)

早速,必要なパッケージを入れていきます.
(パッケージ名にubuntuのバージョンが入っているので,他のバージョンの場合は要確認)

$ sudo apt install xserver-xorg-video-dummy-hwe-18.04

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 xserver-xorg-video-dummy-hwe-18.04 : Depends: xorg-video-abi-24
                                      Depends: xserver-xorg-core-hwe-18.04 (>= 2:1.18.99.901) but it is not going to be installed

上記のような返答が返ってきて,xserver-xorg-video-dummy-hwe-18.04を入れるには,
xserver-xorg-core-hwe-18.04を入れろとのことです.
参考はこちら

$ sudo apt install xserver-xorg-core-hwe-18.04

そして,もう一度xserver-xorg-video-dummy-hwe-18.04をインストールします.

$ sudo apt install xserver-xorg-video-dummy-hwe-18.04

無事にインストールできたら,ダミーモニターの設定をしていきます.

/usr/share/X11/xorg.conf.d/20-dummy.conf
Section "Monitor"
Identifier "Monitor0"
HorizSync 5.0-200.0
VertRefresh 5.0-200.0
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
 
Section "Device"
Identifier "Card0"
Option "NoDDC" "true"
Option "IgnoreEDID" "true"
Driver "dummy"
EndSection
 
Section "Screen"
DefaultDepth 24
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
    SubSection "Display"
    Depth 16
    Modes "1920x1080"
    EndSubSection
EndSection

解像度は,cvtコマンドで確認できます.
参考はこちら

次に,/etc/gdm3/custom.confにあるWaylandEnable=falseのコメントアウトを外します.

/etc/gdm3/custom.conf
# Uncoment the line below to force the login screen to use Xorg
WaylandEnable=false

最後に,lightdmを再起動してあげると,VNC接続ができると思います.

sudo service lightdm restart
1
0
1

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