Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fatal bug [running two Xorg on same tty] #404

Closed
CicadaSeventeen opened this issue Dec 28, 2021 · 7 comments
Closed

A fatal bug [running two Xorg on same tty] #404

CicadaSeventeen opened this issue Dec 28, 2021 · 7 comments
Labels

Comments

@CicadaSeventeen
Copy link

CicadaSeventeen commented Dec 28, 2021

Environment: openSUSE leap 15.3 with xfce and lightDM on Thinkpad P15v gen1
No Xephyr because it is absent in both zypper and opi so I do not bother to install.
Files building:
1,
~/test.sh: is to communicate between docker and host:
#!/bin/bash
while [ 1 -eq 1 ]
do
tem=$(sed -n '1p' $1)
sed -i '1d' $1
bash -c "$tem"
sleep 0.2
done
2, touch ~/temcom.txt

Operation:
1,
switch to a black tty, ie tty1, and log in
2,
input ~/test.sh ~/temcom.txt &
3,
input sudo -E x11docker --share=home x11docker/xfce
4,
open a xfce4-terminal in xfce and input echo "sudo -E x11docker --hostdisplay --exe xterm" >~/temcom.txt

Result:
1,
Crash and back to black tty. However, both Ctrl+C and Enter do not work
2,
Three branches:
Branch 1: Immediately switch to another tty and then do anything as wanted
Branch 2: Wait for several second and then computer will get stuck. Ctrl+Alt+Fx will not work to switch to any other tty. I have to force poweroff by physics.
Branch 3: Immediately switch to another tty, wait for several seconds, and switch back to tty1, and then just like Branch 2

It seems that after crash the SHELL of x11docker just stuck itself. It is OK to crash since I do some abnormal thing but it is fatal to crash the whole system. Please check.

Thanks.

@CicadaSeventeen
Copy link
Author

The xfce DE run in container is on nothing else but a Xorg. Since after startx running x11docker is OK, it is strange that after using x11docker to open a Xorg then x11docker does not work.
I try --ngagent instead of '--hostdisplay'. Well it does not crash, it just run like --desktop covering the xfce desktop rather than in seamless mode.

@mviereck
Copy link
Owner

mviereck commented Dec 29, 2021

The crash happens if Xorg is started on a tty where already an Xorg is running.
But x11docker tries to detect and avoid that.

I get a similar crash if I force x11docker to use the same tty twice with option --vt. However, if i don't do that, it detects a free tty as expected.

Maybe the check fails on your system.
Can you please show me the output of command tty twice:

  • before starting x11docker at all
  • in x11docker/xfce running your communication script

Please also show me the output of find /sys/class/vc/vcsa* that should list ttys already in use. This one also twice, before running x11docker and than while it is running.

Edit:

No Xephyr because it is absent in both zypper and opi so I do not bother to install.

The package name is likely xorg-x11-server-xephyr. Compare https://github.com/mviereck/x11docker/wiki/dependencies

@mviereck
Copy link
Owner

Side note: Instead of your current script setup I recommend tu use a fifo.
Example:

  • Generate a fifo file with mkfifo ~/myfifo
  • Open a terminal and write echo "hello world" > ~/myfifo. The terminal will block and wait.
  • Open a second terminal and write read message < ~/myfifo. $message will contain hello world. The first terminal unblocks.
  • Write again read message < ~/myfifo. It will block until you send another message into ~/myfifo.

@CicadaSeventeen
Copy link
Author

Sorry for replying late.


Everything is just fine if I use
xhost +
echo "export DISPLAY=$DISPLAY;x11docker --hostdisplay --exe xterm" >~/temcom.txt
Crash only happens when no DISPLAY exported on host system. I have solve the problem for me, yet this crash is something I think really need fixing for it crash the system at whole.


Before starting x11docker there is nothing worth recording.
output of x11docker --share=home x11docker/xfce is included in 1.txt and output of echo "x11docker --hostdisplay --exe xterm" >~/temcom.txt is included in '2.txt'
log.tar.gz

@mviereck
Copy link
Owner

yet this crash is something I think really need fixing for it crash the system at whole.

This happens only in the quite special setup where you send back commands to the parent tty and run another Xorg there. I don't think x11docker should catch that. Just in case, you can specify another tty with option --vt.

xhost +
echo "export DISPLAY=$DISPLAY;x11docker --hostdisplay --exe xterm" >~/temcom.txt

I recommend to use --printenv=FILE to get DISPLAY and XAUTHORITY as explained in #405 (comment).

@mviereck mviereck changed the title A fatal bug A fatal bug [running two Xorg on same tty] Dec 31, 2021
@mviereck mviereck added bug and removed wontfix labels Dec 31, 2021
@mviereck
Copy link
Owner

mviereck commented Dec 31, 2021

I've added sort of a fix:
If you add option --vt without an argument, x11docker will be forced to search for an unused tty. That will avoid the crash if sending back an Xorg command to the parent tty as your script does.

Normally, if x11docker is started on a tty, it assumes that it should use the same tty for Xorg and not switch to another one. But in your case, starting x11docker twice on same tty, this leads to a crash that can now be avoided with --vt forcing x11docker to search for another tty.

@CicadaSeventeen
Copy link
Author

OK I think that. Sorry for late for I rested during Newyear. Thanks for your advise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants