Tiger VNC startup in RHEL 7
OS: RHEL 7
Used the instructions here:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-TigerVNC.html
Expected behavior:
systemctl start vncserver@:4.service should report a successful start.
Actual behavior:
Job for vncserver@:4.service failed. See 'systemctl status vncserver@:4.service' and 'journalctl -xn' for details.
Workaround: start vncserver manually by USER with "vncserver" command with no arguments. This means that for every server restart, each VNC user has to SSH in and initialize a vncserver manually, figure out which port it opened on, and connect to that. Sometimes users connecting this way report only a black screen w/ a cross-pointer.
Issue: What can I do to make the config files load VNC service (with active GUI) for each user automatically at boot-up, to their assigned TCP ports?
Command line log:
sudo systemctl start vncserver@:4.service
Job for vncserver@:4.service failed. See 'systemctl status vncserver@:4.service' and 'journalctl -xn' for details.
[stanasa@localhost ~]$ sudo systemctl status vncserver@:4.service
vncserver@:4.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@:4.service; disabled)
Active: failed (Result: exit-code) since Wed 2014-07-30 15:26:03 EDT; 10s ago
Process: 13245 ExecStart=/sbin/runuser -l stanasa -c /usr/bin/vncserver %i (code=exited, status=98)
Process: 13238 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Jul 30 15:26:03 localhost.localdomain systemd[1]: vncserver@:4.service: contr...
Jul 30 15:26:03 localhost.localdomain systemd[1]: Failed to start Remote desk...
Jul 30 15:26:03 localhost.localdomain systemd[1]: Unit vncserver@:4.service e...
Hint: Some lines were ellipsized, use -l to show in full.
###########
Content of /lib/ vncserver@:4.service, OWNED by root
...
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l stanasa -c "/usr/bin/vncserver %i -geometry 1200x900"
PIDFile=/home/stanasa/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
####### Content of home/USERNAME/.vnc/xstartup, owned by USERNAME
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc &
Responses
Hi Itay,
First of all, thank you very much for taking the time to report this issue. I tried to reproduce this on my Red Hat Enterprise Linux 7 machine and you are right that there is an error in the documentation. Could you please try running the following commands before attempting to start the service?
# su - stanasa
$ vncpasswd
Unlike the command mentioned in the documentation, these two commands will allow you to set the VNC password for user stanasa. Once this password is set, you should be able to start the VNC server as expected.
Please, let me know if this fixes the problem for you. In the meantime, I filed a bug against the System Administrator's Guide and I will make sure that it is resolved as soon as possible.
If you kill your vncserver or unexpected dead, Please read /var/log/messages and you can find .X started files with errors like below.
At first, please verify Xvnc process not running.
Dec 15 14:11:11 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X4-lock
...
Dec 15 14:12:52 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X11-unix/X4
then you remove
# rm -f /tmp/.X4-lock
# rm -f /tmp/.X11-unix/X4
and restart your vncserver.
# systemctl restart vncserver@:4.sevice
Hi,
Any answer for this issue?
I have the same error, and I tried all the above steps, but the error persists.
I followed instructions at:
https://access.redhat.com/solutions/966063
But I fail at the step:
systemctl start vncserver@:1.service
with the error message:
[root@localhost]# systemctl start vncserver@:1.service
Job for vncserver@:1.service failed. See 'systemctl status vncserver@:1.service' and 'journalctl -xn' for details.
And upon inspecting the status, I see:
[root@localhost ~]# systemctl status vncserver@:1.service -l
vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-02-11 10:09:35 EST; 9min ago
Process: 24429 ExecStart=/sbin/runuser -l dharmash -c /usr/bin/vncserver %i (code=exited, status=98)
Process: 24425 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Feb 11 10:09:35 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
Feb 11 10:09:35 localhost.localdomain systemd[1]: vncserver@:1.service: control process exited, code=exited status=98
Feb 11 10:09:35 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
Feb 11 10:09:35 localhost.localdomain systemd[1]: Unit vncserver@:1.service entered failed state.
Hello
Could you take a look through the procedure here, I have checked it recently: TigerVNC in the Red Hat Enterprise Linux System Administrator's Guide.
Minor point, you do not need to have the display number in the file name, because systemd automatically creates the appropriately named instance in memory on demand, replacing '%i' in the service file by the display number.
In vncserver@.service file, there are 2 that needs to be changed. The Quick HowTo in comment only mentioned * runuser -l -c /usr/bin/vncserver %i -arg1 -arg2 * but there is also * PIDFile=/home//.vnc/%H%i.pid that needs to be changed. *
Can the configuration file example get updated so only needs to be defined once as a variable? I am not really sure if there is a use case when PID file gets stored in another user's .vnc directory. At least pointing out both lines need to be modified will be greatly helpful. I overlooked the PID path for so long and thought it did not work on RHEL.
I found this out from /var/log/messages. In this fail case, Outputs from "systemctl status vncserver@:0.service" and "journalctl -xe" are misleading at best.
Thanks Stephen.
All I did was "reboot", and it seems to be working fine now.
I had tried "shutdown -r now" a few times last night, but for some reason the persisted every time.
But, somehow, unexplainable (by me), it seems to work fine now.
Just one follow up question:
I currently have the default (system generated) in $HOME/.vnc/xstartup
!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
If I want KDE upon starting, do I simply add the line:
startkde
Is that right?
Hello
maybe it was the:
~]# systemctl daemon-reload
step you had missed?
WRT trying to run KDE, first try without changing the " ~/.vnc/xstartup" file. Nothing will be run that you put below the " exec /etc/X11/xinit/xinitrc " line anyway.
The vncserver runs " ~/.vnc/xstartup", which runs " /etc/X11/xinit/xinitrc ". That in-turn calls Xclients. If you look in " /etc/X11/xinit/Xclients " you will see it tries to call various window managers . Look for PREFERRED=, what happens if you put KDE there?
Regarding Section 11.3. When implementing "systemctl start vncserver@:display_number.service" how do you know what to place in "display_number" if it's auto created by systemd? I've notice many online tutorials use "cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service" for this very reason.
Hello, you can put any suitable display number in that command and then systemd automatically creates the service for that display. This saves you from having to create a config file for each display number.
By convention, the display number is related to the port. See Configuring the Firewall for VNC in the System Administrator's Guide for more information on the ports used by VNC.
I had VNCserver running for a while, and then it just stopped one day after an update. I just discovered that when I was trying to start it manually, I was using systemctl start vncserver@1.service, not systemctl start vncserver@:1.service, which is why I was getting failures to start manually. But I'm still not sure how to determine what the cause was. It may have been a stale socket in /tmp/.X11-unix, as there was a file in there when I looked before, although removing it was obviously only successful once I started using the correct startup command.
I am getting below error when I submit "start system vncserver@:1.service", Job for vncserver@:1.service failed because a configured resource limit was execeed. See 'systemctl status vncserver@:1.service' and 'journalctl -xe' for details.
# sudo systemctl start vncserver@:1.service Job for vncserver@:1.service failed because a configured resource limit was exceeded. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details. [root@SIW ~]# sudo systemctl status vncserver@:1.service ● vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled) Active: failed (Result: resources) since Mon 2016-12-26 09:39:21 MST; 36s ago Process: 4774 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i -geometry 1280x768 (code=exited, status=0/SUCCESS) Process: 4771 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Dec 26 09:39:18 SIW systemd[1]: Starting Remote desktop service (VNC)... Dec 26 09:39:21 SIW systemd[1]: PID file /home/root/.vnc/SIW:1.pid not read...t. Dec 26 09:39:21 SIW systemd[1]: Failed to start Remote desktop service (VNC). Dec 26 09:39:21 SIW systemd[1]: Unit vncserver@:1.service entered failed state. Dec 26 09:39:21 SIW systemd[1]: vncserver@:1.service failed.
Please help me to solve this
Thank you,
Sanjeewa
Firtst of all, remove all files of the alphabet followed by a number
[root@xxx ~]# ls /tmp/.X
.X0-lock .X1-lock .X11-unix/ .X2-lock
[root@xxx ~]# rm -Rf /tmp/.X0-lock
[root@xxx ~]# rm -Rf /tmp/.X1-lock
[root@xxx ~]# rm -Rf /tmp/.X11-unix
[root@xxx ~]# rm -Rf /tmp/.X2-lock
And then, refer to the following Links/URLs Red Hat Customer Portal
The following shows that the process works fine.
[root@host07 ~]# systemctl status vncserver@:2.service
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)
Active: active (running) since 일 2017-04-09 10:55:56 KST; 7min ago
Process: 6566 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 6585 ExecStart=/sbin/runuser -l lee -c /usr/bin/vncserver %i -geometry 1280x768 -depth 16 (code=exited, status=0/SUCCESS)
Process: 6581 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 6624 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
‣ 6624 /usr/bin/Xvnc :2 -desktop host07.seoul.test:2 (lee) -auth /home/lee/.Xauthority -geometry 1280x768 -depth 16 -rfbwait 30000 -rfbauth /home/lee/.vnc/pass...
4. 09 10:55:53 host07.seoul.test systemd[1]: Starting Remote desktop service (VNC)...
4. 09 10:55:56 host07.seoul.test systemd[1]: Started Remote desktop service (VNC).
How is this any sort of an improvement over the previous version of Vnc server? Systemd gets to hand out the :X number?
just went to install this and am missing /etc/sysconfig/vncserver. RTFM .. yup looked over that. cant even find twm.
Is there a problem with associating One user to one port? Sure helps communication with my end users. Is there a better way to provide remote X for clients that are all over the planet?
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
