Fedora VNC Service Startup
I ran into some trouble getting VNC to load up after a system reboot. This is on a Fedora Core 18 system but may also be somewhat applicable to other versions of FC and CentOS systems as well.
This post assumes you already have VNC installed but are just having trouble getting it to start up.
In order to find out what's going on with the service you will probably run either of the following commands (or if you're looking to start it, you'll change status to start) (NOTE: commands will probably need to be run using sudo):
sudo systemctl status vncserver.service
sudo service vncserver status
Upon execution of the listed command you'll recieve an error indicating that things did not go as planned:
Loaded: error (Reason: No such file or directory) Active: inactive (dead)
Clearly not what you were hoping to see. As it turns out a likely cause is because the service has only been installed and configured to run manually, not setup to allow the service to start automatically or through service management tools.
Several references will tell you to check /etc/sysconfig/vncservers which will then point you to /lib/systemd/sysstem/[email protected] and in the right direction.
The second reference is the file that you need. This is a template to be able to start the vncservices as you expect. Open the file with your favorite text editor and read the top of it. The file should say something like this:
# Quick HowTo: # 1. Copy this file to /etc/systemd/system/[email protected]:<display>.service # 2. Edit "User" and "ExecStart" variables appropriately # (ExecStart should be "/usr/bin/vncserver %i -arg1 -arg2") # 3. Run `systemctl daemon-reload` # 4. Run `systemctl enable [email protected]:<display>.service`
Perform the steps as it states. It should be noted that <display> should be replaced by your designated display instance. Most people set the <display> variable to "1", meaning that your file name would then be [email protected]:1.service. The variable <USER> should be changed entirely to the username that you are running the vncserver connection under.
Once these steps are complete, you should have a new file under /etc/systemd/system/ with the adequate entries.
Now, all you should need to do is run the service/systemctl enable command followed by the start command as I've included below. Please note that the ln -s command listed is the output of the systemctl command in the line above, you should not need to enter it.
[[email protected]ost system]# sudo systemctl enable [email protected]:1.service ln -s '/etc/systemd/system/[email protected]:1.service' '/etc/systemd/system/multi-user.target.wants/[email protected]:1.service' [[email protected] system]# sudo systemctl start [email protected]:1.service
Assuming there are no additional errors you should be able to connect into your VNC session at this time.