私はデスクトップUbuntu 18.04(GNOMEなど)を新しくインストールするときにTigerVNCが動作するように努めてきました。実行するとvncserver :1 -localhost no
完全に接続できますが、システムサービスが機能していないようです。
システム起動後のログイン:
Xvnc TigerVNC 1.7.0 - built Dec 5 2017 09:25:01
Copyright (C) 1999-2016 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11905000, The X.Org Foundation
Wed Jul 10 15:13:27 2019
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
vncconfig: unable to open display ":1"
** (process:1184): WARNING **: 15:13:28.311: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused
ターミナル()でvncserverを手動で起動してログインしますvncserver :1 -localhost no
。
Xvnc TigerVNC 1.7.0 - built Dec 5 2017 09:25:01
Copyright (C) 1999-2016 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11905000, The X.Org Foundation
Wed Jul 10 15:14:25 2019
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
after 175 requests (174 known processed) with 0 events remaining.
x 開始:
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic & dbus-launch --exit-with-session gnome-session &
[Unit]
Description=TigerVNC Service
After=syslog.target network.target
[Service]
Type=simple
User=<user>
PAMName=login
PIDFile=/home/<user>/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver :%i -localhost no
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
ベストアンサー1
数回の試行錯誤の後にユーザーがログインした後、ユーザーモードでプロセスを実行することにしました。ユーザーがログインした後にサービスが開始され、自動ログインが有効になっている場合は、私の目的に最適です。
ファイルを削除し、次の内容で新しいファイルを作成しました(そして欠落しているフォルダを作成しました)。/etc/systemd/system/[email protected]
$HOME/.local/share/systemd/user/[email protected]
[Unit]
Description=TigerVNC Service
[Service]
Type=forking
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver :%i -localhost no
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=default.target
その後、サービスを有効にしsystemctl daemon-reload --user
ますsystemctl enable vncserver@1 --user
。