VNC server's systemd service

Hello, I am trying to set up a VNC server on my new Manjaro machine and am failing miserably. I was able to do this on a Ubuntu machine and so am not totally clueless (although close to it).

Question 1

Is there a beginner-friendly tutorial for how to do this? Such a tutorial would skip no step and not use sophisticated devices such as using cat in terminal to create a file. If I am given such help, I may not have to ask detailed questions here.

Question 2

This question assumes that a tutorial for a beginner is not available.

In that case, my first difficulty is with having to use systemd to start the VNC server instead of directly using the vncserver command (as I did in Ubuntu).

I assume the above based on the following bit from this source: TigerVNC - ArchWiki

Note: Direct calls to /usr/bin/vncserver are not supported as they will not establish a proper session scope. The systemd service is the only supported method of using TigerVNC. See: Issue #1096.

Here comes question 2 then. (It will tell just how clueless I am.)

Question 2: Do I have to make a vncserver.service file to put in /etc/systemd/system?

I ask the question because the following tutorials make no mention of making a systemd service file for VNC. They only speak of starting or enabling one as if one should already be there for me.

But these other tutorials go in great detail about making a service file and what to put in it.

I can tell you that I never made a systemd service file before. The only other experience I have had is starting and enabling sshd (which I never had to make).

If I am told that I have to make a service file for VNC, that will open up a whole wild array of issues because the samples I find use a language I don’t understand and are wildly different one from another.

But I would like to know for sure that I have to go there.

Apologies for the extreme beginner level nature of this post. Thanks.

No - you don’t - the service is part of the package

You already linked to [root tip] [How To] TigerVNC over SSH which is

Remember to setup the ssh service beforehand following [root tip] [How To] Set up your own SSH service

For completeness there is another topic on the matter - but not easily understood and prone to errors. In your case - I recommend to stick to the above.


That’s great. Thank you.

On SSH, my VNC sessions will always be within LAN (just to the other computer in the next room).

Question 3:
To skip the SSH part, what I should I do in ~/.vnc/config:
(a) Not enter localhost, (b) enter #localhost, (c) enter localhost no, or (d) enter localhost=no.

I have seen all of these somewhere.

As you stated - complete beginner - I recommend sticking to the guide to get it runing.

When you understand the basics you can begin making your own changes.

Yes I agree completely in principle.

But the SSH element gives me another chance to get something wrong. (I can set up the tunnel wrong.)

It’d be great if you or anyone could tell me what to put in ~/.vnc/config so the VNC server would accept a connection either way, over SSH or not.

As is, I have succeeded in:

  • getting sudo systemctl start vncserver@:1.service to run at the server (at least it did not yield an error message).
  • getting the viewer machine to start an SSH tunnel forwarding its 15901 to the servers 5901.

But when I try connecting “over SSH” I fail:

[luna@jar ~]$ channel 3: open failed: connect failed: Connection refused
channel 3: open failed: connect failed: Connection refused

I am not sure what to make of “channel 3” as I gave :1=luna in the vncserver.users.

Question 4:
Once vncserver@:1 has been enabled, I find out that on reboot I cannot login to a GUI session of Manjaro (at the server machine). I had to use Ctrl + Alt + F2 to log into terminal and stop the service before I could log into GUI. Is this normal? (If so, that would make this VNC less useful than I had with Ubuntu, where the person at the server machine and someone at a VNC session could both have GUUI access.)

Read the guides - only change what is mentioned - replace the variables with values matching your system - it will create less frustration and in due time you will understand why it works.

I can tell you I read the guide and did not deviate from it the least bit. You said e.g. :3, and so I used :1 but I also tried :3. Oh yes, I used 15901 instead of 9903 for the start of tunnel if that’s a deviation. In short, I am following you exactly and failing. It would be a huge help if you or anyone could tell me how to eliminate the SSH layer so I can have one less chance to fail.

The cause of my problem was apparently having a GUI session at the VNC server machine.

I was able to resolve this by not starting one there. For example:

  1. Start Manjaro
  2. Ctrl + Alt + F2 > log in
  3. $ sudo systemctl start vncserver@:1
  4. At the viewer machine use: [server machine’s IP address]::5901 or [IP address]:5901 (single colon) depending on the viewer.

The so-called guideline for beginner linked here does not even address the issue and was probably not aware of it, simply assuming the use case it faced applied to other people as well.

By the way on question 3, the answer is not to enter localhost if you did not want to bother way an SSH tunnel.

I do not know as yet whether not entering localhost also lets you connect over SSH.

See for more:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.