如何在 64 位 Arm 上将 VNC 作为系统服务运行?

如何在 64 位 Arm 上将 VNC 作为系统服务运行?

我正在跟进本指南在我的 Ubuntu arm64 机器上设置 VNC 服务器(具体来说,阿姆比安64 位)。到目前为止我发现了一个问题。

当我使用命令启动 VNC 服务器时vncserver :1 -localhost no,在我尝试从 VNC 客户端访问会话后,它不起作用并崩溃。

但是,当我尝试使用LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver :1 -localhost no命令时我发现这里,它开始工作了。

现在我想使用systemctl命令将其作为系统服务进行管理。所以,我有这个单元文件:

[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=zulh
Group=zulh
WorkingDirectory=/home/zulh

PIDFile=/home/zulh/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart="LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 /usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost no :%i"
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

现在当我跑...

$ sudo systemctl daemon-reload
$ sudo systemctl enable [email protected]
$ vncserver -kill :1
$ sudo systemctl start vncserver@1

...我懂了:

$ sudo systemctl status vncserver@1[email protected] - Start TightVNC server at startup
     Loaded: bad-setting (Reason: Unit [email protected] has a bad unit file setting.)
     Active: failed (Result: timeout) since Sat 2022-04-16 17:34:44 +08; 3min 42s ago

Apr 16 17:33:13 armbian gnome-session[18628]: gnome-session-binary[18628]: CRITICAL: We failed, but the fail whale is dead. Sorry....
Apr 16 17:33:13 armbian gnome-session-binary[18628]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
Apr 16 17:33:13 armbian gnome-session-binary[18628]: CRITICAL: We failed, but the fail whale is dead. Sorry....
Apr 16 17:34:41 armbian systemd[1]: [email protected]: start operation timed out. Terminating.
Apr 16 17:34:44 armbian systemd[1]: [email protected]: Failed with result 'timeout'.
Apr 16 17:34:44 armbian systemd[1]: Failed to start Start TightVNC server at startup.
Apr 16 17:34:49 armbian systemd[1]: /etc/systemd/system/[email protected]:13: Neither a valid executable name nor an absolute path: LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.s>
Apr 16 17:34:49 armbian systemd[1]: [email protected]: Unit configuration has fatal error, unit will not be started.
Apr 16 17:38:00 armbian systemd[1]: /etc/systemd/system/[email protected]:13: Neither a valid executable name nor an absolute path: LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.s>
Apr 16 17:38:00 armbian systemd[1]: [email protected]: Unit configuration has fatal error, unit will not be started.

我应该怎么做才能解决这个问题?

相关内容