Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved]TigerVNC - Connect to main display - x0vncserver
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Mon Dec 09, 2019 5:31 pm    Post subject: [Solved]TigerVNC - Connect to main display - x0vncserver Reply with quote

Hello,

I installed and configured TigerVNC server of my Gentoo Machine. It works fine but the issue i'm having is that i need to connect to the main display of the machine and until now i was only able to connect to virtual displays.
Despite the lack of documentation available online, i was able to gather something about x0vncserver:

https://tigervnc.org/doc/x0vncserver.html

Apparently it comes with tigerVNC by default but i am unable to use this.

What i did so far:

Code:
occlus@Gentoo-PC ~ $ x0vncserver -display :0

Mon Dec  9 18:23:49 2019
 Geometry:    Desktop geometry is set to 1024x768+0+0
 XDesktop:    Using evdev codemap

 XDesktop:    XTest extension present - version 2.2
 Main:        failed to bind socket: Address already in use (98)


Something is already in use i don't even know what exactly.

In "/etc/conf.d/tigervnc" i have DISPLAY="my-username:1"
This is the virtual display that i usually connect to and i changed the value of 1 to 0 with the hope to recognize that 0 was the main display but it makes the value 0 just another virtual display. It makes no difference at all.

I'm stuck at this and i don't know how to proceed.

Any advise would be deeply appreciated.

Kind regards,


Last edited by C666PO on Fri Dec 20, 2019 7:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14560

PostPosted: Tue Dec 10, 2019 1:47 am    Post subject: Reply with quote

Are you sure this is the solution you want? Every time I've looked at this, I've hit a problem that is for me an unacceptable limitation: the VNC viewer sees a copy of whatever is on the X11 display's screen, so if I lock the console, the viewer sees only the lock dialog. If the viewer unlocks the system remotely, the console unlocks too, and anyone standing near the console's monitor can watch or interact with the system.

As an alternative that avoids this, I use xpra. It runs a headless X server. You connect your X applications to it, rather than your real X server. You run an xpra viewer which renders the windows of the headless X server on your real X server. When you want to work remotely, then you lock the local X server, go to your remote system, and start an xpra viewer there. Your applications aren't even aware they are rendered elsewhere, because as far as they are concerned, they have been using the headless X server the whole time. Additionally, unlike VNC, every application window gets its own xpra-forwarded window, so you can intermix local X application windows with xpra-forwarded ones.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Tue Dec 10, 2019 2:47 pm    Post subject: Reply with quote

Hi Hu,

I'll be honest with you, it's not what i want it's what i need.

I need it because i am unable to manage my virtualbox VMs with VNC, in fact i can't even start virtualbox while in vnc, i have to be in the main display. I also use ExpressVPN and very unfortunately they don't have a setup for Gentoo, as a client i made a request for the engineers to work on a setup for Gentoo but meanwhile this is not possible and these kind of requests might depend on the number of clients requesting the same, so i found a way to use OpenVPN while using an ExpressVPN configuration file and once more, i can't connect OpenVPN while in the VNC, it only works when i'm in the main display.

I've never heard about the "xpra", i'll make a research to know more about it. Do you know if openvpn and virtualbox will work with it ?

Any other method to run openvpn and virtualbox is fine, i don't really depend on VNC, i just need something to manage these 2 programs.

Kind regards,
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14560

PostPosted: Wed Dec 11, 2019 2:36 am    Post subject: Reply with quote

As a command line program, OpenVPN should work fine with VNC, X11, xpra, or even just ssh. VirtualBox may insist on a GUI, but it really should work under VNC. Could you explain how OpenVPN fails when used remotely? My guess is that it works fine, but that your routing is incorrect and breaks the VNC connection.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Wed Dec 11, 2019 3:00 pm    Post subject: Reply with quote

Hi Hu,

You're absolutely right! OpenVPN works fine by terminal or by virtual display, i believe i didn't use sudo before and that's what made it fail. I was probably distracted, my bad.

Concerning VirtualBox, this is the message i get:

Code:

No protocol specified
Qt WARNING: could not connect to display :1
Qt FATAL: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, minimal, offscreen, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted


I re-installed virtualbox but made no difference. I installed xcb but makes no difference as the message is exactly the same. I'm using KDE plasma on Xorg, i didn't install any other plugin because i'm using xorg and i don't know what i should install.

I found another way to connect to the main display using x11vnc, it works but it's really buggy. Sometimes it crash(I'll try to reproduce the crash and get the error informtion), shift key doesn't work unless i use the option -nomodtweak and holding keys don't work. An example: While reading the man page, i hold the arrow down key and it doesn't work, it goes just one space so if i want to go to the bottom page i have to perform a million clicks which is annoying.

