0

I if install an OpenBSD 6.2, how can I run several X servers at a time?

Purpose: have 2 "X servers" running

Why?: one "X" would be used for general purposes, the other "X" would be used only for the Firefox. To have a more correct separation, if someone breaks the actual webbrowser.

Switching to the other "X" server would be with CTRL+ALT+F* ?

  • You can also use Xnest – user996142 Apr 19 '18 at 15:30
0

Good news: It is technically possible.

Bad news: It does not work under Xenocara (OpenBSD X11 clone) with out of DRI/KMS (kernel video driver) (X access hardware using /dev/xf86 in this case) but works on XOrg with Linux and FreeBSD. You can try if it works in your case. If you are using KMS then it will probably work.

Good news again: you do not need it because it does not increase security: web browser is X client: it runs as any regular process and uses X to display data.

X and virtual terminals.

PC video hardware is under control of OpenBSD console driver wscons which provides several virtual terminals (vt). When X launches, it borrows vt from wscons and from than moment it controls video by itself using its driver (directly using /dev/xf86 or using KMS driver in kernel). Keyboard control is also moved from wscons to X, so when you push CTRL+ALT+F* X asks wscons to switch to another vt and wscons gets video and keyboard back. So, you can have to X running on two different vts. X has an option vtXX to choose vt to borrow. Since running X with out of client makes no sense, you could do

 DISPLAY=:2 xinit xterm -- vt1 :2

Everything after -- is passed to X, so X will start on vt1. You then switch to the different vt and run

 DISPLAY=:3 xinit xterm -- vt3 :3

You now have 2 X servers. If it works, you can them configure your display manager (xenodm on OpenBSD) to pass vtXX option to X.

X, its clients and why there is no reason to run 2 X servers.

X client (be it xterm or firefox) uses DISPLAY environment variable to find its X server, connects to it and uses it to display data and read keystrokes.

So, client runs locally, it just uses different X servers to display data. Once your client hacked -- it does not matter which X server it is connected to.

PS: This is why Xenocara does not run on 2 different vts when using vesa(4) driver: it uses /dev/xf86 (aka option APERTURE)(xf86(4)) to access video memory and it sets lock on this device file. So, it may work with KMS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.