I want to start TigerVNC as a service via systemd on Alma Linux

Asked 1 years ago, Updated 1 years ago, 318 views

Background

I'm running Alma Linux to build a server.
I would like to work remotely in a GUI environment by installing a VNC server in Alma Linux.


I'm having a hard time getting in the VNC server. If you know the appropriate procedure, please let me know.

Current state

After installing the VNC server and starting it temporarily, it becomes inactive (dead) immediately.

Installing and Configuring vncserver Based on References

Boot Steps

 sudo systemctl start vncserver@:2
sudo systemctl status vncserver@:2

Startup Results

●vncserver@:2.service-Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)
   Active: active (running) since Fr 2022-10-14 18:48:27 JST; 1sago
  Process: 8388 ExecStartPre=/usr/libexec/vncsession-restore:2 (code=exited, status=0/SUCCESS)
 Main PID: 8408 (vncsession)
    Tasks:0 (limit:409535)
   Memory: 1.0M
   CGgroup: /system.slice/system-vncserver.slice/vncserver@:2.service
           ? 8408/usr/sbin/vncsession memo:2

October 14 18:48:27 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC) ...
October 14 18:48:27 localhost.localdomain systemd[1]: Started Remote desktop service (VNC).

If you re-enter sudo systemctl status vncserver@:2, you will see the screen below.

●vncserver@:2.service-Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Fr 2022-10-14 18:45:55 JST; 1 min 55sago
  Process: 8281 ExecStart=/usr/libexec/vncsession-start:2 (code=exited, status=0/SUCCESS)
  Process: 8261 ExecStartPre=/usr/libexec/vncsession-restore:2 (code=exited, status=0/SUCCESS)
 Main PID: 8281 (code=exited, status=0/SUCCESS)

October 14 18:45:48 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC) ...
October 14 18:45:48 localhost.localdomain systemd[1]: Started Remote desktop service (VNC).
October 14 18:45:55 localhost.localdomain systemd[1]:vncserver@:2.service:Successed.

I was wondering if the configuration file of /etc/systemd/system/vncserver@:2.service was defective, but I didn't know how to change it.
Thank you for your cooperation.

configuration file

 [Unit]
Description= Remote desktop service (VNC)
After=syslog.targetnetwork.target

Service
Type = simple
ExecStartPre=+/usr/libexec/vncsession-restore%i
ExecStart=/usr/libexec/vncsession-start%i
PIDFile=/run/vncsession-%i.pid
SELinuxContext=system_u:system_r:vnc_session_t:s0

Install
WantedBy=multi-user.target

Logging on VNC Server startup

Using desktop session gnome

New'localhost.localdomain:2(nemoto)'desktop is localhost.localdomain:2

Starting desktop session gnome


Xvnc TigerVNC 1.12.0-build Apr 18 2022 14:13:34
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12011000, The X.Org Foundation


Pri Oct 14 21:30:19 2022
 vncext —VNC extension running!
 vncext —Listening for VNC connections on all interface(s), port 5902
 vncext —created VNC server for screen 0
xinit —XFree86_VT property unexpectedly has 0 items installed of 1
xinit:connection to X server lost
^M
waiting for X server to shutdown
Fri Oct 14 21:30:24 2022
 SharingUpdateTracker: 0 pixels in / 0 pixels out
 SharingUpdateTracker: (1:-nan ratio)

running environment:
tigervnc server 1.12.0
AlmaLinux 8.4 (Electric Cheetah)

References
How to install and configure VNC remote access for GNOME desktops in CentOS 7
TigerVNC in alma linux

linux centos systemd vnc

2022-10-15 09:42

1 Answers

It should be Type=forking instead of Type=simple.
In addition, the display number (:2) and user association are required in /etc/tigervnc/vncserver.users.
VNC Server startup logs will be printed in the user's .vnc/hostname:2.log, so please check them as well.


2022-10-15 09:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.