Kind regards,
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14560

PostPosted: Thu Dec 12, 2019 2:28 am    Post subject: Reply with quote

What did you run that produced that message from VirtualBox? If you instead insert the command xmessage before the command to run VirtualBox, so that you should get a message box showing your command line, what happens? Do you get the message box or do you still get an error? To me, that error says you tried to run an X11 program in a setup where it can't work, such as due to missing Xauthority data.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Thu Dec 12, 2019 11:59 am    Post subject: Reply with quote

Hi Hu,

I simply tried to run virtualbox in the virtual display. In the main display the command " sudo virtualbox " launch virtualbox normally, but in the virtual display i receive this error message.

Code:
occlus@Gentoo-PC ~ $ sudo virtualbox
Password:
No protocol specified
Qt WARNING: could not connect to display :1
Qt FATAL: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, minimal, offscreen, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted


Code:
occlus@Gentoo-PC ~ $ xmessage sudo virtualbox
Warning: Missing charsets in String to FontSet conversion


With thanks and regards,
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14560

PostPosted: Sat Dec 14, 2019 2:09 am    Post subject: Reply with quote

My prior post may have been unclear, since I wasn't expecting you to be using sudo to run a GUI program. Please try sudo xmessage virtualbox, not xmessage sudo virtualbox.

Your latest output seems to indicate that sudo is discarding needed environment variables, such as $XAUTHORITY. If $XAUTHORITY is unset, then a default value is assumed. Your :0 display may have its X authority data in the default location, so the absence of $XAUTHORITY does not hurt. Your :1 display apparently does not put the authority data in the default location.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Mon Dec 16, 2019 2:25 pm    Post subject: Reply with quote

Hi Hu,

Sorry about that, i'm still new to linux. Sometimes i make these kind of mistakes but i always try to learn from them :)

Code:
occlus@Gentoo-PC ~ $ sudo xmessage virtualbox
Password:
No protocol specified
Error: Can't open display: :1


Quote:
Your :1 display apparently does not put the authority data in the default location.


Is there a way to force/fix this ?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14560

PostPosted: Tue Dec 17, 2019 12:36 am    Post subject: Reply with quote

I should note that conventional wisdom says never to sudo a graphical program. However, virtualbox documentation specifically tells you to sudo it, despite it being a graphical program.

You can probably fix where the authority data is stored, but how to fix it depends on how it is prepared now. How do you start the server that becomes display :1? What is the output of echo $DISPLAY ; echo $XAUTHORITY at the prompt where you ran sudo xmessage virtualbox? Your other option is not to change where it is stored, but instead configure sudo to pass the values through to virtualbox. For that, you want to read about how to "keep environment variables" in sudo; the variables you want to keep are DISPLAY and XAUTHORITY. Note the absence $ here. The $ is not part of the name. It is a traditional notation indicating environment variables, inspired by the fact that most shells use $ to introduce variable references.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Fri Dec 20, 2019 3:57 am    Post subject: Reply with quote

Hi Hu,

I added tigerVNC in OpenRC to start the server and in /etc/conf.d/TigerVNC i added DISPLAYS="Occlus:1" and i added "startkde" in /home/occlus/.vnc/xstartup

As root
Code:
Gentoo-PC /home/occlus # echo $DISPLAY
:1
Gentoo-PC /home/occlus # echo $XAUTHORITY
/root/.xauthvJMu4z


As normal user(no output whatsover):
Code:
occlus@Gentoo-PC ~ $ sudo echo $XAUTHORITY
Password:

occlus@Gentoo-PC ~ $ ^C


I also forgot to point out that when i do " xmessage virtualbox " with sudo or as root, it opens a window that says " okay ".

I'm also very happy to announce that i just noticed i can start virtualbox in display:1 if i start it as root! :D Maybe this is sufficient for you to guide me on why sudo doesn't work in this situation ? Maybe a correlation between the output of echo $XAUTHORITY with sudo and as root ?

Thanks so much for your time and help.
Back to top
View user's profile Send private message
C666PO
n00b
n00b


Joined: 21 Oct 2019
Posts: 20

PostPosted: Fri Dec 20, 2019 7:17 pm    Post subject: Reply with quote

Hi Hu,

The problem is solved. I added my username to the virtualbox group and i can now just do " virtualbox " in the terminal and the launches correctly.

Everything i need is now functional.

I appreciate your help in this matter.

With thanks and regards,
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum