screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-privileged user can only connect to /dev/pts/X once?!


From: Marcin Cieslak
Subject: Re: Non-privileged user can only connect to /dev/pts/X once?!
Date: Sat, 6 Jun 2020 00:33:00 +0000

On Fri, 5 Jun 2020, Joe Yeung wrote:

The open() call  returned #EBUSY 16 /* Device or resource busy */
But I don't see it anything occupying it with "sudo lsof"
I see it only when I attach it with screen (or sudo screen to be precise).

I also looked into strace, but I don't see anything difference between the
succeeded first connection and the failed subsequent connection.
At this point, I think I am stuck. :-(

what is the exact sequence of the opening/closing?
understanding pseudoterminals can be hard...

I figured out that /dev/pts/X port is held open by the Xen
console daemon xenconsoled; so this is not handled by QEMU.
Xen is nice enough to tell me which pts to use to
get to the console:

# xenstore-read /local/domain/34/console/tty
/dev/pts/3

and there is a command to connect to the console (xl console).

After using "xm console" or doing "cu -l /dev/pts/3"
I am getting the console of the guest as it should be.
After closing the connection I check again and the
same pseudoterminal is still the console:

root@o:~ # xenstore-read /local/domain/34/console/tty
/dev/pts/3
root@o:~ # cu -l /dev/pts/3
Connected

debian login: debian login: debian login: ~
[EOT]
root@o:~ # xenstore-read /local/domain/34/console/tty
/dev/pts/3
root@o:~ # ls -l /dev/pts/3
crw--w----  1 root  tty  0x115 Jun  6 00:08 /dev/pts/3
root@o:~ #

The pseudoterminal continues to work.

I have prepared the screenrc file "console":

screen /dev/pts/3
kill

and ran the seqence:

root@o:~ # xenstore-read /local/domain/34/console/tty
/dev/pts/3
root@o:~ # ls -l /dev/pts/3
crw--w----  1 root  tty  0x115 Jun  6 00:08 /dev/pts/3
root@o:~ # screen -c console
(clear screen and exits with "[screen is terminating]")
and then I have

root@o:~ # ls -l /dev/pts/[34]
crw--w----  1 root  tty  0x116 Jun  6 00:12 /dev/pts/4
root@o:~ # xenstore-read /local/domain/34/console/tty
/dev/pts/4

So I'll have a new device.... which works.

I think there are two issues:

1) screen closes the slave device in a way that makes
it disappear (normal for ptys!), cu does not.

2) Linux has another layer of complexity (devpts) etc.
- please see https://lwn.net/Articles/688809/ for some
partial insight on that.

Maybe your permission-related issues (which I don't have)
might be related to the issues described in the article.

Can you try "cu -l <yourpseudoterminal>" instead of
screen and see if that helps?

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]