LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-19-2018, 02:54 PM   #1
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,675
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
Why does an xterm need a serial console?


I sort of understand how graphical terminals work: you have a master process running something like xterm and a slave process running a shell. The master receives keystrokes, displays them in the window and passes them to the slave, which thinks they come from a terminal called /dev/pts/pty(n). The slave sends its output to /dev/pts/pty(n) but it actually goes to the master which displays it underneath the input.

But why does this need a serial console? I know it must because, if you tell the evdev input driver to ignore the /dev/ttyS devices reported by udev, the xterms don't work.

Last edited by hazel; 03-19-2018 at 03:11 PM.
 
Old 03-20-2018, 03:23 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,021

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
Not really.
There is an OS, which will detect keystrokes, mouse events and similar. It will send it to an app (or probably better to say there is an app which will take the events from the kernel). This is Xorg and it will find out which app is currently in focus and will forward the event to it (this is xterm actually). Xterm itself will do more or less the same, either it can handle the event itself or will forward it to the app which is running "inside". But xterm has no idea what is really running inside, it just will create a "pseudo" tty (=/dev/pts/....) and will pass it to the command specified (this is usually bash) (passed as file descriptors 0, 1, 2). bash has no any idea about GUI, it will read the tty it has. bash also sends its stdout "back" to this pseudo tty and xterm will take care about it (=display chars for example).
I would not say master and slave at all.
I don't think xterm itself really needs serial console, but in special cases... Would be nice to explain exactly what did you try. What do you mean by xterm does not work?
 
Old 03-20-2018, 03:59 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,675

Original Poster
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
All the articles I have read about pseudo-terminals use the terms "master" and "slave". They seem to be standard terminology. Of course you are right that xterm doesn't receive keystrokes directly but from the xorg server.

All this arises out of a beef I had with xorg in Crux. When I looked at Xorg.0.log, there were loads of unsuccessful attempts by xorg (or more likely by the evdev driver) to turn the tty devices discovered by udev into input devices for X. This doesn't happen in Debian or LFS and I wondered what was causing it. Someone suggested adding an xorg configuration file telling xorg to ignore /dev/tty and /dev/ttyS devices. When I did, I found that I couldn't launch xterms any more. If I told X to ignore /dev/tty devices only, the xterms work. And I just would like to know why this is.

Unfortunately I can't tell you what "doesn't work" means here. Usually if a program won't launch from a menu or icon, I launch it from a terminal instead, and the error messages tell me exactly where things have gone wrong. But you can't launch a terminal from a terminal if you can't launch a terminal!! So I don't know what is going wrong, only that no xterm appears.

Last edited by hazel; 03-20-2018 at 04:02 AM.
 
Old 03-20-2018, 04:32 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,021

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
what I can imagine xterm could not create that pseudo terminal and therefore unable to work. You can go to console and try to run xterm from there too. Or construct a desktop icon to start a shell script which will try to start and save stdout/stderr (and probably strace) of xterm.
 
Old 03-20-2018, 04:43 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,675

Original Poster
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
How do I do it from a console? Do I have to specify the display or something?
 
Old 03-20-2018, 04:58 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,021

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
yes, specify DISPLAY or use xterm -display
but probably you will need to switch off access control first (see xhost)
 
Old 03-21-2018, 11:43 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,675

Original Poster
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
This is weird! I restored the configuration file, telling xorg to ignore both /dev/tty* and /dev/stty* as before. Then I stopped and restarted X. I went to a console, typed DISPLAY=:0 xterm, and lo and behold, a terminal appeared on my desktop! I closed it, clicked on the terminal button on my buttonbar (which is how I usually launch things) and another terminal appeared. I don't know why it didn't work before and I suppose I shall never find out. I'm going to mark this as solved because I now know the answer to my question: an xterm does not need a serial console.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Serial as console and normal serial communication hardikgohil1988 Linux - Embedded & Single-board computer 4 12-01-2015 04:57 AM
Separate output to serial console and screen console systemlordanubis Linux - Server 1 11-21-2014 03:27 AM
Hide XTERM console vbx_wx Programming 7 03-31-2011 10:01 AM
serial console +plx tech console server card pankajd Linux - Hardware 1 10-14-2009 01:45 PM
console to xterm andydoff Linux - Newbie 3 02-22-2005 03:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration