You are not logged in.

#1 2016-12-16 19:57:27

Velines
Member
Registered: 2013-05-29
Posts: 8

Lightweight installation that just boots into two VMs

Hi everyone,

I want to create an installation that only boots into two virtual machines (preferably using KVM). I would like to be able to switch between the two with a keyboard shortcut, i.e. having two Xorg sessions and switch with CTRL+ALT+F7/F8. Is this possible? One VM will be Windows 10, the other one most probably Linux. No fancy 3D acceleration or similar is needed.
Is there a tutorial you can recommend?

Kind regards
Velines

Offline

#2 2016-12-16 21:46:32

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Lightweight installation that just boots into two VMs

It is possible. You don't need a tutorial for that kind of task. You already know what you want. Use the wiki. You need KVM virtual machines? Have a look at qemu. Multiple sessions, automatic login, small window managers, it's all in the wiki.

Offline

#3 2016-12-16 21:51:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: Lightweight installation that just boots into two VMs

Awebb wrote:

... small window managers...

Why?  He doesn't need window management.  Just run qemu, or whatever, fullscreen in each x session.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2016-12-16 22:32:37

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Lightweight installation that just boots into two VMs

Trilby wrote:
Awebb wrote:

... small window managers...

Why?  He doesn't need window management.  Just run qemu, or whatever, fullscreen in each x session.

A possible alternative to multiple X sessions.

Offline

#5 2016-12-16 22:34:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: Lightweight installation that just boots into two VMs

Ah, that makes sense.  That's the way I'd do it too - but the key combos in the first post were those for switching ttys, so that's where I was thinking.  No need for a WM in that case.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2016-12-16 22:51:38

Velines
Member
Registered: 2013-05-29
Posts: 8

Re: Lightweight installation that just boots into two VMs

I'm fine with either way, whatever is more stable. I think I'll try with a lightweight WM first, as I expect the nvidia driver to do funny stuff when trying to handle multiple X session.

Offline

#7 2016-12-16 23:56:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: Lightweight installation that just boots into two VMs

This would suffice as a wm - it just fullscreens all windows and allows for Alt-Tab window switching:

/* MINWM.C
 * Released to Public Domain
 * Compile: gcc -o minwm minwm.c -lX11
 */

#include <X11/Xlib.h>
#include <X11/keysym.h>

int main(int argc, const char **argv) {
   Display *dpy = XOpenDisplay(0x0);
   if (!dpy) return 1;
   Window root = DefaultRootWindow(dpy);
   int sw = DisplayWidth(dpy, DefaultScreen(dpy));
   int sh = DisplayHeight(dpy, DefaultScreen(dpy));
   XGrabKey(dpy, XKeysymToKeycode(dpy, XK_Tab), Mod1Mask, root, True, GrabModeAsync, GrabModeAsync);
   XSelectInput(dpy, root, SubstructureRedirectMask);
   XEvent ev;
   while (!XNextEvent(dpy,&ev)) switch (ev.type) {
      case KeyPress:
         XCirculateSubwindowsUp(dpy, root);
         break;
      case MapRequest:
         XMapRequestEvent *e = &ev->xmaprequest;
         XMoveResizeWindow(dpy, e->window, 0, 0, sw, sh);
         XMapWindow(dpy, e->window);
         break;
   }
   return 0;
}

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB