Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
X Session for VNC
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

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


Joined: 16 May 2019
Posts: 7

PostPosted: Mon Aug 12, 2019 6:30 pm    Post subject: X Session for VNC Reply with quote

I am running gentoo as bare metal OS, and have a couple of VMs running.

Is there a way to start a VNC client from the command line to view each VM, without having to install a Desktop environment on my base system? E.g., starting a dedicated X session to connect to the VNC client only?
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Tue Aug 13, 2019 9:33 am    Post subject: Reply with quote

Hi, I believe what you have is a very interesting question but I am confused. Do you want no Desktop Environment on host or guest OS. Are you trying to create a headless server (meaning with no display at all) that will house VM's in other words? I think that even without a graphical server setup for your Gentoo host, in other words no connection to the physical graphics card or anything like that it is possible to virtualize the entire thing, and yes even forward it over the network with a tool like VNC. There are likely to be different solutions and these various answers could depend on several things including something like the number of expected virtual guests you choose to support and whether that will scale up at a future time. Assuming you are not building some insane cloud virtualization platform then I would think, and I am no expert but just trying to help here, what I would suggest is make the effort to combine the networking capabilities of the VM's with the important graphical session that will need to be installed onto each guest virtual machine. By working at the level of the guest environment, you will not be burdened by the managing of hyperv function or purposes that could make the whole thing lots more complicated. Also you will be leveraging something that each of the guests should have built into them which is a virtualized graphics card and network interface.

And as you suggest I believe the software for VNC (at least the one I use, x11vnc) is capable of being run with or without an existing display and if there is none then it creates a new screen and display to attach to for your connection. As I mentioned this will probably only work if you are restricted to just managing several VM's only since you will need to take a few minutes to install the software on each one, but there is hardly any configuration necessary except for maybe your network connections in the guest operating system. And yes by the way what you said for connecting to the VM's via VNC can work with or without a DE installed on the host or guest VM's as well.

Reading some documentation about x11vnc and hopefully that would provide one nice way of turning those guests into client/servers.
Best of luck!
Back to top
View user's profile Send private message
C5ace
Guru
Guru


Joined: 23 Dec 2013
Posts: 474
Location: Brisbane, Australia

PostPosted: Tue Aug 13, 2019 9:50 am    Post subject: Reply with quote

If your VMs are VirtualBox, you can run VirtualBox Remote Desktop. No need for X on the host or VNC. You will need X on the PC to display the VirtualBox Desktop, Mouse amd Keyboard, Sound. Read the VirtualBox Help for details.
_________________
Observation after 30 years working with computers:
All software has known and unknown bugs and vulnerabilities. Especially software written in complex, unstable and object oriented languages such as perl, python, C++, C#, Rust and the likes.
Back to top
View user's profile Send private message
mephistopheles
n00b
n00b


Joined: 16 May 2019
Posts: 7

PostPosted: Tue Aug 13, 2019 11:20 am    Post subject: Reply with quote

Thanks a lot for the helpful input!

Sorry if this point was not clear: most of the guest OSs (Windows machine, Ubuntu machine, pfSense) do have desktop environments. However, I noticed that I was nearly always launching the desktop on my host OS (Enlightenment) just so I could open a VNC window to the localhost and connect to the guest VMs. And I thought whether it would be possible to avoid having to go through the host desktop to reach the guest desktop.

I do not need a desktop for the everyday tasks of my host OS, so I could probably even remove it and make the system lighter.

My setup is not a headless server, it is a workstation. However, all the VMs are running headless (QEMU + KVM + VNC listening locally) except when I connect to them through a VNC client.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Tue Aug 13, 2019 9:31 pm    Post subject: Reply with quote

Which vnc server are you using? Maybe you can script the whole thing or set it up as a service so that when the guest OS launches VNC is auto-started...from the looks of the guests you are running if you decided to go this route it might be a bit more involved in terms of learning how to figure out a setup on each system slightly differently. There are tools for KVM that may extend the functionality and allow you to do this.

Spice is one solution and should be seen here: https://wiki.gentoo.org/wiki/QEMU/Windows_guest#SPICE

(Note you will need to install some client side applications to access it as well as configure qemu to use it on the machine hosting your VMs)

