VNC won't start CentOS 7

Issues related to applications and software problems
Post Reply
wb303
Posts: 6
Joined: 2014/08/05 23:06:44

VNC won't start CentOS 7

Post by wb303 » 2014/08/05 23:19:38

I have followed the directions provided by redhat in the rhel 7 admin guide to create an additional vnc connection, that is to:

cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service

Then edit it such that a user is defined as well as a geometry you want for a vnc session:

User=someuser
ExecStart=/sbin/runuser -l someuser -c "/usr/bin/vncserver %i -geometry 1280x720"

Then set a password for the vnc connection:

vncpasswd someuser

Then used the systemctl commands to enable it and start it but it immediately crashes:

[root@localhost ~]# systemctl enable vncserver@:2.service
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start vncserver@:2.service
Job for vncserver@:2.service failed. See 'systemctl status vncserver@:2.service' and 'journalctl -xn' for details.
[root@localhost ~]#
[root@localhost ~]# systemctl status vncserver@:2.service
vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@:2.service; enabled)
Active: failed (Result: exit-code) since Tue 2014-08-05 17:15:29 MDT; 24s ago
Process: 23836 ExecStart=/sbin/runuser -l someuser -c /usr/bin/vncserver %i -geometry 1280x720 (code=exited, status=1/FAILURE)
Process: 23828 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)

Aug 05 17:15:29 localhost runuser[23836]: runuser: may not be used by non-root users
Aug 05 17:15:29 localhost systemd[1]: vncserver@:2.service: control process exited, code=exited status=1
Aug 05 17:15:29 localhost systemd[1]: Failed to start Remote desktop service (VNC).
Aug 05 17:15:29 localhost systemd[1]: Unit vncserver@:2.service entered failed state.
[root@localhost ~]#

It doesnt seem to matter what geometry I choose and nothing is indicated in setroubleshoot. Anyone have any idea why this doesn't work?

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: VNC won't start CentOS 7

Post by scottro » 2014/08/06 01:37:51

Unfortunately, systemd breaks things that used to work and complicates what used to be trivial. I have a page on vnc in Fedora since systemd. It might be that you're not killing the /tmp/.X11-unix files. (Note the dot in front of the X11--it's a hidden file so be sure you put the dot there.)

Here's my page on it, for what it's worth--this was done for Fedora, and has a link to an informative thread on their forums.

http://srobb.net/rhvnc.html

Also, I would try it without the geometry at first and see if that helps.

My page only covers setting up one vnc session, but, back when I was using Fedora on a regular basis, it enabled me to set up multiple instances, just repeating for display 2 and so on.
New users should check the FAQ and Read Me First pages

wb303
Posts: 6
Joined: 2014/08/05 23:06:44

Re: VNC won't start CentOS 7

Post by wb303 » 2014/08/06 16:45:40

Thank you that is very informative, but it doesn't seem to be the issue. The /tmp/.X11-unix files never get created for X2 which I am assuming would be my display.
I do not have a .vnc/xstartup file for any users, could that be the issue?

wb303
Posts: 6
Joined: 2014/08/05 23:06:44

Re: VNC won't start CentOS 7

Post by wb303 » 2014/08/06 17:22:47

Figured it out, though not sure why it worked. It might have been vncpasswd.

What I had to do was run vncserver as the user I intend to use vnc with once, then kill the process and after that the service is able to start on its own. When running it the first time I was prompted to set vncpasswd again even though I had already done it for this user. The password ends up under /home/someuser/.vnc/ so it could also have been permission or context given that I created it as root.

Anyway literally what I did:

[someuser@localhost ~]$ vncserver :2 -geometry 1280x720

You will require a password to access your desktops.

Password:
Verify:

New 'localhost:2 (someuser)' desktop is localhost:2

Creating default startup script /home/someuser/.vnc/xstartup
Starting applications specified in /home/someuser/.vnc/xstartup
Log file is /home/someuser/.vnc/localhost:2.log

[someuser@localhost ~]$ vncserver -kill :2
Killing Xvnc process ID 11791
[someuser@localhost ~]$ sudo su -
[sudo] password for someuser:
Last login: Wed Aug 6 10:41:23 MDT 2014 on pts/1
[root@localhost ~]# systemctl start vncserver@:2.service
[root@localhost ~]#

Post Reply