我已经遵循了两个方向这里和这里。我已经走了很远,但这些指南的最后一个任务是运行systemctl start vncserver@:10.service
,但我收到了错误。
当我运行该命令时(其中 10 我认为是所谓的端口偏移量),我收到以下错误:
Job for vncserver@:10.service failed. See "systemctl status vncserver@:10.service" and "journalctl -xe" for details.
sudo
我已以和 as用户身份运行该命令root
。两次我都得到同样的错误。
总而言之,指南说:
yum install tigervnc-server
cp/lib/systemd/system/[email protected]/etc/systemd/system/[email protected]
编辑该文件以替换
user
变量重新开始 (
~]# systemctl daemon-reload
)放
vncpasswd
跑步:
systemctl enable vncserver@:display_number.service
跑步:
systemctl start vncserver@:display_number.service
这是输出systemctrl status vncserver@:10.service
● vncserver@:10.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:10.service; enabled)
Active: failed (Result: exit-code) since Fri 2015-04-10 04:26:21 UTC; 41s ago
Process: 22788 ExecStart=/sbin/runuser -l myusername -c /usr/bin/vncserver 10 (code=exited, status=126)
Process: 22785 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
这是输出journalctl -xe
Apr 10 04:44:59 democom runuser[23597]: pam_unix(runuser-l:session): session closed for user user1
Apr 10 04:44:59 democom systemd[1]: vncserver@:.service: control process exited, code=exited status=126
Apr 10 04:44:59 democom systemd[1]: Failed to start Remote desktop service (VNC).
-- Subject: Unit vncserver@:.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vncserver@:.service has failed.
--
-- The result is failed.
Apr 10 04:44:59 democom systemd[1]: Unit vncserver@:.service entered failed state.
Apr 10 04:44:59 democom systemd[1]: vncserver@:.service failed.
Apr 10 04:45:11 democom su[23801]: (to root) user1 on pts/1
Apr 10 04:45:11 democom su[23801]: pam_unix(su:session): session opened for user root by user1(uid=1000)
Apr 10 04:46:59 democom systemd[1]: Reloading.
Apr 10 04:46:59 democom systemd[1]: Configuration file /usr/lib/systemd/system/auditd.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restri
Apr 10 04:47:06 democom su[23833]: (to user1) user1 on pts/1
Apr 10 04:47:06 democom su[23833]: pam_unix(su:session): session opened for user user1 by user1(uid=0)
Apr 10 04:47:24 democom su[23833]: pam_unix(su:session): session closed for user user1
Apr 10 04:47:33 democom systemd[1]: Starting Remote desktop service (VNC)...
-- Subject: Unit vncserver@:display_number.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vncserver@:display_number.service has begun starting up.
Apr 10 04:47:33 democom systemd[1]: Starting Session c11 of user user1.
-- Subject: Unit session-c11.scope has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-c11.scope has begun starting up.
Apr 10 04:47:33 democom systemd[1]: Started Session c11 of user user1.
-- Subject: Unit session-c11.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-c11.scope has finished starting up.
--
-- The start-up result is done.
Apr 10 04:47:33 democom runuser[23853]: pam_unix(runuser-l:session): session opened for user user1 by (uid=0)
Apr 10 04:47:33 democom runuser[23853]: -bash: /usr/bin/vncserver: /usr/bin/perl: bad interpreter: Permission denied
Apr 10 04:47:33 democom runuser[23853]: pam_unix(runuser-l:session): session closed for user user1
Apr 10 04:47:33 democom systemd[1]: vncserver@:display_number.service: control process exited, code=exited status=126
Apr 10 04:47:33 democom systemd[1]: Failed to start Remote desktop service (VNC).
-- Subject: Unit vncserver@:display_number.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vncserver@:display_number.service has failed.
--
-- The result is failed.
Apr 10 04:47:33 democom systemd[1]: Unit vncserver@:display_number.service entered failed state.
Apr 10 04:47:33 democom systemd[1]: vncserver@:display_number.service failed.
我认为这display_number
是“端口偏移”(要添加到 5900 的端口数量),但这是我收到的错误。希望有任何帮助,谢谢。
答案1
您的日志中最相关的行是:
Apr 10 04:47:33 democom runuser[23853]: -bash: /usr/bin/vncserver: /usr/bin/perl: bad interpreter: Permission denied
是否有可能 perl 没有安装在 /usr/bin 中?否则,在执行该 perl 脚本的早期阶段似乎就会出现问题。一种调试方法是获取 systemd 单元文件中正在执行的任何命令并手动执行它,以查看错误是什么。
答案2
检查 /tmp/.X11-unix 目录是否有 X?文件已经存在(?显示#)。如果是,请 rm -f 该文件并重新启动 vncserver。如果没有的话,还有其他东西挡住了路吗?