Re: [Vserver] Screen inside vserver

From: Michael S. Zick <mszick_at_morethan.org>
Date: Sat 14 Jan 2006 - 16:34:48 GMT
Message-Id: <200601141034.48836.mszick@morethan.org>

On Sat January 14 2006 09:48, Benedikt Boehm wrote:
> On Saturday 14 January 2006 16:46, Benedikt Boehm wrote:
> > On Saturday 14 January 2006 16:08, Michael S. Zick wrote:
> > > On Sat January 14 2006 08:59, Michael S. Zick wrote:
> > > > On Sat January 14 2006 06:40, Oliver Welter wrote:
> > > > > eyck wrote:
> > > > > >> afair, you have to ssh into the box to use screen.
> > > > > >> vserver <name> enter and issuing a screen command does not work.
> > > > > >
> > > > > > it's not that it doesn't work, it's that it easier and safer to
> > > > > > tell people 'just ssh into your guest' instead of explaining how to
> > > > > > make it work.
> > > > >
> > > > > As I dont have SSH running inside the guest and I am not afraid of
> > > > > some work, how :)
> > > >
> > > > You could try making it 'by hand' - but that would only work for the
> > > > pts that you create by hand. Also recall, that on that system, you are
> > > > using udev and /dev is probably mounted in /tmpfs, not as persistent
> > > > files on the hard disk.
> > > > Gentoo gives you three ways to handle a missing device (follow the
> > > > directions for a missing /dev/console or /dev/null).
> > > >
> > > > But what you want to handle is dynamic devices (pts 0...254) in the
> > > > guest with a device creation system that runs in the host.
> > > >
> > > > First, grab all the udev manuals you can lay your hands on...
> > > >
> > > > The 'stock' system scripts are creating devices in '/dev'; modify to
> > > > create them also in /<vserver>/<guestroot>/dev
> > > >
> > > > Sorry, I don't know how only what.
> > >
> > > Scratch that - - here is how:
> > >
> > > Each udev rule can call an external script - write one that hardlinks the
> > > just created /dev/pts/xx to a /<vservers>/<guestroot>/dev/ptx/xx
> > >
> > > Now all you have to do is figure out 'which vserver' to create the link
> > > in.
> > >
> > > Mike
>
> i missed that you link it in the root path of the vserver.. probably it works,
> but it looks more like a workaround, than a fix..
>
Ah, yes, an interesting problem. But a step towards getting the correct USB
socket (dedicated to a particular workstation) with a security device to show
up in the correct vserver dedicated to that particular workstation.

Using: strace -o screen.txt -e trace=file screen (from within an xterm)...

These are the system calls (in the guest) that you have to make succeed from
the host that is running udev (the pts/1 is because the xterm is using pts/0):

- - - -
readlink("/proc/self/fd/0", "/dev/pts/1", 511) = 10
- - - -
readlink("/proc/self/fd/0", "/dev/pts/1", 4095) = 10
stat64("/dev/pts/1", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 1), ...}) = 0
open("/dev/pts/1", O_RDWR|O_NONBLOCK) = 3
- - - -

So a simple hardlink might not work, but having a rule script that also (on the
host) makes the correct node in /<vservers>/<guestroot>/dev/pts/* should work.

Note that it is the stat64 ... st_rdev=makedev(136, 1) that is the call to the udev
system, in your case, triggered on the guest and but directed at the host.

So the question remains: Which VServer (by host path) and which xid?

It can't be the /proc/self/<anything> read by the script, since that is running
on the host - not in the guest context that triggered the request for a pts.

Still scratching my head over this question - it might require a pre-loaded *.so
in the guest context to trap these trigger events and proxy them to the udev system
running in the host context (with the additional info required).

I just hope someone can suggest an easier way.
A good starting point would be to repeat my tests, since they may have cockpit errors.

Mike

> >
> > The thing is, you normally don't run udev inside a vserver, because you
> > don't have CAP_MKNOD...
> >
It would be reasonable to only run udev on the host - host does hardware management,
even software emulated hardware.

> >
> > the problem with /dev/pts entries not appearing on vserver ... enter is
> > that the vserver prorcess only migrates to the context and replaces itself
> > with bash, so there is no login process and no terminal devices are created
> > by devpts filesystem (in contrary to the ssh attempt)...
> >
> > i don't know a solution for this atm, but if anyone can help, i'd
> > appreciate it
> >
> > Bene
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Sat Jan 14 16:35:11 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sat 14 Jan 2006 - 16:35:15 GMT by hypermail 2.1.8