Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to create a new X display?

Graphical Environments, Managers, Multimedia & Desktop questions.
Message
Author
frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

How to create a new X display?

#1 Post by frazatto »

I'm pretty sure this is not the best place to have this conversation, but I can't find a specific forum for this kind of things, so if you know a place to make questions about X11 and xlib development, please let me know.

I'm trying to find a way to create a a new X display, all the solutions I found so far lead to nowhere, I'm able to start a independent GUI session but they all keep reusing the same X display:0

Yes, I'm changing TTY.
Yes, I'm using the correct -- :1 argument.
Yes, I tried creating a different user to login at the other TTY.
I tried all the solutions on my working computer running Cinnamon and on my Raspberry, so it's not a problem of environment or GUI flavor.

It would be GREAT to be able to star a virtual display session like some some VNC solutions do, but I also can't find out how they do it.
It would also be great to do it programmatically using Xlib, but as far as I can tell it only provide methods for interacting with an existing display.

Any help would be appreciated, even if just pointing me in the right direction, thanks o/

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#2 Post by fabien »

This is what I get:

Code: Select all

$> ps aux | grep "startx"
user1    25601  0.0  0.0   2420  1556 tty2     S+   21:53   0:00 /bin/sh /usr/bin/startx -- :0
user2    25875  0.0  0.0   2420  1580 tty3     S+   21:54   0:00 /bin/sh /usr/bin/startx -- :1
$> echo "$DISPLAY"
:1.0
And I can start any display number that I want:

Code: Select all

$> ps aux | grep "startx"
user2    36061  0.0  0.0   2420  1576 tty3     S+   22:29   0:00 /bin/sh /usr/bin/startx -- :3
$> echo "$DISPLAY"
:3.0
man 7 X
DISPLAY NAMES
From the user's perspective, every X server has a display name of the form:
hostname:displaynumber.screennumber
[...]
displaynumber
The phrase "display" is usually used to refer to a collection of monitors that share a common set of input devices (keyboard, mouse, tablet, etc.). Most workstations tend to only have one display. Larger, multi-user systems, however, frequently have several displays so that more than one person can be doing graphics work at once. To avoid confusion, each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started.
And of course reusing the same display number triggers an error and X doesn't start. I believe I didn't understand the question?

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#3 Post by frazatto »

Yes, I think you understood my problem exactly.

What are you doing exactly?
Just changing TTY and calling startx after login???

The problem I have with your answer is that I can't test that solution on my work computer since Cinnamon doesn't use the startx command (WHAT does it use anyway???) and, I must assume, Raspberry OS is doing something different since I did just that for two days and it didn't work (it just broke xauthority eventually).

I tried installing xinit on my work computer, it's similar to startx, but it just broke when I forced a different display.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#4 Post by fabien »

frazatto wrote: 2022-06-02 21:19What are you doing exactly?
Just changing TTY and calling startx after login???
Yes
frazatto wrote: 2022-06-02 21:19The problem I have with your answer is that I can't test that solution on my work computer since Cinnamon doesn't use the startx command (WHAT does it use anyway???)
Cinnamon recommends cinnamon-core that depends on lightdm|gdm3|x-display-manager
x-display-manager can be provided by gdm3 lightdm lxdm nodm sddm slim wdm xdm (lightdm being cinnamon-core first choice)
frazatto wrote: 2022-06-02 21:19I tried installing xinit on my work computer, it's similar to startx, but it just broke when I forced a different display.
startx command is from xinit package. xorg package depends on xinit. Maybe try installing xorg? If that doesn't work, I think some people here know xserver problems better than I do.

User avatar
oswaldkelso
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1497
Joined: 2005-07-26 23:20
Location: UK
Has thanked: 1 time
Been thanked: 60 times

Re: How to create a new X display?

#5 Post by oswaldkelso »

I hesitate to answer because I don't run Debian on the desktop but both Gnome and therefore Cinnamon are heavy on the debends and focus on Wayland and systemd. Are the required packages installed? xwayland springs to mind as a package they may not deem required. What happens when you try and install say TWM
Free Software Matters
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian

User avatar
sunrat
Administrator
Administrator
Posts: 6497
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 476 times

Re: How to create a new X display?

#6 Post by sunrat »

Moved to Offtopic as it concerns RaspberryOS, not Debian. Did you try RaspberryOS forum?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
NorthEast
Posts: 351
Joined: 2018-11-18 04:35
Has thanked: 12 times
Been thanked: 30 times

Re: How to create a new X display?

#7 Post by NorthEast »

Is xnest an alternative?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: How to create a new X display?

#8 Post by Head_on_a_Stick »

frazatto wrote: 2022-06-02 21:19The problem I have with your answer is that I can't test that solution on my work computer since Cinnamon doesn't use the startx command
It does in Debian ;)
frazatto wrote:Any help would be appreciated, even if just pointing me in the right direction
https://forums.raspberrypi.com/
deadbang

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#9 Post by frazatto »

