You are not logged in.
I recently finished my first intall of arch, and installed gdm/gnome and i3. For now I mainly start x by hand.
Usually, at least in the distros i'm used to, x always starts in vt 7 (which is always reserved to GUI). On my new install, however the way i start x, the behavior of the tty chosen for GUI is weird:
- If i enable gdm at start, gdm starts in vt1, but any session i open displays in another (!!) vt, usually vt2 (i guess the first available vt); some other posts suggest to use 'GDM on Xorg' sessions to solve this, but it doesn't change anything
- When i use startx, the session always open in the current tty
- Even when i use
startx -- :n
the session starts in current tty, with no error, just as if i didn't specify anything (i think, but i may be wrong, it's because -- :1 sends to the first vt reserved to display, which is 7, and which doesn't exists on my system; i don't know how to create new vt that are reserved to x)
- if i use
startx -- vtn
Then there's the error
xf86OpenConsole: cannot open virtual console n (Permission Denied)
The question is: how can i manage the behavior in some coherent way? How can I, at least, use startx -- :n, or configure gdm so that it starts sessions in the same vt, or a vt of my choice? Or at least on which wiki page can i understand how this works? (nothing on the systemd page, or the xorg one)
Full log for the error when typing startx -- vtn:
X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.5.4-1-ARCH x86_64
Current Operating System: Linux ARQ 4.8.8-2-ARCH #1 SMP PREEMPT Thu Nov 17 14:51:03 CET 2016 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=efc16faf-7070-4d34-ba6a-dbad64589f55 rw quiet
Build Date: 19 July 2016 05:54:24PM
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/home/shaih/.local/share/xorg/Xorg.1.log", Time: Sun Dec 25 12:41:37 2016
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied)
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/home/shaih/.local/share/xorg/Xorg.1.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Thank you!
Last edited by Shaih (2016-12-25 15:47:28)
Offline
First, the ":n" parameter is not for specifying a vt, that specifies a X11 display number. "vtN" is how you specify the vt number. Startx on it's own will handle everything to start the session on the current vt, essentially it has a default flag of vt$XDG_VTNR. You should not try to override that with something else as running rootless xorg on a vt other than the one it starts on will lead to a permissions issue as you've seen.
If you must run x on a different tty, you will need to configure Xwrapper. I'd advise against this however unless there are specific needs beyond what you've gone through in your question.
Startx itself should work. As should `xinit -- vt$XDG_VTNR`. What is it that you are trying to accomplish that you need to override default behaviors?
As for gdm, I can't be of much help. I have no idea what problem DMs try to solve, but I'm well aware of many problems they cause - so I've not used one in many years.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks a lot for the answer; it seems i was a bit confused about some things.
First, the ":n" parameter is not for specifying a vt, that specifies a X11 display number. "vtN" is how you specify the vt number.
Ok, and what is a X11 display number? What is it used for?
If you must run x on a different tty, you will need to configure Xwrapper. I'd advise against this however unless there are specific needs beyond what you've gone through in your question.
There are actually two things i am trying to do:
1. Simply be sure both my display manager (if i keep using one) and my x are always in the same vts; it's very annoying if sometimes i'm in tty3 cause i forgot and logged on tty 2, and sometimes in 2, etc .
2. If it's possible and not too complicated, i would like to be able to have different DE/wm (for example, gnome and i3) opened *at the same time*, and switch between them with ctrl +alt+fN
What i managed to do so far, is change the VTreserved to 7 in logind.conf, so for now gdm always starts in tty1 and gnome always in tty7.
Also, i'd rather have gdm (or anything i could use instead) to start in tty6; is there any way to tell systemd to start a service in a specific one?
Offline
An X11 "display" has nothing to do with vts nor with physical monitors. It is the absrtraction of a single x11 session. If you start X on one tty, and for some reason you want to launch a gui program in that X session from another tty you need to give that new program a DISPLAY variable so it knows which x session to talk to.
Foreshadowing the answers to your second question, you can definitely run several separate X sessions at once on different ttys. Typically the first x session (regardless of which tty it is on) will have a DISPLAY value of :0 the second one :1 and so on. The DISPLAY variable is then what tells each client program which session to communicate with. Generally, one does not need to worry about the value of the DISPLAY variable. The value of DISPLAY is exported in the environment, so any gui program launched from *within* an x session inherits the value of DISPLAY and properly shows its windows where expected.
It is (generally) possible to have two sessions as you describe and even launch a program (e.g. a web browser or terminal emulator) in the other session - but for this you would need to specify the DISPLAY value. In other words, to launch a program from your gnome session that you wanted to actually show up in your i3 session, you'd have to fiddle with the setting of DISPLAY. In other cases, just leave it be.
Now to your questions. As suggested in my previous post, I think DMs are pretty silly - they drastically overcomplicate things. They take simple processes and make them complicated, and they make more involved processes either impossible or just poorly documented. There may be a way to do what you want with #1, but I don't know how.
Number 2 is easy. The "normal" and advised way for x to run (as of Xorg 1.16) is to have X run in the same tty in which it is launched. You can have a conditional or case statement in your xinitrc so in tty1 you could do `xinit gnome -- vt1` and in tty2 youd use `xinit i3 -- vt2 :1`. Note that on the second one I specified a value for DISPLAY. You could specify :0 for the first one, but that is just the default anyways. Also note that the actual number doesn't really matter, you could start :0 on tty2 and :1 on tty1 if you wanted, they just need to be unique. It seems to be a bit of a de-facto standard and makes the most sense to have them incremented with each new instance :0 :1 :2 etc, but again, they just need to be unique.
Now, rather than needing to remember which tty you are on, you could use the XDG_VTNR set by logind, so on any tty: `xinit gnome -- vt$XDG_VTNR` and on any other tty: `xinit i3 -- vt$XDG_VTNR`.
Really though these implementations are just to see what is happening behind the scenes as startx will handle this for you. So instead from any tty `startx gnome` and from another `startx i3 -- :1`. (NOTE: startx *might* handle incrementing the DISPLAY value for you to, you could try without the :1 there. I just don't use startx, I use xinit directly).
As another simplifying step, if you know that you always want gnome on tty1 and i3 on tty2 (or any other ttys, but provided they're always the same) you can just put all the logic in your xinitrc:
case $XDG_VTNR in
1) exec gnome ;; # or gnome-session, or whatever the command would actually be
2) exec i3 ;;
*) echo "You've not told me what to do on this tty!" ;;
esac
With that, from any tty just run startx, or startx :1, and if you are on tty1 you'll get gnome, on tty2 you'll get i3, on any other tty you'll get that silly message and X will exit. You'll be able to change between gnome and i3 with Ctrl-Alt-F1 / Ctrl-Alt-F2.
As for having a systemd service start X with these chosen DE/WMs on your prefered ttys, absolutely. See these:
https://wiki.archlinux.org/index.php/Ge … al_console
https://wiki.archlinux.org/index.php/Xi … X_at_login
As an example, if you want gnome on tty6 and i3 on tty3, you can set up auto login to tty3 and tty6. Set up autostarting of X when XDG_VTNR is 3 or 6. Either have the shellrc file have separate startx commands for 3 and 6 that specify the DE, or just put the logic in xinitrc in a case statement as I have above (just use 3 and 6 instead of 1 and 2). I chose 3 and 6 arbitrarily to show that these can be *any* tty. The number of "reserved" ttys is really not relevant for this.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks a lot for all the tips! I think I will manage to do what I want this way; i've searched a lot and never found a clear answer to those questions; i hope this post will be usefull in the future for someone with the same questions.
Just one additionnal question: i see different syntax with
startx :0
and
startx -- :0
What's the difference?
Oh, and also, what would you do so that your system may be used, when needed, by a complete unix noob? That's why i wanted to have a DM in the first place, so that if a friend/family wants to use it for surfing or videowatching, they can just start it and connect on some user, and be sent to something easy, instead of having to type commands/use i3/whatever else. Maybe i should start a gnome session on boot?
Offline
Arguments immediately following the startx command are used to start a client in the same manner as xinit(1). The special argument '--' marks the end of client arguments and the beginning of server options.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
I know for xinit you need to use the --. Startx does some funny things, it will definitely work as `startx -- :1` but startx *might* autodetect more stuff. Startx is basically just one big shell script to dummy-proof passing arguments to xinit and the xserver.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline