● vncserver.service - VNC Server Loaded: loaded (/etc/systemd/system/vncserver.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2023-06-06 16:25:57 CST; 19s ago Process: 2556 ExecStartPre=/usr/bin/vncserver -kill : > /dev/null 2>&1 (code=exited, status=1/FAILURE) Jun 06 16:25:57 paddlepi vncserver[2556]: [:<number>|:*] VNC server to kill, * for all Jun 06 16:25:57 paddlepi vncserver[2556]: [-dry-run] Take no real action Jun 06 16:25:57 paddlepi vncserver[2556]: [-verbose] Be more verbose Jun 06 16:25:57 paddlepi vncserver[2556]: [-clean] Also clean log files of VNC session Jun 06 16:25:57 paddlepi vncserver[2556]: vncserver -list List VNC server sessions Jun 06 16:25:57 paddlepi vncserver[2556]: [:<number>|:*] VNC server to list, * for all Jun 06 16:25:57 paddlepi vncserver[2556]: [-cleanstale] Do not list stale VNC server sessions Jun 06 16:25:57 paddlepi systemd[1]: vncserver.service: Control process exited, code=exited status=1 Jun 06 16:25:57 paddlepi systemd[1]: vncserver.service: Failed with result 'exit-code'. Jun 06 16:25:57 paddlepi systemd[1]: Failed to start VNC Server.
时间: 2024-03-09 10:50:17 浏览: 133
根据您提供的信息,vncserver 服务启动失败,主要原因是 ExecStartPre 命令执行失败。错误信息中提到了 "-kill" 参数,这个参数用于终止 VNC 会话,但是没有指定要终止的会话。因此,请尝试修改 vncserver.service 文件中的 ExecStartPre 行,将 "%i" 字符串替换为 "1",这样将终止所有 VNC 会话。改后的代码如下:
[Unit]
Description=VNC Server
After=syslog.target network.target
[Service]
Type=forking
User=root
Group=root
WorkingDirectory=/root
PIDFile=/root/.vnc/%H%i.pid
ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
修改后保存文件,并重新启动 vncserver 服务,命令如下:
```
systemctl daemon-reload
systemctl restart vncserver
```
希望这能解决您的问题。
相关问题
给我翻译To set up VNC on Debian, you can follow these steps: Install a desktop environment if you haven't already done so. For example, you can install GNOME by running the command sudo apt-get install gnome-core. Install the VNC server software. One popular option is TigerVNC. You can install it by running the command sudo apt-get install tigervnc-standalone-server. Configure the VNC server. You can do this by creating a configuration file in the directory /etc/systemd/system. For example, you can create a file called vncserver@.service with the following contents: 复制 [Unit] Description=Start TigerVNC server at startup After=syslog.target network.target [Service] Type=forking User=%i ExecStart=/usr/bin/vncserver :1 -geometry 1280x800 -depth 24 -dpi 96 ExecStop=/usr/bin/vncserver -kill :1 [Install] WantedBy=multi-user.target This configuration will start the VNC server on display 1 with a resolution of 1280x800, a color depth of 24 bits, and a DPI of 96. You can modify these settings to suit your needs. Enable and start the VNC server. You can do this by running the following commands: 复制 sudo systemctl enable vncserver@:1.service sudo systemctl start vncserver@:1.service This will enable the VNC server to start automatically at boot time, and start the server immediately. Connect to the VNC server. You can use any VNC client software to connect to the server. For example, you can use RealVNC or TightVNC. Just enter the IP address of the Debian machine and the display number (in this case, :1) to connect.
在 Debian 上设置 VNC,您可以按照以下步骤操作:
1. 如果您还没有安装桌面环境,请先安装一个。例如,您可以通过运行命令 sudo apt-get install gnome-core 安装 GNOME。
2. 安装 VNC 服务器软件。一个受欢迎的选择是 TigerVNC。您可以通过运行命令 sudo apt-get install tigervnc-standalone-server 来安装它。
3. 配置 VNC 服务器。您可以通过在目录 /etc/systemd/system 中创建一个配置文件来完成。例如,您可以创建一个名为 vncserver@.service 的文件,其内容如下:
```
[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=%i
ExecStart=/usr/bin/vncserver :1 -geometry 1280x800 -depth 24 -dpi 96
ExecStop=/usr/bin/vncserver -kill :1
[Install]
WantedBy=multi-user.target
```
此配置将在显示器 1 上启动 VNC 服务器,分辨率为 1280x800,颜色深度为 24 位,DPI 为 96。您可以根据需要修改这些设置。
4. 启用并启动 VNC 服务器。您可以通过运行以下命令来完成:
```
sudo systemctl enable vncserver@:1.service
sudo systemctl start vncserver@:1.service
```
这将使 VNC 服务器在启动时自动启动,并立即启动服务器。
5. 连接到 VNC 服务器。您可以使用任何 VNC 客户端软件连接到服务器。例如,您可以使用 RealVNC 或 TightVNC。只需输入 Debian 机器的 IP 地址和显示器编号(在本例中为 :1)即可连接。
我现在是超级用户:这段话该怎么改:[Unit] Description=VNC Server After=syslog.target network.target [Service] Type=forking User=your_username Group=your_username WorkingDirectory=/home/your_username PIDFile=/home/your_username/.vnc/%H%i.pid ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
根据您的要求,我能理解为您想让这段话变得更加安全,不暴露您的用户信息。那么,您可以将 "your_username" 替换为一个您自己定义的用户名,这样就不会泄露您的真实用户名了。改后的代码如下:
[Unit]
Description=VNC Server
After=syslog.target network.target
[Service]
Type=forking
User=your_defined_username
Group=your_defined_username
WorkingDirectory=/home/your_defined_username
PIDFile=/home/your_defined_username/.vnc/%H%i.pid
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
阅读全文