sunrat wrote: 2022-06-02 23:44 Moved to Offtopic as it concerns RaspberryOS, not Debian. Did you try RaspberryOS forum?
No man, I said I'm ALSO trying to make it work on the Raspberry and explained the results as a comparison, that is not an issue with the environment, I just don't understand the procedure since other people can easily reproduce it.

My computer runs Debian with Cinnamon, it would be nice to make it work on both since it's much easier to test graphical things on my computer than on a board hanging on my wall (yes, hanging on a string, next to the 3D printer :P).

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#10 Post by frazatto »

fabien wrote: 2022-06-02 22:43 Cinnamon recommends cinnamon-core that depends on lightdm|gdm3|x-display-manager
x-display-manager can be provided by gdm3 lightdm lxdm nodm sddm slim wdm xdm (lightdm being cinnamon-core first choice)
Ok, found a ArchLinux guide showing how to start Cinnamon from the terminal and it uses the command cinnamon-session, a quick look over --help and it accepts an argument to use a different display.

Code: Select all

cinnamon-session --display=:1
But it immediately exists saying "Connection refused" and "Cannot open display :1"

Ok.....maybe cinnamon can't create a new display by it's own?

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#11 Post by frazatto »

Hummm....

https://unix.stackexchange.com/question ... g-cinnamon

Ok, makes sense, Cinnamon is not the display manager.
The comments suggests to install xinit and xterm.

Now with:

Code: Select all

xinit cinnamon-session -- :1
Everything blinks, it seams to be working (even my second monitor lights up :D), but it fails saying "connection to X server lost".
No errors showing on the log.

What next?
I'm still annoyed that there is no startx command on my system.

User avatar
sunrat
Administrator
Administrator
Posts: 6497
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 476 times

Re: How to create a new X display?

#12 Post by sunrat »

frazatto wrote: 2022-06-03 13:12
sunrat wrote: 2022-06-02 23:44 Moved to Offtopic as it concerns RaspberryOS, not Debian. Did you try RaspberryOS forum?
No man, I said I'm ALSO trying to make it work on the Raspberry and explained the results as a comparison, that is not an issue with the environment, I just don't understand the procedure since other people can easily reproduce it.
My computer runs Debian with Cinnamon...
OK, that was unclear from your post. I'll move it back to Desktop & Multimedia seeing as it is about Cinnamon. You still get the same people reading it no matter which subforum it is in.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#13 Post by fabien »

I don't use Cinnamon so I can't help on that part. But this
frazatto wrote: 2022-06-03 14:26I'm still annoyed that there is no startx command on my system.
is normally not possible. As I said above, startx command is provided by xinit package:

Code: Select all

$> apt-file show xinit

xinit: /etc/X11/xinit/xinitrc             
xinit: /etc/X11/xinit/xserverrc
xinit: /usr/bin/startx
xinit: /usr/bin/xinit
xinit: /usr/share/doc/xinit/NEWS.Debian.gz
xinit: /usr/share/doc/xinit/changelog.Debian.gz
xinit: /usr/share/doc/xinit/changelog.gz
xinit: /usr/share/doc/xinit/copyright
xinit: /usr/share/man/man1/startx.1.gz
xinit: /usr/share/man/man1/xinit.1.gz
So if you have xinit you also have startx. Could you please paste the output of

Code: Select all

apt policy xinit
Xserver is convoluted, so using startx is probably the best method unless you're motivated to delve into a mass of documentation.

As a test, you can run in a tty:

Code: Select all

X vt2        ### if you are in tty2 (type 'tty' to find out which tty you are in)
This should launch X (just a black screen). Close it by pressing Ctrl-Alt-Backspace.
You can even choose an arbitrary display:

Code: Select all

X vt2 :5.0

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#14 Post by frazatto »

fabien wrote: 2022-06-03 22:48 So if you have xinit you also have startx. Could you please paste the output of

Code: Select all

apt policy xinit
Sure, but as I said, I had to install xinit myself.

Code: Select all

apt policy xinit
xinit:
  Installed: 1.4.0-1
  Candidate: 1.4.0-1
  Version table:
 *** 1.4.0-1 500
        500 https://deb.debian.org/debian bullseye/main amd64 Packages
        100 /var/lib/dpkg/status
There is no startx in my system at the location you shown.

fabien wrote: 2022-06-03 22:48 As a test, you can run in a tty:

Code: Select all

X vt2        ### if you are in tty2 (type 'tty' to find out which tty you are in)
This should launch X (just a black screen). Close it by pressing Ctrl-Alt-Backspace.
You can even choose an arbitrary display:

Code: Select all

X vt2 :5.0
Yes, that is the way I started testing since I couldn't find startx anywhere, it works as expected, everything black and both displays active. The recommendation than is to call cinnamon-session with the new display as parameter (from my normal session) and it almost works. Screen blinks but everything stays black and:

Code: Select all

$ cinnamon-session --display=:1
cinnamon-session[4354]: WARNING: t+0,00576s: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
At the other side, the X display just broke and there are no errors in the Log file.

I'm starting to think, there seams to be a strange problem with my installation, doesn't it?
How exactly is it working if none of the usual startup hooks are in place????

User avatar
NorthEast
Posts: 351
Joined: 2018-11-18 04:35
Has thanked: 12 times
Been thanked: 30 times

Re: How to create a new X display?

#15 Post by NorthEast »

frazatto wrote:
I had to install xinit myself.
....
There is no startx
As mentioned, startx is in the xinit package, so if xinit is installed, so is startx unless there's something very unexpected and odd:

Code: Select all

[tom@owl ~]$ apt-file show xinit
xinit: /etc/X11/xinit/xinitrc             
xinit: /etc/X11/xinit/xserverrc
xinit: /usr/bin/startx
xinit: /usr/bin/xinit
xinit: /usr/share/doc/xinit/NEWS.Debian.gz
xinit: /usr/share/doc/xinit/changelog.Debian.gz
xinit: /usr/share/doc/xinit/changelog.gz
xinit: /usr/share/doc/xinit/copyright
xinit: /usr/share/man/man1/startx.1.gz
xinit: /usr/share/man/man1/xinit.1.gz

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#16 Post by fabien »

frazatto wrote: 2022-06-04 19:02There is no startx in my system at the location you shown.
[...]
I'm starting to think, there seams to be a strange problem with my installation, doesn't it?
Quite possible.
Could you please paste the output of:

Code: Select all

#> dpkg --audit xinit
and

Code: Select all

#> dpkg --audit

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#17 Post by frazatto »

lol this just keep getting worse and worse

Ok, the commands you asked me to run all returned nothing.
I used every mean I know to try and find startx and it's not there, like at all.....

So I went nuclear, installed LXDE (being the most light weight GUI) alongside Cinnamon and NOWWWW I have startx at /user/bin/
Used the same procedure as before, change TTY and:

Code: Select all

startx startlxde -- :1
Now it does start a new GUI session at a new X display (in this case :1), but now I have 3 different terminal emulators and it only shows in my second monitor.....which means only the Nvidia driver is active.......****.......

Anyway, I have no idea why Cinnamon don't play along with startx in my system since everybody else uses it with no issue, but it's kind of working now, thank you fabien o/

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#18 Post by fabien »

frazatto wrote: 2022-06-05 15:04Ok, the commands you asked me to run all returned nothing.
It's a shame I made a mistake, the command I meant was

Code: Select all

dpkg --verify xinit
not 'dpkg --audit xinit'. You can still run

Code: Select all

#> dpkg --verify
to check your system sanity.
frazatto wrote: 2022-06-05 15:04I used every mean I know to try and find startx and it's not there, like at all.....
That's utterly weird :shock:
frazatto wrote: 2022-06-05 15:04So I went nuclear, installed LXDE (being the most light weight GUI) alongside Cinnamon and NOWWWW I have startx at /user/bin/
This is also weird, xinit is not a recursive dependency of lxde.

frazatto
Posts: 34
Joined: 2018-06-21 11:48
Has thanked: 3 times

Re: How to create a new X display?

#19 Post by frazatto »

fabien wrote: 2022-06-05 16:08 This is also weird, xinit is not a recursive dependency of lxde.
What can I say? It wasn't there before, it's there now and it "works" with the procedure I try before for three days with no results.

May I abuse of your hospitality a little longer?
I saw some examples of running programs on a different TTY just with X (like you asked me to try).
I'm trying to run a OpenGL window in a way that is independent from the default display :0.0, most posts say to use DISPLAY=:1 [program call] from my default session, it seams to work, it shows the new process ID and all, but the other TTY is still just black.

This would be an acceptable, and may be cleaner, solution.

But don't worry, you already helped me a lot and I could just create new thread.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 676
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 61 times
Been thanked: 159 times

Re: How to create a new X display?

#20 Post by fabien »

I've made some tests and this is what I get.

In user1 terminal:

Code: Select all

user1 $> echo "$DISPLAY"
:0.0
user1 $> su - user2
user2 $> export DISPLAY=':1.0'
user2 $> echo "$DISPLAY"
:1.0
### tests being made each time (X, twm, openbox, lxde)
user2 $> xterm
user2 $> glxgears
user2 $> xterm -e glxgears
on tty2:

Code: Select all

user2 $> X vt2 :1.0				### xterm and glxgears processes are present but don't show up

Code: Select all

user2 $> cat ~/.xsessionrc
export STARTUP=/usr/bin/twm
user2 $> startx				### xterm shows up, glxgears don't. xterm from 'xterm -e glxgears' shows glxgears frame rate.

Code: Select all

user2 $> cat ~/.xsessionrc
export STARTUP=/usr/bin/openbox-session
user2 $> startx				### xterm and glxgears show up

Code: Select all

user2 $> cat ~/.xsessionrc
export STARTUP=/usr/bin/startlxde
user2 $> startx				### xterm and glxgears show up
I personally would stick to startx as it handles security issues.
HTH, good luck

Post Reply