The link also contains some nice shell scripts that will help you to start your VMs, probably from the CLI so you will not need to launch any DE beforehand.

Let me know if this is what you wanted.
Back to top
View user's profile Send private message
baaann
Guru
Guru


Joined: 23 Jan 2006
Posts: 558
Location: uk

PostPosted: Tue Aug 13, 2019 9:38 pm    Post subject: Reply with quote

I cannot find an ebuild but maybe fbvnc will do what you are looking for?

https://github.com/zohead/fbvnc
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3267
Location: Canada

PostPosted: Tue Aug 13, 2019 9:53 pm    Post subject: Reply with quote

mephistopheles wrote:
Thanks a lot for the helpful input!

Sorry if this point was not clear: most of the guest OSs (Windows machine, Ubuntu machine, pfSense) do have desktop environments. However, I noticed that I was nearly always launching the desktop on my host OS (Enlightenment) just so I could open a VNC window to the localhost and connect to the guest VMs. And I thought whether it would be possible to avoid having to go through the host desktop to reach the guest desktop.

I do not need a desktop for the everyday tasks of my host OS, so I could probably even remove it and make the system lighter.

My setup is not a headless server, it is a workstation. However, all the VMs are running headless (QEMU + KVM + VNC listening locally) except when I connect to them through a VNC client.



Think of it - something has to draw on a screen of your host PC. What will it be in your setup ?
Back to top
View user's profile Send private message
mephistopheles
n00b
n00b


Joined: 16 May 2019
Posts: 7

PostPosted: Tue Aug 13, 2019 10:02 pm    Post subject: Reply with quote

Thanks for the ideas. I'll look into those packages later. I got my VMs running headless and listening on 5900-5903 just fine, so that is currently not an issue.

What is going to write on my screen? Yes, that is exactly the question! A minimal X environment, maybe? Or is there some kind of dedicated tool? Would it be possible to link to my VNC client on .xinitrc, for instance, and script something like "startx vm1"? I have tried that way, but could not get it to work yet.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Tue Aug 13, 2019 10:32 pm    Post subject: Reply with quote

Interesting, I've been working with remote/headless systems for decades. Never felt the need for VNC. Probably need it for Windows - but what it might be only Windows can do headlessly? All *nix systems can be accessed over SSH, applications have web interfaces which negate the need for generic GUI. Also, in *nix systems GUI applications can run remotely, no need for full desktop. Easier on resources, too.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Wed Aug 14, 2019 12:30 am    Post subject: Reply with quote

dmpogo wrote:

Think of it - something has to draw on a screen of your host PC. What will it be in your setup ?


dmpogo, not necessarily the case in theory since the host isn't going to be rendering or displaying any images anyhow it stands to reason (and seems to make sense too) that the graphical display on a guest machine could be independent of the host PC's environment. And the virtual hardware/software that it contains forwarded to another client access point. I do not believe it is necessary, but just that seems it should work to have an interactive GUI environment that is independent of individual applications, e.g. over SSH, but still no need for a X server on the host PC. I could be wrong though, but I think that is what SPICE will do.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21709

PostPosted: Wed Aug 14, 2019 1:28 am    Post subject: Reply with quote

dmpogo's point was that a VNC client cannot drive a graphics card directly. The guest VM can run with its output unshown, or that output can be shown. One way to show the output would be a VNC client. (As you say, SPICE is an alternative, although that is just a different way of presenting the same virtual display device.) That VNC client needs an X server, or if running on Windows or OS X, needs access to the equivalent windowing system there, to draw the data it receives from the guest. It doesn't necessarily need to render to a monitor attached to the system that runs the guests, but it must render somewhere - and wherever it renders, you need a program that knows how to drive the graphics card. Thus, the OP needs to decide on what system he wants to see the output, and how he will arrange for the VNC client to get the guest's screen to something that can draw on the screen. A minimal X session would work fine for this.

OP: Yes, you can start a VNC client from the command line, and have no desktop environment installed. No, you cannot in most cases get VNC to render straight to the graphics card. X is the most common, though not the only, way to drive the graphics card. It is likely the easiest to get working if you want a minimal environment.
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