You are not logged in.
Pages: 1
$ ssh enrico@192.168.0.224
/usr/lib/Xorg.wrap: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn't get a file descriptor referring to the console.
Connection to 192.168.0.224 closed.It's not that I usually ssh on myself, but yesterday I was lazy to get up from bed to turn off the laptop on the desk, so I opened JuiceSSH on my phone, clicked on my laptop profile with the intention to run `sudo systemctl suspend`, but I got the error above.
And I see the same error if I just open a terminal and ssh from there.
And I see the same error if, even after a reboot, I log into a console which will not start X and ssh from there.
Recently I've been playing with possibly X-related settings, given I'm experimenting with xmonad on tty2 while still using i3 on tty1, so it's possible I've screwed something up.
Could my .xinit be somehow the culprit?
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
xinput set-prop 11 "libinput Tapping Enabled" 1
[[ "$XDG_VTNR" -eq 1 ]] && exec i3
if [[ "$XDG_VTNR" -eq 2 ]]; then
picom &
$HOME/miscellaneous/setscreens.sh && nitrogen --restore && exec xmonad
fiLast edited by Enrico1989 (2024-01-07 16:08:29)
Offline
In hindsight, I also think whatever the problem is, it is affecting not just SSH:
$ showkey
Couldn't get a file descriptor referring to the console.
$ echo $?
1This, however, is in X, because from the virtual terminal it works.
$ showkey
kb mode was UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 28 releaseLast edited by Enrico1989 (2024-01-07 10:41:05)
Offline
Your shells rc or profile tires to autostart xorg what's not gonna happen in an ssh login.
Fix the xorg autostart and condition it on a proper tty.
Edit: this has absolutely nothing to do w/ the showkey behavior in an x11 environment.
Last edited by seth (2024-01-07 11:47:38)
Offline
Ok, so I have this in my ~/.bash_profile,
[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ ! $DISPLAY && $XDG_VTNR -le 2 ]] && exec startxwhich seems in line with §4.2 Autostart X at login.
What's wrong with it?
Yes, I see it does startx, and I do see that connecting via SSH doesn't mean being a console user, and that
/usr/lib/Xorg.wrap: Only console users are allowed to run the X serverbut what else can I do, if I want to have X it in 2 vt?
Is the problem the number of the VT? As in, should I startx on consoles, say, 7 and 8 and leave 1 and 2 without X.... because ssh uses 1 (or 2)?
I guess I only need another restriction to startx?
Last edited by Enrico1989 (2024-01-07 14:48:04)
Offline
"seems"? No, whether something is equal to one is very different from whether it is less-than-or-equal-to two.
Your commentary seems to suggest that you think less-than-or-equal-to 2 is also the same as "1" or "2", but is completely incorrect and is the source of the current problem. In bash, zero, an infinite number of negative numbers, (nearly) any text string, and an unset variable are all considered less than or equal to 2.
Last edited by Trilby (2024-01-07 14:52:51)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
You might also want to check "$(tty)" (though iirc bash also exports that to $TTY) which is gonna look vastly different between a console and an ssh login.
Offline
you think less-than-or-equal-to 2 is also the same as "1" or "2"
No, but I completely forgot that [[ $nonexistent -eq 0 ]] is true ![]()
So the problem is solved with
[[ ! $DISPLAY && ( $XDG_VTNR == 1 || $XDG_VTNR == 2 ) ]] && exec startxOne last question before marking as SOLVED. What should
$ echo $?return on the client right after I've ssh-ed on it? I see 1. Is it normal?!
Last edited by Enrico1989 (2024-01-07 15:21:44)
Offline
Edit: this has absolutely nothing to do w/ the showkey behavior in an x11 environment.
Oh, yeah, I see
For showkey to work you need to be in a virtual console
But I remember there's a similar command for the terminal emulator running in a graphical environment, which I used to detect the code of some keys. I'm sure about this. And I kinda remember that the keys I was trying to get the codes for were the media keys. Do you know what program it is, or should I ask another question?
Offline
"echo $?" returns the status of the last command. Always.
The last command of your bash profile/rc is probably the other line in your post.
If you type that into an interactive shell inside an X11 session, what do you guess an immediate "echo $?" will tell you about the success of the command?
Offline
Ok, then the command that is failing is the following
[[ ! $DISPLAY && ( $XDG_VTNR == 1 || $XDG_VTNR == 2 ) ]] && exec startxbecause
[[ ! $DISPLAY && ( $XDG_VTNR == 1 || $XDG_VTNR == 2 ) ]]returns one, because DISPLAY is set and not zero.
So is this the right solution? (It works, but is wrong for other reasons?
[[ ! $DISPLAY && ( $XDG_VTNR == 1 || $XDG_VTNR == 2 ) ]] && exec startx || trueOffline
Why do you care about it?
ALso
Do you know what program it is, or should I ask another question?
xev
Offline
Pages: 1